diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..5472131e8a1dee26ee1859bafcdf26e0c7a83665 100644 --- a/.gitattributes +++ b/.gitattributes @@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text +*.glb filter=lfs diff=lfs merge=lfs -text diff --git a/AsyncTasksManager.js b/AsyncTasksManager.js new file mode 100644 index 0000000000000000000000000000000000000000..0152b6aac71bb203fb2c05da6d922ca5bbc95b8b --- /dev/null +++ b/AsyncTasksManager.js @@ -0,0 +1,5 @@ +var gdjs;(function(i){class l{constructor(){this.tasksWithCallback=new Array}processTasks(e){for(let s=0;s{n.error(`A promise error has not been handled, this should never happen! +If you are using JavaScript promises in an asynchronous action, make sure to add a .catch(). +Otherwise, report this as a bug on the GDevelop forums! +${s?"The following error was thrown: "+s:""}`)}).then(s=>(this.isResolved=!0,s))}update(){return this.isResolved}}i.PromiseTask=h;class k extends t{constructor(){super(...arguments);this.isResolved=!1}resolve(){this.isResolved=!0}update(){return this.isResolved}}i.ManuallyResolvableTask=k})(gdjs||(gdjs={})); +//# sourceMappingURL=AsyncTasksManager.js.map diff --git a/BlueBunny.glb b/BlueBunny.glb new file mode 100644 index 0000000000000000000000000000000000000000..9de5327aca4b3fcf2144e518750589462da5f050 --- /dev/null +++ b/BlueBunny.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47447fe211400dc60bebcda47cefb6485a4a8055c40c976fe0e13e3ea7aeda2c +size 1108556 diff --git a/BlueBunnyIcon.png b/BlueBunnyIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..b39d45d369f4d38afd79425896c704fd4430b8c5 Binary files /dev/null and b/BlueBunnyIcon.png differ diff --git a/Bomb.glb b/Bomb.glb new file mode 100644 index 0000000000000000000000000000000000000000..091038224916167c3dce7a52c37b71697e81de49 --- /dev/null +++ b/Bomb.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a4f277dd9464d6edcbd8f2ad5333e9805e976da851657e1196b8e2f1724fc8f0 +size 12264 diff --git a/Bomb.png b/Bomb.png new file mode 100644 index 0000000000000000000000000000000000000000..255fbe0eea61972b79ed8d9ac27eb7f48e67d51b Binary files /dev/null and b/Bomb.png differ diff --git a/BombeBonus.png b/BombeBonus.png new file mode 100644 index 0000000000000000000000000000000000000000..79e0677a1eccd539bcbf77559516e3378ba92f05 Binary files /dev/null and b/BombeBonus.png differ diff --git a/Cabbage.glb b/Cabbage.glb new file mode 100644 index 0000000000000000000000000000000000000000..1182ecb66fb719f440a1207de4d2642464b08615 --- /dev/null +++ b/Cabbage.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0182f48f50b95aea7cc6345b71a401ee9a6aa4f449d826b77b99b5c84a3288a1 +size 11616 diff --git a/ClassicLevel.png b/ClassicLevel.png new file mode 100644 index 0000000000000000000000000000000000000000..1eea45a583d68afce6e844605c09dfb855a1afb9 Binary files /dev/null and b/ClassicLevel.png differ diff --git a/CustomRuntimeObject.js b/CustomRuntimeObject.js new file mode 100644 index 0000000000000000000000000000000000000000..9529eb41d815cbe2692704525d26503907ec9747 --- /dev/null +++ b/CustomRuntimeObject.js @@ -0,0 +1,2 @@ +var gdjs;(function(r){const o=new r.Logger("CustomRuntimeObject");class h extends r.RuntimeObject{constructor(t,e){super(t,e);this._isUntransformedHitBoxesDirty=!0;this._untransformedHitBoxes=[];this._unrotatedAABB={min:[0,0],max:[0,0]};this._innerArea=null;this._isInnerAreaFollowingParentSize=!1;this._scaleX=1;this._scaleY=1;this._flippedX=!1;this._flippedY=!1;this.opacity=255;this._customCenter=null;this._localTransformation=new r.AffineTransformation;this._localInverseTransformation=new r.AffineTransformation;this._isLocalTransformationDirty=!0;this._type=e.type,this._instanceContainer=new r.CustomRuntimeObjectInstanceContainer(t,this),this._renderer=this._createRender(),this._initializeFromObjectData(e)}_initializeFromObjectData(t){const e=this._runtimeScene.getGame().getEventsBasedObjectData(t.type);if(!e){o.error(`A CustomRuntimeObject was initialized (or re-initialized) from object data referring to an non existing events based object data with type "${t.type}".`);return}this._isInnerAreaFollowingParentSize=e.isInnerAreaFollowingParentSize,e.instances.length>0&&(this._innerArea||(this._innerArea={min:[0,0,0],max:[0,0,0]}),this._innerArea.min[0]=e.areaMinX,this._innerArea.min[1]=e.areaMinY,this._innerArea.min[2]=e.areaMinZ,this._innerArea.max[0]=e.areaMaxX,this._innerArea.max[1]=e.areaMaxY,this._innerArea.max[2]=e.areaMaxZ),this._instanceContainer.loadFrom(t,e)}reinitialize(t){super.reinitialize(t),this._initializeFromObjectData(t),this._reinitializeRenderer(),this.onCreated()}updateFromObjectData(t,e){const i=this.getAnimator();return i&&i.updateFromObjectData(t.animatable||[],e.animatable||[]),!0}extraInitializationFromInitialInstance(t){const e=this.getAnimator();if(t.numberProperties)for(let i=0,n=t.numberProperties.length;i=this.hitBoxes.length&&this.hitBoxes.push(new r.Polygon);for(let i=0;i=this.hitBoxes[e].vertices.length&&this.hitBoxes[e].vertices.push([0,0]),t.transform(this._untransformedHitBoxes[e].vertices[i],this.hitBoxes[e].vertices[i]);this.hitBoxes[e].vertices.length=this._untransformedHitBoxes[e].vertices.length}}_updateUntransformedHitBoxes(){this._isUntransformedHitBoxesDirty=!1,this._untransformedHitBoxes.length=0;let t=Number.MAX_VALUE,e=Number.MAX_VALUE,i=-Number.MAX_VALUE,n=-Number.MAX_VALUE;for(const s of this._instanceContainer.getAdhocListOfAllInstances()){if(!s.isIncludedInParentCollisionMask())continue;Array.prototype.push.apply(this._untransformedHitBoxes,s.getHitBoxes());const a=s.getAABB();t=Math.min(t,a.min[0]),e=Math.min(e,a.min[1]),i=Math.max(i,a.max[0]),n=Math.max(n,a.max[1])}for(t===Number.MAX_VALUE&&(t=0,e=0,i=1,n=1),this._unrotatedAABB.min[0]=t,this._unrotatedAABB.min[1]=e,this._unrotatedAABB.max[0]=i,this._unrotatedAABB.max[1]=n;this.hitBoxes.length255&&(t=255),this.opacity=t,this.getRenderer().updateOpacity()}getOpacity(){return this.opacity}hide(t){t===void 0&&(t=!0),this.hidden=t,this.getRenderer().updateVisibility()}flipX(t){t!==this._flippedX&&(this._scaleX*=-1,this._flippedX=t,this.invalidateHitboxes(),this.getRenderer().update())}flipY(t){t!==this._flippedY&&(this._scaleY*=-1,this._flippedY=t,this.invalidateHitboxes(),this.getRenderer().update())}isFlippedX(){return this._flippedX}isFlippedY(){return this._flippedY}getAnimator(){return null}}r.CustomRuntimeObject=h,h.supportsReinitialization=!1})(gdjs||(gdjs={})); +//# sourceMappingURL=CustomRuntimeObject.js.map diff --git a/CustomRuntimeObject2D.js b/CustomRuntimeObject2D.js new file mode 100644 index 0000000000000000000000000000000000000000..9134f053e4d2333b1b70e14740d628c15468763d --- /dev/null +++ b/CustomRuntimeObject2D.js @@ -0,0 +1,2 @@ +var gdjs;(function(t){class n extends t.CustomRuntimeObject{constructor(e,r){super(e,r);this.getRenderer().reinitialize(this,e)}_createRender(){const e=this._runtimeScene;return new t.CustomRuntimeObject2DRenderer(this,this._instanceContainer,e)}_reinitializeRenderer(){this.getRenderer().reinitialize(this,this.getParent())}getRenderer(){return super.getRenderer()}getRendererObject(){return this.getRenderer().getRendererObject()}}t.CustomRuntimeObject2D=n})(gdjs||(gdjs={})); +//# sourceMappingURL=CustomRuntimeObject2D.js.map diff --git a/CustomRuntimeObjectInstanceContainer.js b/CustomRuntimeObjectInstanceContainer.js new file mode 100644 index 0000000000000000000000000000000000000000..e2cd2d60f71d6ff9ff84845300c3c54d03aab15f --- /dev/null +++ b/CustomRuntimeObjectInstanceContainer.js @@ -0,0 +1,2 @@ +var gdjs;(function(s){class l extends s.RuntimeInstanceContainer{constructor(t,n){super();this._isLoaded=!1;this._initialInnerArea=null;this._parent=t,this._customObject=n,this._runtimeScene=t.getScene(),this._debuggerRenderer=new s.DebuggerRenderer(this)}addLayer(t){const n=new s.RuntimeCustomObjectLayer(t,this);this._layers.put(t.name,n),this._orderedLayers.push(n)}createObject(t){const n=super.createObject(t);return this._customObject.onChildrenLocationChanged(),n}loadFrom(t,n){this._isLoaded&&this.onDestroyFromScene(this._parent),this._setOriginalInnerArea(n);for(let r=0,e=n.objects.length;r0)for(let r=0,e=n.layers.length;r0&&(t._initialInnerArea||(t._initialInnerArea={min:[t.areaMinX,t.areaMinY,t.areaMinZ],max:[t.areaMaxX,t.areaMaxY,t.areaMaxZ]}),this._initialInnerArea=t._initialInnerArea)}onDestroyFromScene(t){if(!this._isLoaded)return;const n=this.getAdhocListOfAllInstances();for(let r=0,e=n.length;ro===void 0?100:o<=0?1:o;class h extends s.RuntimeObject{constructor(t,e){super(t,e);this._z=0;this._flippedX=!1;this._flippedY=!1;this._flippedZ=!1;this._rotationX=0;this._rotationY=0;this._width=this._originalWidth=r(e.content.width),this._height=this._originalHeight=r(e.content.height),this._depth=this._originalDepth=r(e.content.depth)}getRendererObject(){return null}get3DRendererObject(){return this.getRenderer().get3DRendererObject()}updateFromObjectData(t,e){return this._setOriginalWidth(r(e.content.width)),this._setOriginalHeight(r(e.content.height)),this._setOriginalDepth(r(e.content.depth)),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),z:this.getZ(),w:this.getWidth(),h:this.getHeight(),d:this.getDepth(),rx:this.getRotationX(),ry:this.getRotationY(),flipX:this.isFlippedX(),flipY:this.isFlippedY(),flipZ:this.isFlippedZ()}}updateFromNetworkSyncData(t){super.updateFromNetworkSyncData(t),t.z!==void 0&&this.setZ(t.z),t.w!==void 0&&this.setWidth(t.w),t.h!==void 0&&this.setHeight(t.h),t.d!==void 0&&this.setDepth(t.d),t.rx!==void 0&&this.setRotationX(t.rx),t.ry!==void 0&&this.setRotationY(t.ry),t.flipX!==void 0&&this.flipX(t.flipX),t.flipY!==void 0&&this.flipY(t.flipY),t.flipZ!==void 0&&this.flipZ(t.flipZ)}extraInitializationFromInitialInstance(t){t.customSize&&(this.setWidth(t.width),this.setHeight(t.height)),t.depth!==void 0&&this.setDepth(t.depth),t.flippedX&&this.flipX(t.flippedX),t.flippedY&&this.flipY(t.flippedY),t.flippedZ&&this.flipZ(t.flippedZ)}setX(t){super.setX(t),this.getRenderer().updatePosition()}setY(t){super.setY(t),this.getRenderer().updatePosition()}setZ(t){t!==this._z&&(this._z=t,this.getRenderer().updatePosition())}getZ(){return this._z}getDrawableZ(){return this._z}getUnrotatedAABBMinZ(){return this.getDrawableZ()}getUnrotatedAABBMaxZ(){return this.getDrawableZ()+this.getDepth()}getCenterZ(){return this.getDepth()/2}getCenterZInScene(){return this.getDrawableZ()+this.getCenterZ()}setCenterZInScene(t){this.setZ(t+this._z-(this.getDrawableZ()+this.getCenterZ()))}setAngle(t){super.setAngle(t),this.getRenderer().updateRotation()}setRotationX(t){this._rotationX=t,this.getRenderer().updateRotation()}setRotationY(t){this._rotationY=t,this.getRenderer().updateRotation()}getRotationX(){return this._rotationX}getRotationY(){return this._rotationY}turnAroundX(t){const e=s.RuntimeObject3D._temporaryVector;e.set(1,0,0);const i=this.getRenderer().get3DRendererObject();i.rotateOnWorldAxis(e,s.toRad(t)),this._rotationX=s.toDegrees(i.rotation.x),this._rotationY=s.toDegrees(i.rotation.y),this.setAngle(s.toDegrees(i.rotation.z))}turnAroundY(t){const e=s.RuntimeObject3D._temporaryVector;e.set(0,1,0);const i=this.getRenderer().get3DRendererObject();i.rotateOnWorldAxis(e,s.toRad(t)),this._rotationX=s.toDegrees(i.rotation.x),this._rotationY=s.toDegrees(i.rotation.y),this.setAngle(s.toDegrees(i.rotation.z))}turnAroundZ(t){const e=s.RuntimeObject3D._temporaryVector;e.set(0,0,1);const i=this.getRenderer().get3DRendererObject();i.rotateOnWorldAxis(e,s.toRad(t)),this._rotationX=s.toDegrees(i.rotation.x),this._rotationY=s.toDegrees(i.rotation.y),this.setAngle(s.toDegrees(i.rotation.z))}getWidth(){return this._width}getHeight(){return this._height}getDepth(){return this._depth}setWidth(t){this._width!==t&&(this._width=t,this.getRenderer().updateSize(),this.invalidateHitboxes())}setHeight(t){this._height!==t&&(this._height=t,this.getRenderer().updateSize(),this.invalidateHitboxes())}setSize(t,e){this.setWidth(t),this.setHeight(e)}setDepth(t){this._depth!==t&&(this._depth=t,this.getRenderer().updateSize())}_getOriginalWidth(){return this._originalWidth}_getOriginalHeight(){return this._originalHeight}_getOriginalDepth(){return this._originalDepth}_setOriginalWidth(t){t<=0&&(t=1);const e=this._originalWidth;this._originalWidth=t,e===this._width&&this.setWidth(t)}_setOriginalHeight(t){t<=0&&(t=1);const e=this._originalHeight;this._originalHeight=t,e===this._height&&this.setHeight(t)}_setOriginalDepth(t){t<=0&&(t=1);const e=this._originalDepth;this._originalDepth=t,e===this._depth&&this.setDepth(t)}setScale(t){this.setScaleX(t),this.setScaleY(t),this.setScaleZ(t)}setScaleX(t){t<0&&(t=0),this.setWidth(this._originalWidth*t)}setScaleY(t){t<0&&(t=0),this.setHeight(this._originalHeight*t)}setScaleZ(t){t<0&&(t=0),this.setDepth(this._originalDepth*t)}getScale(){const t=this.getScaleX(),e=this.getScaleY(),i=this.getScaleZ();return t===e&&t===i?t:Math.pow(t*e*i,1/3)}getScaleX(){return Math.abs(this._width/this._originalWidth)}getScaleY(){return Math.abs(this._height/this._originalHeight)}getScaleZ(){return Math.abs(this._depth/this._originalDepth)}flipX(t){t!==this._flippedX&&(this._flippedX=t,this.getRenderer().updateSize())}flipY(t){t!==this._flippedY&&(this._flippedY=t,this.getRenderer().updateSize())}flipZ(t){t!==this._flippedZ&&(this._flippedZ=t,this.getRenderer().updateSize())}isFlippedX(){return this._flippedX}isFlippedY(){return this._flippedY}isFlippedZ(){return this._flippedZ}hide(t){super.hide(t),this.getRenderer().updateVisibility()}}h._temporaryVector=new THREE.Vector3,s.RuntimeObject3D=h})(gdjs||(gdjs={})); +//# sourceMappingURL=A_RuntimeObject3D.js.map diff --git a/Extensions/3D/A_RuntimeObject3DRenderer.js b/Extensions/3D/A_RuntimeObject3DRenderer.js new file mode 100644 index 0000000000000000000000000000000000000000..fc2a0e989db93b7e673860b4f5aba9aa4ec3b976 --- /dev/null +++ b/Extensions/3D/A_RuntimeObject3DRenderer.js @@ -0,0 +1,2 @@ +var gdjs;(function(e){class o{constructor(t,i,s){this._object=t,this._threeObject3D=s,this._threeObject3D.rotation.order="ZYX",i.getLayer("").getRenderer().add3DRendererObject(this._threeObject3D)}get3DRendererObject(){return this._threeObject3D}updatePosition(){this._threeObject3D.position.set(this._object.getX()+this._object.getWidth()/2,this._object.getY()+this._object.getHeight()/2,this._object.getZ()+this._object.getDepth()/2)}updateRotation(){this._threeObject3D.rotation.set(e.toRad(this._object.getRotationX()),e.toRad(this._object.getRotationY()),e.toRad(this._object.angle))}updateSize(){const t=this._object;this._threeObject3D.scale.set(t.isFlippedX()?-t.getWidth():t.getWidth(),t.isFlippedY()?-t.getHeight():t.getHeight(),t.isFlippedZ()?-t.getDepth():t.getDepth()),this.updatePosition()}updateVisibility(){this._threeObject3D.visible=!this._object.isHidden()}}e.RuntimeObject3DRenderer=o})(gdjs||(gdjs={})); +//# sourceMappingURL=A_RuntimeObject3DRenderer.js.map diff --git a/Extensions/3D/Base3DBehavior.js b/Extensions/3D/Base3DBehavior.js new file mode 100644 index 0000000000000000000000000000000000000000..76e106cfe772d7b7fb85597c4095aa6a73eade53 --- /dev/null +++ b/Extensions/3D/Base3DBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(e){let a;(function(t){t.is3D=o=>o.getZ&&o.setZ})(a=e.Base3DHandler||(e.Base3DHandler={}));class r extends e.RuntimeBehavior{constructor(t,o,n){super(t,o,n);this.object=n}updateFromBehaviorData(t,o){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(t){}doStepPostEvents(t){}setZ(t){this.object.setZ(t)}getZ(){return this.object.getZ()}getCenterZInScene(){return this.object.getCenterZInScene()}setCenterZInScene(t){this.object.setCenterZInScene(t)}setRotationX(t){this.object.setRotationX(t)}setRotationY(t){this.object.setRotationY(t)}getRotationX(){return this.object.getRotationX()}getRotationY(){return this.object.getRotationY()}turnAroundX(t){this.object.turnAroundX(t)}turnAroundY(t){this.object.turnAroundY(t)}turnAroundZ(t){this.object.turnAroundZ(t)}getDepth(){return this.object.getDepth()}setDepth(t){this.object.setDepth(t)}setScaleZ(t){this.object.setScaleZ(t)}getScaleZ(){return this.object.getScaleZ()}flipZ(t){this.object.flipZ(t)}isFlippedZ(){return this.object.isFlippedZ()}getUnrotatedAABBMinZ(){return this.object.getUnrotatedAABBMinZ()}getUnrotatedAABBMaxZ(){return this.object.getUnrotatedAABBMaxZ()}}e.Base3DBehavior=r,e.registerBehavior("Scene3D::Base3DBehavior",e.Base3DBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=Base3DBehavior.js.map diff --git a/Extensions/3D/Cube3DRuntimeObject.js b/Extensions/3D/Cube3DRuntimeObject.js new file mode 100644 index 0000000000000000000000000000000000000000..39d594bcb2a3b0a9172e976ae57880b38caa495e --- /dev/null +++ b/Extensions/3D/Cube3DRuntimeObject.js @@ -0,0 +1,2 @@ +var gdjs;(function(c){const i={front:0,back:1,left:2,right:3,top:4,bottom:5};class a extends c.RuntimeObject3D{constructor(t,e){super(t,e);this._materialType=c.Cube3DRuntimeObject.MaterialType.Basic;this._shouldUseTransparentTexture=e.content.enableTextureTransparency||!1,this._facesOrientation=e.content.facesOrientation||"Y",this._visibleFacesBitmask=0,e.content.frontFaceVisible&&(this._visibleFacesBitmask|=1<e===t.frn[s])){this._faceResourceNames=t.frn;for(let e=0;e(g||(g=new THREE.MeshBasicMaterial({transparent:!0,opacity:0,alphaTest:1})),g),n=(c,t)=>c.isFaceAtIndexVisible(t)?c.getInstanceContainer().getGame().getImageManager().getThreeMaterial(c.getFaceAtIndexResourceName(t),{useTransparentTexture:c.shouldUseTransparentTexture(),forceBasicMaterial:c._materialType===M.Cube3DRuntimeObject.MaterialType.Basic}):T();class f extends M.RuntimeObject3DRenderer{constructor(t,i){const l=new THREE.BoxGeometry(1,1,1),m=[n(t,r[0]),n(t,r[1]),n(t,r[2]),n(t,r[3]),n(t,r[4]),n(t,r[5])],x=new THREE.Mesh(l,m);super(t,i,x);this._boxMesh=x,this._cube3DRuntimeObject=t,this.updateSize(),this.updatePosition(),this.updateRotation()}updateFace(t){const i=b[t];i!==void 0&&(this._boxMesh.material[i]=n(this._cube3DRuntimeObject,t),this._cube3DRuntimeObject.isFaceAtIndexVisible(t)&&this.updateTextureUvMapping(t))}updateSize(){super.updateSize(),this.updateTextureUvMapping()}updateTextureUvMapping(t){const i=this._boxMesh.geometry.getAttribute("position"),l=this._boxMesh.geometry.getAttribute("uv"),m=t===void 0?0:b[t]*4,x=t===void 0?23:b[t]*4+3;for(let e=m;e<=x;e++){const R=Math.floor(e/4),o=this._boxMesh.material[R];if(!o||!o.map)continue;const u=this._cube3DRuntimeObject.shouldRepeatTextureOnFaceAtIndex(r[R]),d=this._cube3DRuntimeObject.getFacesOrientation()==="Y";let a,s;switch(R){case 0:u?d?(a=-(this._boxMesh.scale.z/o.map.source.data.width)*(i.getZ(e)-.5),s=-(this._boxMesh.scale.y/o.map.source.data.height)*(i.getY(e)+.5)):(a=-(this._boxMesh.scale.y/o.map.source.data.width)*(i.getY(e)-.5),s=this._boxMesh.scale.z/o.map.source.data.height*(i.getZ(e)-.5)):d?[a,s]=h[e%4]:[a,s]=_[e%4];break;case 1:u?d?(a=this._boxMesh.scale.z/o.map.source.data.width*(i.getZ(e)+.5),s=-(this._boxMesh.scale.y/o.map.source.data.height)*(i.getY(e)+.5)):(a=this._boxMesh.scale.y/o.map.source.data.width*(i.getY(e)+.5),s=this._boxMesh.scale.z/o.map.source.data.height*(i.getZ(e)-.5)):d?[a,s]=h[e%4]:([a,s]=_[e%4],a=-a,s=-s);break;case 2:u?(a=this._boxMesh.scale.x/o.map.source.data.width*(i.getX(e)+.5),s=this._boxMesh.scale.z/o.map.source.data.height*(i.getZ(e)-.5)):[a,s]=h[e%4];break;case 3:u?d?(a=this._boxMesh.scale.x/o.map.source.data.width*(i.getX(e)+.5),s=-(this._boxMesh.scale.z/o.map.source.data.height)*(i.getZ(e)+.5)):(a=-(this._boxMesh.scale.x/o.map.source.data.width)*(i.getX(e)-.5),s=this._boxMesh.scale.z/o.map.source.data.height*(i.getZ(e)-.5)):([a,s]=h[e%4],d||(a=-a,s=-s));break;case 4:u?(a=this._boxMesh.scale.x/o.map.source.data.width*(i.getX(e)+.5),s=-(this._boxMesh.scale.y/o.map.source.data.height)*(i.getY(e)+.5)):[a,s]=h[e%4];break;case 5:const p=this._cube3DRuntimeObject.getBackFaceUpThroughWhichAxisRotation()==="X";u?(a=(p?1:-1)*(this._boxMesh.scale.x/o.map.source.data.width)*(i.getX(e)+(p?1:-1)*.5),s=(p?1:-1)*(this._boxMesh.scale.y/o.map.source.data.height)*(i.getY(e)+(p?-1:1)*.5)):([a,s]=h[e%4],p&&(a=-a,s=-s));break;default:[a,s]=h[e%4]}l.setXY(e,a,s)}l.needsUpdate=!0}_updateMaterials(){for(let t=0;t<6;t++)this.updateFace(t)}}M.Cube3DRuntimeObjectRenderer=f})(gdjs||(gdjs={})); +//# sourceMappingURL=Cube3DRuntimeObjectPixiRenderer.js.map diff --git a/Extensions/3D/CustomRuntimeObject3D.js b/Extensions/3D/CustomRuntimeObject3D.js new file mode 100644 index 0000000000000000000000000000000000000000..df52f57214079d95bed04ca390b3d6d4bce5f72e --- /dev/null +++ b/Extensions/3D/CustomRuntimeObject3D.js @@ -0,0 +1,2 @@ +var gdjs;(function(r){class n extends r.CustomRuntimeObject{constructor(t,i){super(t,i);this._z=0;this._minZ=0;this._maxZ=0;this._scaleZ=1;this._flippedZ=!1;this._rotationX=0;this._rotationY=0;this._customCenterZ=0;this._renderer.reinitialize(this,t)}_createRender(){const t=this._runtimeScene;return new r.CustomRuntimeObject3DRenderer(this,this._instanceContainer,t)}_reinitializeRenderer(){this.getRenderer().reinitialize(this,this.getParent())}getRenderer(){return super.getRenderer()}get3DRendererObject(){return this.getRenderer().get3DRendererObject()}extraInitializationFromInitialInstance(t){super.extraInitializationFromInitialInstance(t),t.depth!==void 0&&this.setDepth(t.depth),t.flippedX&&this.flipX(t.flippedX),t.flippedY&&this.flipY(t.flippedY),t.flippedZ&&this.flipZ(t.flippedZ)}setZ(t){t!==this._z&&(this._z=t,this.getRenderer().updatePosition())}getZ(){return this._z}getDrawableZ(){let t=0;this._innerArea?t=this._innerArea.min[2]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),t=this._minZ);const i=this.getScaleZ();return this._flippedZ?this._z+(-t-this.getUnscaledDepth()+2*this.getUnscaledCenterZ())*i:this._z+t*i}getCenterZ(){return this.getDepth()/2}getCenterZInScene(){return this.getDrawableZ()+this.getCenterZ()}setCenterZInScene(t){this.setZ(t+this._z-(this.getDrawableZ()+this.getCenterZ()))}getUnrotatedAABBMinZ(){return this.getDrawableZ()}getUnrotatedAABBMaxZ(){return this.getDrawableZ()+this.getDepth()}setRotationX(t){this._rotationX=t,this.getRenderer().updateRotation()}setRotationY(t){this._rotationY=t,this.getRenderer().updateRotation()}getRotationX(){return this._rotationX}getRotationY(){return this._rotationY}turnAroundX(t){const i=r.CustomRuntimeObject3D._temporaryVector;i.set(1,0,0);const e=this.get3DRendererObject();e.rotateOnWorldAxis(i,r.toRad(t)),this._rotationX=r.toDegrees(e.rotation.x),this._rotationY=r.toDegrees(e.rotation.y),this.setAngle(r.toDegrees(e.rotation.z))}turnAroundY(t){const i=r.CustomRuntimeObject3D._temporaryVector;i.set(0,1,0);const e=this.get3DRendererObject();e.rotateOnWorldAxis(i,r.toRad(t)),this._rotationX=r.toDegrees(e.rotation.x),this._rotationY=r.toDegrees(e.rotation.y),this.setAngle(r.toDegrees(e.rotation.z))}turnAroundZ(t){const i=r.CustomRuntimeObject3D._temporaryVector;i.set(0,0,1);const e=this.get3DRendererObject();e.rotateOnWorldAxis(i,r.toRad(t)),this._rotationX=r.toDegrees(e.rotation.x),this._rotationY=r.toDegrees(e.rotation.y),this.setAngle(r.toDegrees(e.rotation.z))}getInnerAreaMinZ(){return this._innerArea?this._innerArea.min[2]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._minZ)}getInnerAreaMaxZ(){return this._innerArea?this._innerArea.max[2]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._maxZ)}getUnscaledDepth(){return this._innerArea?this._innerArea.max[2]-this._innerArea.min[2]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._maxZ-this._minZ)}_updateUntransformedHitBoxes(){super._updateUntransformedHitBoxes();let t=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(const e of this._instanceContainer.getAdhocListOfAllInstances())!e.isIncludedInParentCollisionMask()||!r.Base3DHandler.is3D(e)||(t=Math.min(t,e.getUnrotatedAABBMinZ()),i=Math.max(i,e.getUnrotatedAABBMaxZ()));t===Number.MAX_VALUE&&(t=0,i=1),this._minZ=t,this._maxZ=i}getUnscaledCenterZ(){return this.hasCustomRotationCenter()?this._customCenterZ:this._innerArea?(this._innerArea.min[2]+this._innerArea.max[2])/2:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),(this._minZ+this._maxZ)/2)}setRotationCenter3D(t,i,e){this._customCenterZ=e,this.setRotationCenter(t,i)}getDepth(){return this.getUnscaledDepth()*this.getScaleZ()}setDepth(t){const i=this.getUnscaledDepth();if(i===0)return;const e=t/i;this._innerArea&&this._isInnerAreaFollowingParentSize?(this._innerArea.min[2]*=e,this._innerArea.max[2]*=e):this.setScaleZ(e)}setScale(t){super.setScale(t),this.setScaleZ(t)}setScaleZ(t){this._innerArea&&this._isInnerAreaFollowingParentSize||(t<0&&(t=0),t!==Math.abs(this._scaleZ)&&(this._scaleZ=t*(this._flippedZ?-1:1),this.getRenderer().updateSize()))}getScale(){const t=this.getScaleX(),i=this.getScaleY(),e=this.getScaleZ();return t===i&&t===e?t:Math.pow(t*i*e,1/3)}getScaleZ(){return Math.abs(this._scaleZ)}flipZ(t){t!==this._flippedZ&&(this._flippedZ=t,this.getRenderer().updateSize())}isFlippedZ(){return this._flippedZ}}n._temporaryVector=new THREE.Vector3,r.CustomRuntimeObject3D=n})(gdjs||(gdjs={})); +//# sourceMappingURL=CustomRuntimeObject3D.js.map diff --git a/Extensions/3D/CustomRuntimeObject3DRenderer.js b/Extensions/3D/CustomRuntimeObject3DRenderer.js new file mode 100644 index 0000000000000000000000000000000000000000..00357268cfb8018a28dc3ea12300dba575075505 --- /dev/null +++ b/Extensions/3D/CustomRuntimeObject3DRenderer.js @@ -0,0 +1,2 @@ +var gdjs;(function(a){class u{constructor(e,t,i){this._isContainerDirty=!0;this._object=e,this._instanceContainer=t,this._threeGroup=new THREE.Group,this._threeGroup.rotation.order="ZYX";const r=i.getLayer("");r&&r.getRenderer().add3DRendererObject(this._threeGroup)}get3DRendererObject(){return this._threeGroup}getRendererObject(){return null}reinitialize(e,t){this._object=e,this._isContainerDirty=!0;const i=t.getLayer("");i&&i.getRenderer().add3DRendererObject(this._threeGroup)}_updateThreeGroup(){const e=this.get3DRendererObject(),t=this._object.getScaleX(),i=this._object.getScaleY(),r=this._object.getScaleZ(),n=this._object.getUnscaledCenterX()*t,s=this._object.getUnscaledCenterY()*i,o=this._object.getUnscaledCenterZ()*r;e.rotation.set(a.toRad(this._object.getRotationX()),a.toRad(this._object.getRotationY()),a.toRad(this._object.angle)),e.position.set(this._object.isFlippedX()?n:-n,this._object.isFlippedY()?s:-s,this._object.isFlippedZ()?o:-o),e.position.applyEuler(e.rotation),e.position.x+=this._object.getX()+n,e.position.y+=this._object.getY()+s,e.position.z+=this._object.getZ()+o,e.scale.set(this._object.isFlippedX()?-t:t,this._object.isFlippedY()?-i:i,this._object.isFlippedZ()?-r:r),e.visible=!this._object.hidden,this._isContainerDirty=!1}ensureUpToDate(){this._isContainerDirty&&this._updateThreeGroup()}update(){this._isContainerDirty=!0}updateX(){this._isContainerDirty=!0}updateY(){this._isContainerDirty=!0}updateAngle(){this._isContainerDirty=!0}updatePosition(){this._isContainerDirty=!0}updateRotation(){this._isContainerDirty=!0}updateSize(){this._isContainerDirty=!0}updateVisibility(){this._threeGroup.visible=!this._object.hidden}updateOpacity(){}setLayerIndex(e,t){}static getAnimationFrameTextureManager(e){return e._threeAnimationFrameTextureManager||(e._threeAnimationFrameTextureManager=new c(e)),e._threeAnimationFrameTextureManager}}a.CustomRuntimeObject3DRenderer=u;class c{constructor(e){this._imageManager=e}getAnimationFrameTexture(e){return this._imageManager.getThreeMaterial(e,{useTransparentTexture:!0,forceBasicMaterial:!0})}getAnimationFrameWidth(e){const t=e.map;return t?t.image.width:0}getAnimationFrameHeight(e){const t=e.map;return t?t.image.height:0}}})(gdjs||(gdjs={})); +//# sourceMappingURL=CustomRuntimeObject3DRenderer.js.map diff --git a/Extensions/3D/HemisphereLight.js b/Extensions/3D/HemisphereLight.js new file mode 100644 index 0000000000000000000000000000000000000000..3aa9b5b2b1b99c5890f70e3d0f869464aac88e6e --- /dev/null +++ b/Extensions/3D/HemisphereLight.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){i.PixiFiltersTools.registerFilterCreator("Scene3D::HemisphereLight",new class{makeFilter(o,r){return typeof THREE=="undefined"?new i.PixiFiltersTools.EmptyFilter:new class{constructor(){this._isEnabled=!1;this.top="Y-";this.elevation=45;this.rotation=0;this.light=new THREE.HemisphereLight,this.light.position.set(1,0,0),this.rotationObject=new THREE.Group,this.rotationObject.add(this.light),this.updateRotation()}isEnabled(t){return this._isEnabled}setEnabled(t,e){return this._isEnabled===e?!0:e?this.applyEffect(t):this.removeEffect(t)}applyEffect(t){const e=t.get3DRendererObject();return e?(e.add(this.rotationObject),this._isEnabled=!0,!0):!1}removeEffect(t){const e=t.get3DRendererObject();return e?(e.remove(this.rotationObject),this._isEnabled=!1,!0):!1}updatePreRender(t){}updateDoubleParameter(t,e){t==="intensity"?this.light.intensity=e:t==="elevation"?(this.elevation=e,this.updateRotation()):t==="rotation"&&(this.rotation=e,this.updateRotation())}getDoubleParameter(t){return t==="intensity"?this.light.intensity:t==="elevation"?this.elevation:t==="rotation"?this.rotation:0}updateStringParameter(t,e){t==="skyColor"&&(this.light.color=new THREE.Color(i.rgbOrHexStringToNumber(e))),t==="groundColor"&&(this.light.groundColor=new THREE.Color(i.rgbOrHexStringToNumber(e))),t==="top"&&(this.top=e,this.updateRotation())}updateColorParameter(t,e){t==="skyColor"&&this.light.color.setHex(e),t==="groundColor"&&this.light.groundColor.setHex(e)}getColorParameter(t){return t==="skyColor"?this.light.color.getHex():t==="groundColor"?this.light.groundColor.getHex():0}updateBooleanParameter(t,e){}updateRotation(){this.top==="Z+"?(this.rotationObject.rotation.z=i.toRad(this.rotation),this.rotationObject.rotation.y=-i.toRad(this.elevation)):(this.rotationObject.rotation.y=i.toRad(this.rotation-90),this.rotationObject.rotation.z=-i.toRad(this.elevation))}getNetworkSyncData(){return{i:this.light.intensity,sc:this.light.color.getHex(),gc:this.light.groundColor.getHex(),e:this.elevation,r:this.rotation,t:this.top}}updateFromNetworkSyncData(t){this.light.intensity=t.i,this.light.color.setHex(t.sc),this.light.groundColor.setHex(t.gc),this.elevation=t.e,this.rotation=t.r,this.top=t.t,this.updateRotation()}}}})})(gdjs||(gdjs={})); +//# sourceMappingURL=HemisphereLight.js.map diff --git a/Extensions/3D/Model3DRuntimeObject.js b/Extensions/3D/Model3DRuntimeObject.js new file mode 100644 index 0000000000000000000000000000000000000000..bfae65e47a41cd26c06969eb886749faef8dfadf --- /dev/null +++ b/Extensions/3D/Model3DRuntimeObject.js @@ -0,0 +1,2 @@ +var gdjs;(function(n){const o=r=>{switch(r){case"ModelOrigin":return null;case"ObjectCenter":return[.5,.5,.5];case"BottomCenterZ":return[.5,.5,0];case"BottomCenterY":return[.5,1,.5];case"TopLeft":return[0,0,0];default:return null}};class s extends n.RuntimeObject3D{constructor(e,t){super(e,t);this._materialType=n.Model3DRuntimeObject.MaterialType.Basic;this._currentAnimationIndex=0;this._animationSpeedScale=1;this._animationPaused=!1;this._modelResourceName=t.content.modelResourceName,this._animations=t.content.animations,this._originPoint=o(t.content.originLocation),this._centerPoint=o(t.content.centerLocation),this._renderer=new n.Model3DRuntimeObjectRenderer(this,e),this._materialType=this._convertMaterialType(t.content.materialType),this.onModelChanged(t),this.onCreated()}onModelChanged(e){this._updateModel(e),this._animations.length>0&&this._renderer.playAnimation(this._animations[0].source,this._animations[0].loop)}updateFromObjectData(e,t){return super.updateFromObjectData(e,t),e.content.materialType!==t.content.materialType&&(this._materialType=this._convertMaterialType(t.content.materialType)),e.content.modelResourceName!==t.content.modelResourceName?this._reloadModel(t):(e.content.width!==t.content.width||e.content.height!==t.content.height||e.content.depth!==t.content.depth||e.content.rotationX!==t.content.rotationX||e.content.rotationY!==t.content.rotationY||e.content.rotationZ!==t.content.rotationZ||e.content.keepAspectRatio!==t.content.keepAspectRatio||e.content.materialType!==t.content.materialType)&&this._updateModel(t),e.content.originLocation!==t.content.originLocation&&(this._originPoint=o(t.content.originLocation)),e.content.centerLocation!==t.content.centerLocation&&(this._centerPoint=o(t.content.centerLocation)),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),mt:this._materialType,op:this._originPoint,cp:this._centerPoint,anis:this._animations,ai:this._currentAnimationIndex,ass:this._animationSpeedScale,ap:this._animationPaused}}updateFromNetworkSyncData(e){super.updateFromNetworkSyncData(e),e.mt!==void 0&&(this._materialType=e.mt),e.op!==void 0&&(this._originPoint=e.op),e.cp!==void 0&&(this._centerPoint=e.cp),e.anis!==void 0&&(this._animations=e.anis),e.ai!==void 0&&this.setAnimationIndex(e.ai),e.ass!==void 0&&this.setAnimationSpeedScale(e.ass),e.ap!==void 0&&e.ap!==this.isAnimationPaused()&&(e.ap?this.pauseAnimation():this.resumeAnimation())}_reloadModel(e){this._modelResourceName=e.content.modelResourceName,this._renderer._reloadModel(this,this._runtimeScene),this.onModelChanged(e)}_updateModel(e){const t=e.content.rotationX||0,a=e.content.rotationY||0,d=e.content.rotationZ||0,i=e.content.keepAspectRatio;this._renderer._updateModel(t,a,d,this._getOriginalWidth(),this._getOriginalHeight(),this._getOriginalDepth(),i)}getRenderer(){return this._renderer}_convertMaterialType(e){return e==="KeepOriginal"?n.Model3DRuntimeObject.MaterialType.KeepOriginal:e==="StandardWithoutMetalness"?n.Model3DRuntimeObject.MaterialType.StandardWithoutMetalness:n.Model3DRuntimeObject.MaterialType.Basic}update(e){const t=this.getElapsedTime()/1e3;this._renderer.updateAnimation(t*this._animationSpeedScale)}getAnimationIndex(){return this._currentAnimationIndex}setAnimationIndex(e){if(e=e|0,e=0){const t=this._animations[e];this._currentAnimationIndex=e,this._renderer.playAnimation(t.source,t.loop),this._animationPaused&&this._renderer.pauseAnimation()}}getAnimationName(){return this._currentAnimationIndex>=this._animations.length?"":this._animations[this._currentAnimationIndex].name}setAnimationName(e){if(!e)return;const t=this._animations.findIndex(a=>a.name===e);t>=0&&this.setAnimationIndex(t)}isCurrentAnimationName(e){return this.getAnimationName()===e}hasAnimationEnded(){return this._renderer.hasAnimationEnded()}isAnimationPaused(){return this._animationPaused}pauseAnimation(){this._animationPaused=!0,this._renderer.pauseAnimation()}resumeAnimation(){this._animationPaused=!1,this._renderer.resumeAnimation()}getAnimationSpeedScale(){return this._animationSpeedScale}setAnimationSpeedScale(e){this._animationSpeedScale=e}getAnimationElapsedTime(){return this._renderer.getAnimationElapsedTime()}setAnimationElapsedTime(e){this._renderer.setAnimationElapsedTime(e),this._animationPaused||this._renderer.resumeAnimation()}getAnimationDuration(){return this._renderer.getAnimationDuration(this._animations[this._currentAnimationIndex].source)}getCenterX(){const e=this._renderer.getCenterPoint();return this.getWidth()*e[0]}getCenterY(){const e=this._renderer.getCenterPoint();return this.getHeight()*e[1]}getCenterZ(){const e=this._renderer.getCenterPoint();return this.getDepth()*e[2]}getDrawableX(){const e=this._renderer.getOriginPoint();return this.getX()-this.getWidth()*e[0]}getDrawableY(){const e=this._renderer.getOriginPoint();return this.getY()-this.getHeight()*e[1]}getDrawableZ(){const e=this._renderer.getOriginPoint();return this.getZ()-this.getDepth()*e[2]}}n.Model3DRuntimeObject=s,function(e){let r;(function(i){i[i.Basic=0]="Basic",i[i.StandardWithoutMetalness=1]="StandardWithoutMetalness",i[i.KeepOriginal=2]="KeepOriginal"})(r=e.MaterialType||(e.MaterialType={}))}(s=n.Model3DRuntimeObject||(n.Model3DRuntimeObject={})),n.registerObject("Scene3D::Model3DObject",n.Model3DRuntimeObject)})(gdjs||(gdjs={})); +//# sourceMappingURL=Model3DRuntimeObject.js.map diff --git a/Extensions/3D/Model3DRuntimeObject3DRenderer.js b/Extensions/3D/Model3DRuntimeObject3DRenderer.js new file mode 100644 index 0000000000000000000000000000000000000000..6b425a3dfb9bd53ce6b5dce7d233fd8330e7b5d1 --- /dev/null +++ b/Extensions/3D/Model3DRuntimeObject3DRenderer.js @@ -0,0 +1,2 @@ +var gdjs;(function(o){const a=1/(1<<16),g=i=>{i.metalness&&(i.metalness=0)},T=i=>{const t=i;if(!!t.material)if(Array.isArray(t.material))for(let e=0;ei.traverse(T),M=i=>{const t=new THREE.MeshBasicMaterial;return i.color&&(t.color=i.color),i.map&&(t.map=i.map),t},b=i=>{const t=i;if(!!t.material)if(Array.isArray(t.material))for(let e=0;ei.traverse(b);class j extends o.RuntimeObject3DRenderer{constructor(t,e){const s=e.getGame().getModel3DManager().getModel(t._modelResourceName),r=new THREE.Group,h=new THREE.Group;h.rotation.order="ZYX",h.add(r);super(t,e,h);this._model3DRuntimeObject=t,this._threeObject=r,this._originalModel=s,this._modelOriginPoint=[0,0,0],this.updateSize(),this.updatePosition(),this.updateRotation(),this._animationMixer=new THREE.AnimationMixer(r),this._action=null}updateAnimation(t){this._animationMixer.update(t)}updatePosition(){const t=this.getOriginPoint(),e=this.getCenterPoint();this.get3DRendererObject().position.set(this._object.getX()-this._object.getWidth()*(t[0]-e[0]),this._object.getY()-this._object.getHeight()*(t[1]-e[1]),this._object.getZ()-this._object.getDepth()*(t[2]-e[2]))}getOriginPoint(){return this._model3DRuntimeObject._originPoint||this._modelOriginPoint}getCenterPoint(){return this._model3DRuntimeObject._centerPoint||this._modelOriginPoint}_updateDefaultTransformation(t,e,s,r,h,R,p,l){t.rotation.set(o.toRad(e),o.toRad(s),o.toRad(r)),t.updateMatrixWorld(!0);const n=new THREE.Box3().setFromObject(t);!this._model3DRuntimeObject._originPoint&&n.expandByPoint(new THREE.Vector3(0,0,0));const m=n.max.x-n.min.x,c=n.max.y-n.min.y,d=n.max.z-n.min.z;this._modelOriginPoint[0]=m{const o=t.getLayer(r),e=o.getRenderer().getThreeCamera(),n=e?e instanceof THREE.OrthographicCamera?null:e.fov:m;return o.getCameraZ(n,a)},g.setCameraZ=(t,r,a,o)=>{const s=t.getLayer(a),n=s.getRenderer().getThreeCamera(),i=n?n instanceof THREE.OrthographicCamera?null:n.fov:m;s.setCameraZ(r,i,o)},g.getCameraRotationX=(t,r,a)=>{const e=t.getLayer(r).getRenderer().getThreeCamera();return e?c.toDegrees(e.rotation.x):0},g.setCameraRotationX=(t,r,a,o)=>{const n=t.getLayer(a).getRenderer().getThreeCamera();!n||(n.rotation.x=c.toRad(r))},g.getCameraRotationY=(t,r,a)=>{const e=t.getLayer(r).getRenderer().getThreeCamera();return e?c.toDegrees(e.rotation.y):0},g.setCameraRotationY=(t,r,a,o)=>{const n=t.getLayer(a).getRenderer().getThreeCamera();!n||(n.rotation.y=c.toRad(r))},g.turnCameraTowardObject=(t,r,a,o,s)=>{if(!r)return;const e=t.getLayer(a),i=e.getRenderer().getThreeCamera();!i||(s?i.up.set(0,1,0):i.up.set(0,0,1),i.lookAt(r.getCenterXInScene(),-r.getCenterYInScene(),r.getZ?r.getZ():0),e.setCameraRotation(c.toDegrees(-i.rotation.z)))},g.turnCameraTowardPosition=(t,r,a,o,s,e,n)=>{const i=t.getLayer(s),l=i.getRenderer().getThreeCamera();!l||(n?l.up.set(0,1,0):l.up.set(0,0,1),l.lookAt(r,-a,o),i.setCameraRotation(c.toDegrees(-l.rotation.z)))},g.getNearPlane=(t,r,a)=>{const e=t.getLayer(r).getRenderer().getThreeCamera();return e?e.near:0},g.setNearPlane=(t,r,a,o)=>{const e=t.getLayer(a).getRenderer(),n=e.getThreeCamera();!n||(n.near=Math.min(Math.max(r,1e-4),n.far),e.setThreeCameraDirty(!0))},g.getFarPlane=(t,r,a)=>{const e=t.getLayer(r).getRenderer().getThreeCamera();return e?e.far:0},g.setFarPlane=(t,r,a,o)=>{const e=t.getLayer(a).getRenderer(),n=e.getThreeCamera();!n||(n.far=Math.max(r,n.near),e.setThreeCameraDirty(!0))},g.getFov=(t,r,a)=>{const e=t.getLayer(r).getRenderer().getThreeCamera();return e?e instanceof THREE.OrthographicCamera?0:e.fov:m},g.setFov=(t,r,a,o)=>{const e=t.getLayer(a).getRenderer(),n=e.getThreeCamera();!n||n instanceof THREE.OrthographicCamera||(n.fov=Math.min(Math.max(r,0),180),e.setThreeCameraDirty(!0))}})(d=y.camera||(y.camera={}))})(R=c.scene3d||(c.scene3d={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=Scene3DTools.js.map diff --git a/Extensions/Effects/adjustment-pixi-filter.js b/Extensions/Effects/adjustment-pixi-filter.js new file mode 100644 index 0000000000000000000000000000000000000000..c8d815c159967c0be020fb861fb32f5ba6edd9a5 --- /dev/null +++ b/Extensions/Effects/adjustment-pixi-filter.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){i.PixiFiltersTools.registerFilterCreator("Adjustment",new class extends i.PixiFiltersTools.PixiFilterCreator{makePIXIFilter(r,t){return new PIXI.filters.AdjustmentFilter}updatePreRender(r,t){}updateDoubleParameter(r,t,e){const n=r;t==="gamma"?n.gamma=e:t==="saturation"?n.saturation=e:t==="contrast"?n.contrast=e:t==="brightness"?n.brightness=e:t==="red"?n.red=e:t==="green"?n.green=e:t==="blue"?n.blue=e:t==="alpha"&&(n.alpha=e)}getDoubleParameter(r,t){const e=r;return t==="gamma"?e.gamma:t==="saturation"?e.saturation:t==="contrast"?e.contrast:t==="brightness"?e.brightness:t==="red"?e.red:t==="green"?e.green:t==="blue"?e.blue:t==="alpha"?e.alpha:0}updateStringParameter(r,t,e){}updateColorParameter(r,t,e){}getColorParameter(r,t){return 0}updateBooleanParameter(r,t,e){}getNetworkSyncData(r){const t=r;return{ga:t.gamma,sa:t.saturation,co:t.contrast,br:t.brightness,r:t.red,g:t.green,b:t.blue,a:t.alpha}}updateFromNetworkSyncData(r,t){const e=r;e.gamma=t.ga,e.saturation=t.sa,e.contrast=t.co,e.brightness=t.br,e.red=t.r,e.green=t.g,e.blue=t.b,e.alpha=t.a}})})(gdjs||(gdjs={})); +//# sourceMappingURL=adjustment-pixi-filter.js.map diff --git a/Extensions/Effects/pixi-filters/filter-adjustment.js b/Extensions/Effects/pixi-filters/filter-adjustment.js new file mode 100644 index 0000000000000000000000000000000000000000..b04d3722e71c3db8272e00dd7d1c7a6fb58427ed --- /dev/null +++ b/Extensions/Effects/pixi-filters/filter-adjustment.js @@ -0,0 +1,49 @@ +/*! + * @pixi/filter-adjustment - v5.1.1 + * Compiled Thu, 31 Aug 2023 09:18:38 UTC + * + * @pixi/filter-adjustment is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */var __filters=function(t,r){"use strict";var i=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,e=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; + +uniform float gamma; +uniform float contrast; +uniform float saturation; +uniform float brightness; +uniform float red; +uniform float green; +uniform float blue; +uniform float alpha; + +void main(void) +{ + vec4 c = texture2D(uSampler, vTextureCoord); + + if (c.a > 0.0) { + c.rgb /= c.a; + + vec3 rgb = pow(c.rgb, vec3(1. / gamma)); + rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast); + rgb.r *= red; + rgb.g *= green; + rgb.b *= blue; + c.rgb = rgb * brightness; + + c.rgb *= c.a; + } + + gl_FragColor = c * alpha; +} +`;class a extends r.Filter{constructor(n){super(i,e),this.gamma=1,this.saturation=1,this.contrast=1,this.brightness=1,this.red=1,this.green=1,this.blue=1,this.alpha=1,Object.assign(this,n)}apply(n,s,o,u){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,n.applyFilter(this,s,o,u)}}return t.AdjustmentFilter=a,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI);Object.assign(PIXI.filters,__filters); diff --git a/Extensions/LinkedObjects/linkedobjects.js b/Extensions/LinkedObjects/linkedobjects.js new file mode 100644 index 0000000000000000000000000000000000000000..a0ebbf6e356d77093724f08db81d97b3741e5189 --- /dev/null +++ b/Extensions/LinkedObjects/linkedobjects.js @@ -0,0 +1,2 @@ +var gdjs;(function(r){const R=new r.Logger("LinkedObjects");class o{constructor(){this._links=new Map}static getManager(e){return e.linkedObjectsManager||(e.linkedObjectsManager=new r.LinksManager),e.linkedObjectsManager}_getMapOfObjectsLinkedWith(e){return this._links.has(e.id)||this._links.set(e.id,new k),this._links.get(e.id).linkedObjectMap}getObjectsLinkedWith(e){return this._links.has(e.id)||this._links.set(e.id,new k),this._links.get(e.id)}getObjectsLinkedWithAndNamed(e,t){let n=this._getMapOfObjectsLinkedWith(e).get(t);return n||(n=r.staticArray(o.prototype.getObjectsLinkedWithAndNamed)),n}linkObjects(e,t){const n=this._getMapOfObjectsLinkedWith(e);n.has(t.getName())||n.set(t.getName(),[]);const i=n.get(t.getName());i.indexOf(t)===-1&&i.push(t);const s=this._getMapOfObjectsLinkedWith(t);s.has(e.getName())||s.set(e.getName(),[]);const g=s.get(e.getName());g.indexOf(e)===-1&&g.push(e)}removeAllLinksOf(e){const t=this._links.get(e.id);if(!!t){for(const n of t.linkedObjectMap.values())for(let i=0;i{let n=t.next();for(;n.done;){const i=e.next();if(i.done)return n;t=i.value[Symbol.iterator](),n=t.next()}return n}}}};let k=h;k.emptyItr={next:()=>({value:void 0,done:!0})};let x;(function(e){let L;(function(g){r.registerObjectDeletedFromSceneCallback(function(a,c){o.getManager(a).removeAllLinksOf(c)}),g.linkObjects=function(a,c,u){c===null||u===null||o.getManager(a).linkObjects(c,u)},g.removeLinkBetween=function(a,c,u){c===null||u===null||o.getManager(a).removeLinkBetween(c,u)},g.removeAllLinksOf=function(a,c){c!==null&&o.getManager(a).removeAllLinksOf(c)},g.pickObjectsLinkedTo=function(a,c,u,N){if(u===null)return!1;const j=o.getManager(a)._getMapOfObjectsLinkedWith(u);let f=!1;for(const p in c.items)if(c.containsKey(p)){const d=c.items[p];if(d.length===0)continue;const O=r.staticArray2(r.evtTools.linkedObjects.pickObjectsLinkedTo);if(O.length=0,N)for(const l of d)O.indexOf(l.getName())<0&&O.push(l.getName());else O.push(p);let b=0;for(const l of O)b+=a.getObjects(l).length;if(d.length===b){d.length=0;for(const l of O)if(j.has(l)){const m=j.get(l);f=f||m.length>0,d.push.apply(d,m)}}else{const l=r.staticArray(r.evtTools.linkedObjects.pickObjectsLinkedTo);l.length=0;for(const m of O)if(j.has(m)){const _=j.get(m);for(const M of _)d.indexOf(M)>=0&&l.push(M)}f=f||l.length>0,d.length=0,d.push.apply(d,l),l.length=0}O.length=0}return f}})(L=e.linkedObjects||(e.linkedObjects={}))})(x=r.evtTools||(r.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=linkedobjects.js.map diff --git a/Extensions/TextObject/textruntimeobject-pixi-renderer.js b/Extensions/TextObject/textruntimeobject-pixi-renderer.js new file mode 100644 index 0000000000000000000000000000000000000000..c955133bcf77f67692f63607aa49d98d876abed2 --- /dev/null +++ b/Extensions/TextObject/textruntimeobject-pixi-renderer.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){class s{constructor(e,t){this._justCreated=!0;this._object=e,this._fontManager=t.getGame().getFontManager(),this._text=new PIXI.Text(" ",{align:"left"}),this._text.anchor.x=.5,this._text.anchor.y=.5,t.getLayer("").getRenderer().addRendererObject(this._text,e.getZOrder()),this._text.text=e._str.length===0?" ":e._str,this.updateStyle(),this.updatePosition()}getRendererObject(){return this._text}ensureUpToDate(){this._justCreated&&(this._text.updateText(!1),this.updatePosition(),this._justCreated=!1)}updateStyle(){const e='"'+this._fontManager.getFontFamily(this._object._fontName)+'"',t=this._text.style;t.fontStyle=this._object._italic?"italic":"normal",t.fontWeight=this._object._bold?"bold":"normal",t.fontSize=this._object._characterSize,t.fontFamily=e,this._object._useGradient?t.fill=this._getGradientHex():t.fill=this._getColorHex(),this._object._gradientType==="LINEAR_VERTICAL"?t.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_VERTICAL:t.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_HORIZONTAL,t.align=this._object._textAlign,t.wordWrap=this._object._wrapping,t.wordWrapWidth=this._object._wrappingWidth,t.breakWords=!0,t.stroke=i.rgbToHexNumber(this._object._outlineColor[0],this._object._outlineColor[1],this._object._outlineColor[2]),t.strokeThickness=this._object._isOutlineEnabled?this._object._outlineThickness:0,t.dropShadow=this._object._shadow,t.dropShadowColor=i.rgbToHexNumber(this._object._shadowColor[0],this._object._shadowColor[1],this._object._shadowColor[2]),t.dropShadowAlpha=this._object._shadowOpacity/255,t.dropShadowBlur=this._object._shadowBlur,t.dropShadowAngle=i.toRad(this._object._shadowAngle),t.dropShadowDistance=this._object._shadowDistance;const o=t.dropShadow?t.dropShadowDistance+t.dropShadowBlur:0;t.padding=Math.ceil(this._object._padding+o),t.miterLimit=3,this.updatePosition(),this._text.dirty=!0}updatePosition(){if(this._object.isWrapping()){const t=this._object._textAlign==="right"?1:this._object._textAlign==="center"?.5:0,o=this._object.getWrappingWidth(),h=(o-this._text.width)*(t-.5);this._text.position.x=this._object.x+o/2,this._text.anchor.x=.5-h/this._text.width}else this._text.position.x=this._object.x+this._text.width/2,this._text.anchor.x=.5;this._text.position.y=this._object.y+this._text.height/2;const e=this._object._verticalTextAlignment==="bottom"?1:this._object._verticalTextAlignment==="center"?.5:0;this._text.position.y=this._object.y+this._text.height*(.5-e),this._text.anchor.y=.5}updateAngle(){this._text.rotation=i.toRad(this._object.angle)}updateOpacity(){this._text.alpha=this._object.opacity/255}updateString(){this._text.text=this._object._str.length===0?" ":this._object._str,this._text.updateText(!1)}getWidth(){return this._text.width}getHeight(){return this._text.height}_getColorHex(){return i.rgbToHexNumber(this._object._color[0],this._object._color[1],this._object._color[2])}_getGradientHex(){const e=[];for(let t=0;t255&&(t=255),this.opacity=t,this._renderer.updateOpacity()}getOpacity(){return this.opacity}getString(){return this.getText()}setString(t){this.setText(t)}getText(){return this._str}setText(t){t!==this._str&&(this._str=t,this._renderer.updateString(),this._updateTextPosition())}getCharacterSize(){return this._characterSize}setCharacterSize(t){t<=1&&(t=1),this._characterSize=t,this._renderer.updateStyle()}setFontName(t){this._fontName=t,this._renderer.updateStyle()}isBold(){return this._bold}setBold(t){this._bold=t,this._renderer.updateStyle()}isItalic(){return this._italic}setItalic(t){this._italic=t,this._renderer.updateStyle()}getWidth(){return this._wrapping?this._wrappingWidth:this._renderer.getWidth()}getHeight(){return this._renderer.getHeight()}getScaleMean(){return(Math.abs(this._scaleX)+Math.abs(this._scaleY))/2}getScale(){const t=Math.abs(this._scaleX),s=Math.abs(this._scaleY);return t===s?t:Math.sqrt(t*s)}getScaleX(){return this._scaleX}getScaleY(){return this._scaleY}setScale(t){this._scaleX===t&&this._scaleY===t||(this._scaleX=t,this._scaleY=t,this._renderer.setScale(t),this.invalidateHitboxes())}setScaleX(t){this._scaleX!==t&&(this._scaleX=t,this._renderer.setScaleX(t),this.invalidateHitboxes())}setScaleY(t){this._scaleY!==t&&(this._scaleY=t,this._renderer.setScaleY(t),this.invalidateHitboxes())}setColor(t){const s=t.split(";");s.length<3||(this._color[0]=parseInt(s[0],10),this._color[1]=parseInt(s[1],10),this._color[2]=parseInt(s[2],10),this._useGradient=!1,this._renderer.updateStyle())}getColor(){return this._color[0]+";"+this._color[1]+";"+this._color[2]}setVerticalTextAlignment(t){this._verticalTextAlignment=t,this._renderer.updateStyle()}getVerticalTextAlignment(){return this._verticalTextAlignment}setTextAlignment(t){this._textAlign=t,this._renderer.updateStyle()}getTextAlignment(){return this._textAlign}isWrapping(){return this._wrapping}setWrapping(t){this._wrapping!==t&&(this._wrapping=t,this._renderer.updateStyle(),this.invalidateHitboxes())}getWrappingWidth(){return this._wrappingWidth}setWrappingWidth(t){t<=1&&(t=1),this._wrappingWidth!==t&&(this._wrappingWidth=t,this._wrapping&&(this._renderer.updateStyle(),this.invalidateHitboxes()))}setWidth(t){this.setWrappingWidth(t)}getDrawableY(){return this.getY()-(this._verticalTextAlignment==="center"?this.getHeight()/2:this._verticalTextAlignment==="bottom"?this.getHeight():0)}setOutline(t,s){const e=t.split(";");e.length<3||(this._outlineColor[0]=parseInt(e[0],10),this._outlineColor[1]=parseInt(e[1],10),this._outlineColor[2]=parseInt(e[2],10),this._outlineThickness=s,this._renderer.updateStyle())}isOutlineEnabled(){return this._isOutlineEnabled}setOutlineEnabled(t){this._isOutlineEnabled=t,this._renderer.updateStyle()}getOutlineThickness(){return this._outlineThickness}setOutlineThickness(t){this._outlineThickness=t,this._renderer.updateStyle()}setOutlineColor(t){this._outlineColor=r.rgbOrHexToRGBColor(t),this._renderer.updateStyle()}setShadow(t,s,e,i){const n=t.split(";");n.length<3||(this._shadowColor[0]=parseInt(n[0],10),this._shadowColor[1]=parseInt(n[1],10),this._shadowColor[2]=parseInt(n[2],10),this._shadowDistance=s,this._shadowBlur=e,this._shadowAngle=i,this._shadow=!0,this._renderer.updateStyle())}isShadowEnabled(){return this._shadow}showShadow(t){this._shadow=t,this._renderer.updateStyle()}getShadowOpacity(){return this._shadowOpacity}setShadowOpacity(t){this._shadowOpacity=t,this._renderer.updateStyle()}getShadowDistance(){return this._shadowDistance}setShadowDistance(t){this._shadowDistance=t,this._renderer.updateStyle()}getShadowAngle(){return this._shadowAngle}setShadowAngle(t){this._shadowAngle=t,this._renderer.updateStyle()}getShadowBlurRadius(){return this._shadowBlur}setShadowBlurRadius(t){this._shadowBlur=t,this._renderer.updateStyle()}setShadowColor(t){this._shadowColor=r.rgbOrHexToRGBColor(t),this._renderer.updateStyle()}setGradient(t,s,e,i,n){const o=s.split(";"),a=e.split(";"),h=i.split(";"),l=n.split(";");this._gradient=[],o.length==3&&this._gradient.push([parseInt(o[0],10),parseInt(o[1],10),parseInt(o[2],10)]),a.length==3&&this._gradient.push([parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10)]),h.length==3&&this._gradient.push([parseInt(h[0],10),parseInt(h[1],10),parseInt(h[2],10)]),l.length==3&&this._gradient.push([parseInt(l[0],10),parseInt(l[1],10),parseInt(l[2],10)]),this._gradientType=t,this._useGradient=this._gradient.length>1,this._renderer.updateStyle()}getPadding(){return this._padding}setPadding(t){this._padding=t,this._renderer.updateStyle()}}r.TextRuntimeObject=d,r.registerObject("TextObject::Text",r.TextRuntimeObject)})(gdjs||(gdjs={})); +//# sourceMappingURL=textruntimeobject.js.map diff --git a/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js b/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js new file mode 100644 index 0000000000000000000000000000000000000000..1bf1640e074c2c8adaa9086034939b823bc09164 --- /dev/null +++ b/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(l){class p extends l.RuntimeBehavior{constructor(t,e,d){super(t,e,d);this._angle=0;this._xVelocity=0;this._yVelocity=0;this._angularSpeed=0;this._leftKey=!1;this._rightKey=!1;this._upKey=!1;this._downKey=!1;this._leftKeyPressedDuration=0;this._rightKeyPressedDuration=0;this._upKeyPressedDuration=0;this._downKeyPressedDuration=0;this._wasStickUsed=!1;this._stickAngle=0;this._stickForce=0;this._dontClearInputsBetweenFrames=!1;this._ignoreDefaultControlsAsSyncedByNetwork=!1;this._wasLeftKeyPressed=!1;this._wasRightKeyPressed=!1;this._wasUpKeyPressed=!1;this._wasDownKeyPressed=!1;this._temporaryPointForTransformations=[0,0];this._topDownMovementHooks=[];this._allowDiagonals=e.allowDiagonals,this._acceleration=e.acceleration,this._deceleration=e.deceleration,this._maxSpeed=e.maxSpeed,this._angularMaxSpeed=e.angularMaxSpeed,this._rotateObject=e.rotateObject,this._angleOffset=e.angleOffset,this._ignoreDefaultControls=e.ignoreDefaultControls,this.setViewpoint(e.viewpoint,e.customIsometryAngle),this._movementAngleOffset=e.movementAngleOffset||0}getNetworkSyncData(){return this._dontClearInputsBetweenFrames=!1,this._ignoreDefaultControlsAsSyncedByNetwork=!1,{...super.getNetworkSyncData(),props:{a:this._angle,xv:this._xVelocity,yv:this._yVelocity,as:this._angularSpeed,lk:this._wasLeftKeyPressed,rk:this._wasRightKeyPressed,uk:this._wasUpKeyPressed,dk:this._wasDownKeyPressed,wsu:this._wasStickUsed,sa:this._stickAngle,sf:this._stickForce}}}updateFromNetworkSyncData(t){super.updateFromNetworkSyncData(t);const e=t.props;e.a!==void 0&&(this._angle=e.a),e.xv!==void 0&&(this._xVelocity=e.xv),e.yv!==void 0&&(this._yVelocity=e.yv),e.as!==void 0&&(this._angularSpeed=e.as),e.lk!==void 0&&(this._leftKey=e.lk),e.rk!==void 0&&(this._rightKey=e.rk),e.uk!==void 0&&(this._upKey=e.uk),e.dk!==void 0&&(this._downKey=e.dk),e.wsu!==void 0&&(this._wasStickUsed=e.wsu),e.sa!==void 0&&(this._stickAngle=e.sa),e.sf!==void 0&&(this._stickForce=e.sf),this._dontClearInputsBetweenFrames=!0,this._ignoreDefaultControlsAsSyncedByNetwork=!0}updateFromBehaviorData(t,e){return t.allowDiagonals!==e.allowDiagonals&&(this._allowDiagonals=e.allowDiagonals),t.acceleration!==e.acceleration&&(this._acceleration=e.acceleration),t.deceleration!==e.deceleration&&(this._deceleration=e.deceleration),t.maxSpeed!==e.maxSpeed&&(this._maxSpeed=e.maxSpeed),t.angularMaxSpeed!==e.angularMaxSpeed&&(this._angularMaxSpeed=e.angularMaxSpeed),t.rotateObject!==e.rotateObject&&(this._rotateObject=e.rotateObject),t.angleOffset!==e.angleOffset&&(this._angleOffset=e.angleOffset),t.ignoreDefaultControls!==e.ignoreDefaultControls&&(this._ignoreDefaultControls=e.ignoreDefaultControls),(t.platformType!==e.platformType||t.customIsometryAngle!==e.customIsometryAngle)&&this.setViewpoint(e.platformType,e.customIsometryAngle),t.movementAngleOffset!==e.movementAngleOffset&&(this._movementAngleOffset=e.movementAngleOffset),!0}setViewpoint(t,e){t==="PixelIsometry"?this._basisTransformation=new l.TopDownMovementRuntimeBehavior.IsometryTransformation(Math.atan(.5)):t==="TrueIsometry"?this._basisTransformation=new l.TopDownMovementRuntimeBehavior.IsometryTransformation(Math.PI/6):t==="CustomIsometry"?this._basisTransformation=new l.TopDownMovementRuntimeBehavior.IsometryTransformation(e*Math.PI/180):this._basisTransformation=null}setAcceleration(t){this._acceleration=t}getAcceleration(){return this._acceleration}setDeceleration(t){this._deceleration=t}getDeceleration(){return this._deceleration}setMaxSpeed(t){this._maxSpeed=t}getMaxSpeed(){return this._maxSpeed}setAngularMaxSpeed(t){this._angularMaxSpeed=t}getAngularMaxSpeed(){return this._angularMaxSpeed}setAngleOffset(t){this._angleOffset=t}getAngleOffset(){return this._angleOffset}allowDiagonals(t){this._allowDiagonals=t}diagonalsAllowed(){return this._allowDiagonals}setRotateObject(t){this._rotateObject=t}isObjectRotated(){return this._rotateObject}isMoving(){return this._xVelocity!==0||this._yVelocity!==0}getSpeed(){return Math.sqrt(this._xVelocity*this._xVelocity+this._yVelocity*this._yVelocity)}getXVelocity(){return this._xVelocity}setXVelocity(t){this._xVelocity=t}getYVelocity(){return this._yVelocity}setYVelocity(t){this._yVelocity=t}getAngle(){return this._angle}isMovementAngleAround(t,e){return Math.abs(l.evtTools.common.angleDifference(this._angle,t))<=e}setMovementAngleOffset(t){this._movementAngleOffset=t}getMovementAngleOffset(){return this._movementAngleOffset}doStepPreEvents(t){const e=37,d=38,u=39,r=40;this._leftKey||(this._leftKey=!this.shouldIgnoreDefaultControls()&&t.getGame().getInputManager().isKeyPressed(e)),this._rightKey||(this._rightKey=!this.shouldIgnoreDefaultControls()&&t.getGame().getInputManager().isKeyPressed(u)),this._downKey||(this._downKey=!this.shouldIgnoreDefaultControls()&&t.getGame().getInputManager().isKeyPressed(r)),this._upKey||(this._upKey=!this.shouldIgnoreDefaultControls()&&t.getGame().getInputManager().isKeyPressed(d));const _=this.owner.getElapsedTime();this._leftKey?this._leftKeyPressedDuration+=_:this._leftKeyPressedDuration=0,this._rightKey?this._rightKeyPressedDuration+=_:this._rightKeyPressedDuration=0,this._downKey?this._downKeyPressedDuration+=_:this._downKeyPressedDuration=0,this._upKey?this._upKeyPressedDuration+=_:this._upKeyPressedDuration=0;let s=-1;this._allowDiagonals?this._upKey&&!this._downKey?this._leftKey&&!this._rightKey?s=5:!this._leftKey&&this._rightKey?s=7:s=6:!this._upKey&&this._downKey?this._leftKey&&!this._rightKey?s=3:!this._leftKey&&this._rightKey?s=1:s=2:this._leftKey&&!this._rightKey?s=4:!this._leftKey&&this._rightKey&&(s=0):(this._upKey&&!this._downKey?s=6:!this._upKey&&this._downKey&&(s=2),this._leftKey&&!this._rightKey&&(this._upKey===this._downKey||this._upKey&&this._leftKeyPressedDuration=0,M=this._yVelocity>=0;i=Math.cos(f),n=Math.sin(f),(i===-1||i===1)&&(n=0),(n===-1||n===1)&&(i=0),this._xVelocity-=this._deceleration*y*i,this._yVelocity-=this._deceleration*y*n,this._xVelocity>0!==o&&(this._xVelocity=0),this._yVelocity>0!==M&&(this._yVelocity=0)}this._xVelocity*this._xVelocity+this._yVelocity*this._yVelocity>this._maxSpeed*this._maxSpeed&&(this._xVelocity=this._maxSpeed*i,this._yVelocity=this._maxSpeed*n),this._angularSpeed=this._angularMaxSpeed;for(const o of this._topDownMovementHooks)o.beforePositionUpdate(h);const g=(w+this._xVelocity)/2*y,m=(v+this._yVelocity)/2*y;if(this._basisTransformation===null)a.setX(a.getX()+g),a.setY(a.getY()+m);else{const o=this._temporaryPointForTransformations;o[0]=g,o[1]=m,this._basisTransformation.toScreen(o,o),a.setX(a.getX()+o[0]),a.setY(a.getY()+o[1])}(this._xVelocity!==0||this._yVelocity!==0)&&(this._angle=c,this._rotateObject&&a.rotateTowardAngle(c+this._angleOffset,this._angularSpeed)),this._wasLeftKeyPressed=this._leftKey,this._wasRightKeyPressed=this._rightKey,this._wasUpKeyPressed=this._upKey,this._wasDownKeyPressed=this._downKey,this._dontClearInputsBetweenFrames||(this._leftKey=!1,this._rightKey=!1,this._upKey=!1,this._downKey=!1)}simulateControl(t){t==="Left"?this._leftKey=!0:t==="Right"?this._rightKey=!0:t==="Up"?this._upKey=!0:t==="Down"&&(this._downKey=!0)}ignoreDefaultControls(t){this._ignoreDefaultControls=t}shouldIgnoreDefaultControls(){return this._ignoreDefaultControls||this._ignoreDefaultControlsAsSyncedByNetwork}simulateLeftKey(){this._leftKey=!0}simulateRightKey(){this._rightKey=!0}simulateUpKey(){this._upKey=!0}simulateDownKey(){this._downKey=!0}simulateStick(t,e){this._stickAngle=t%360,this._stickForce=Math.max(0,Math.min(1,e))}isUsingControl(t){return t==="Left"?this._leftKeyPressedDuration>0:t==="Right"?this._rightKeyPressedDuration>0:t==="Up"?this._upKeyPressedDuration>0:t==="Down"?this._downKeyPressedDuration>0:t==="Stick"?this._wasStickUsed:!1}getLastStickInputAngle(){return this._stickAngle}registerHook(t){this._topDownMovementHooks.push(t)}}l.TopDownMovementRuntimeBehavior=p,function(d){class K{constructor(){this.direction=-1}getDirection(){return this.direction}_setDirection(r){this.direction=r}}d.TopDownMovementHookContext=K,d._topDownMovementHookContext=new l.TopDownMovementRuntimeBehavior.TopDownMovementHookContext;class e{constructor(r){if(r<=0||r>=Math.PI/4)throw new RangeError("An isometry angle must be in ]0; pi/4] but was: "+r);const _=Math.asin(Math.tan(r)),s=Math.sin(_),h=Math.cos(Math.PI/4),a=h;this._screen=[[h,-a],[s*a,s*h]]}toScreen(r,_){const s=this._screen[0][0]*r[0]+this._screen[0][1]*r[1],h=this._screen[1][0]*r[0]+this._screen[1][1]*r[1];_[0]=s,_[1]=h}}d.IsometryTransformation=e}(p=l.TopDownMovementRuntimeBehavior||(l.TopDownMovementRuntimeBehavior={})),l.registerBehavior("TopDownMovementBehavior::TopDownMovementBehavior",l.TopDownMovementRuntimeBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=topdownmovementruntimebehavior.js.map diff --git a/Extensions/TweenBehavior/TweenManager.js b/Extensions/TweenBehavior/TweenManager.js new file mode 100644 index 0000000000000000000000000000000000000000..540455bc6f6dd73b3d32c0fa0db7b22eb7a473e6 --- /dev/null +++ b/Extensions/TweenBehavior/TweenManager.js @@ -0,0 +1,13 @@ +var gdjs;(function(d){let b;(function(f){let v;(function(l){class p{constructor(){this._tweens=new Map;this._activeTweens=new Array}step(){let t=0;for(let n=0;na===t);this._activeTweens.splice(n,1)}getProgress(t){const n=this._tweens.get(t);return n?n.getProgress():0}getValue(t){const n=this._tweens.get(t);return n?n.getValue():0}}l.TweenManager=p;const T=()=>{};class w{constructor(t,n,a,r,i){this.isPaused=!1;this.timeSource=t,this.totalDuration=n,this.easing=a,this.interpolate=r,this.elapsedTime=0,this.onFinish=i||T}step(){!this.isPlaying()||(this.elapsedTime=Math.min(this.elapsedTime+this.timeSource.getElapsedTime()/1e3,this.totalDuration),this._updateValue())}isPlaying(){return!this.isPaused&&!this.hasFinished()}hasFinished(){return this.elapsedTime===this.totalDuration}stop(t){this.elapsedTime=this.totalDuration,t&&this._updateValue()}resume(){this.isPaused=!1}pause(){this.isPaused=!0}getProgress(){return this.elapsedTime/this.totalDuration}}l.AbstractTweenInstance=w;class M extends w{constructor(t,n,a,r,i,s,u,o){super(t,n,a,r,o);this.initialValue=i,this.currentValue=i,this.targetedValue=s,this.setValue=u}_updateValue(){const t=this.easing(this.getProgress()),n=this.interpolate(this.initialValue,this.targetedValue,t);this.currentValue=n,this.setValue(n),this.hasFinished()&&this.onFinish()}getValue(){return this.currentValue}}l.SimpleTweenInstance=M;class I extends w{constructor(t,n,a,r,i,s,u,o){super(t,n,a,r,o);this.currentValues=new Array;this.initialValue=i,this.targetedValue=s,this.setValue=u}_updateValue(){const t=this.easing(this.getProgress()),n=this.initialValue.length;this.currentValues.length=n;for(let a=0;a{e/=255,t/=255,n/=255;let a=Math.max(e,t,n),r=a-Math.min(e,t,n),i=1-Math.abs(a+a-r-1),s=r&&(a===e?(t-n)/r:a===t?2+(n-e)/r:4+(e-t)/r);return[Math.round(60*(s<0?s+6:s)),Math.round((i?r/i:0)*100),Math.round((a+a-r)/2*100)]},l.hslToRgb=(e,t,n)=>{e=e%=360,e<0&&(e+=360),t=t/100,n=n/100;const a=t*Math.min(n,1-n),r=(i=0,s=(i+e/30)%12)=>n-a*Math.max(Math.min(s-3,9-s,1),-1);return[Math.round(r(0)*255),Math.round(r(8)*255),Math.round(r(4)*255)]},l.ease=(e,t,n,a)=>{const r=d.evtTools.tween.easingFunctions,i=r.hasOwnProperty(e)?r[e]:r.linear;return t+(n-t)*i(a)};/*! + * All equations are adapted from Thomas Fuchs' + * [Scripty2](https://github.com/madrobby/scripty2/blob/master/src/effects/transitions/penner.js). + * + * Based on Easing Equations (c) 2003 [Robert + * Penner](http://www.robertpenner.com/), all rights reserved. This work is + * [subject to terms](http://www.robertpenner.com/easing_terms_of_use.html). + *//*! + * TERMS OF USE - EASING EQUATIONS + * Open source under the BSD License. + * Easing Equations (c) 2003 Robert Penner, all rights reserved. + *//*! Shifty 3.0.3 - https://github.com/jeremyckahn/shifty */l.easingFunctions={linear:e=>e,easeInQuad:e=>Math.pow(e,2),easeOutQuad:e=>-(Math.pow(e-1,2)-1),easeInOutQuad:e=>(e/=.5)<1?.5*Math.pow(e,2):-.5*((e-=2)*e-2),easeInCubic:e=>Math.pow(e,3),easeOutCubic:e=>Math.pow(e-1,3)+1,easeInOutCubic:e=>(e/=.5)<1?.5*Math.pow(e,3):.5*(Math.pow(e-2,3)+2),easeInQuart:e=>Math.pow(e,4),easeOutQuart:e=>-(Math.pow(e-1,4)-1),easeInOutQuart:e=>(e/=.5)<1?.5*Math.pow(e,4):-.5*((e-=2)*Math.pow(e,3)-2),easeInQuint:e=>Math.pow(e,5),easeOutQuint:e=>Math.pow(e-1,5)+1,easeInOutQuint:e=>(e/=.5)<1?.5*Math.pow(e,5):.5*(Math.pow(e-2,5)+2),easeInSine:e=>-Math.cos(e*(Math.PI/2))+1,easeOutSine:e=>Math.sin(e*(Math.PI/2)),easeInOutSine:e=>-.5*(Math.cos(Math.PI*e)-1),easeInExpo:e=>e===0?0:Math.pow(2,10*(e-1)),easeOutExpo:e=>e===1?1:-Math.pow(2,-10*e)+1,easeInOutExpo:e=>e===0?0:e===1?1:(e/=.5)<1?.5*Math.pow(2,10*(e-1)):.5*(-Math.pow(2,-10*--e)+2),easeInCirc:e=>-(Math.sqrt(1-e*e)-1),easeOutCirc:e=>Math.sqrt(1-Math.pow(e-1,2)),easeInOutCirc:e=>(e/=.5)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1),easeOutBounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,easeInBack:e=>{const t=1.70158;return e*e*((t+1)*e-t)},easeOutBack:e=>{const t=1.70158;return(e=e-1)*e*((t+1)*e+t)+1},easeInOutBack:e=>{let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},elastic:e=>-1*Math.pow(4,-8*e)*Math.sin((e*6-1)*(2*Math.PI)/2)+1,swingFromTo:e=>{let t=1.70158;return(e/=.5)<1?.5*(e*e*(((t*=1.525)+1)*e-t)):.5*((e-=2)*e*(((t*=1.525)+1)*e+t)+2)},swingFrom:e=>{const t=1.70158;return e*e*((t+1)*e-t)},swingTo:e=>{const t=1.70158;return(e-=1)*e*((t+1)*e+t)+1},bounce:e=>e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375,bouncePast:e=>e<1/2.75?7.5625*e*e:e<2/2.75?2-(7.5625*(e-=1.5/2.75)*e+.75):e<2.5/2.75?2-(7.5625*(e-=2.25/2.75)*e+.9375):2-(7.5625*(e-=2.625/2.75)*e+.984375),easeFromTo:e=>(e/=.5)<1?.5*Math.pow(e,4):-.5*((e-=2)*Math.pow(e,3)-2),easeFrom:e=>Math.pow(e,4),easeTo:e=>Math.pow(e,.25)}})(v=f.tween||(f.tween={}))})(b=d.evtTools||(d.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=TweenManager.js.map diff --git a/Extensions/TweenBehavior/tweenruntimebehavior.js b/Extensions/TweenBehavior/tweenruntimebehavior.js new file mode 100644 index 0000000000000000000000000000000000000000..50e8cc85f6ac472549b5160d6ebb5391a47c5005 --- /dev/null +++ b/Extensions/TweenBehavior/tweenruntimebehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(w){const p=new w.Logger("Tween");function O(h){return h.setScaleX&&h.setScaleY&&h.getScaleX&&h.getScaleY}function R(h){return h.setOpacity&&h.getOpacity}function S(h){return h.getZ&&h.setZ}function C(h){return h.setColor&&h.getColor}function F(h){return h.setCharacterSize&&h.getCharacterSize}const g=w.evtTools.common.lerp,m=w.evtTools.common.exponentialInterpolation;class X extends w.RuntimeBehavior{constructor(e,t,n){super(e,t,n);this._tweens=new w.evtTools.tween.TweenManager;this._isActive=!0}updateFromBehaviorData(e,t){return!0}doStepPreEvents(e){this._tweens.step()}_deleteFromScene(){this.owner.deleteFromScene(this.owner.getInstanceContainer())}addVariableTween(e,t,n,o,i,s,r){this._tweens.addSimpleTween(e,this.owner.getRuntimeScene(),s/1e3,i,g,n,o,a=>t.setNumber(a),r?()=>this._deleteFromScene():null)}addVariableTween2(e,t,n,o,i,s){this._addVariableTween(e,t,n,o,i/1e3,s,this.owner.getRuntimeScene())}addVariableTween3(e,t,n,o,i,s){this._addVariableTween(e,t,n,o,i,s,this.owner)}_addVariableTween(e,t,n,o,i,s,r){t.getType()==="number"&&this._tweens.addSimpleTween(e,r,i,o,g,t.getValue(),n,a=>t.setNumber(a),s?()=>this._deleteFromScene():null)}addValueTween(e,t,n,o,i,s,r){this._tweens.addSimpleTween(e,this.owner,i,o,s?m:g,t,n,a=>{},r?()=>this._deleteFromScene():null)}addObjectPositionTween(e,t,n,o,i,s){this._addObjectPositionTween(e,t,n,o,i/1e3,s,this.owner.getRuntimeScene())}addObjectPositionTween2(e,t,n,o,i,s){this._addObjectPositionTween(e,t,n,o,i,s,this.owner)}_addObjectPositionTween(e,t,n,o,i,s,r){this._tweens.addMultiTween(e,r,i,o,g,[this.owner.getX(),this.owner.getY()],[t,n],([a,l])=>this.owner.setPosition(a,l),s?()=>this._deleteFromScene():null)}addObjectPositionXTween(e,t,n,o,i){this._addObjectPositionXTween(e,t,n,o/1e3,i,this.owner.getRuntimeScene())}addObjectPositionXTween2(e,t,n,o,i){this._addObjectPositionXTween(e,t,n,o,i,this.owner)}_addObjectPositionXTween(e,t,n,o,i,s){this._tweens.addSimpleTween(e,s,o,n,g,this.owner.getX(),t,r=>this.owner.setX(r),i?()=>this._deleteFromScene():null)}addObjectPositionYTween(e,t,n,o,i){this._addObjectPositionYTween(e,t,n,o/1e3,i,this.owner.getRuntimeScene())}addObjectPositionYTween2(e,t,n,o,i){this._addObjectPositionYTween(e,t,n,o,i,this.owner)}_addObjectPositionYTween(e,t,n,o,i,s){this._tweens.addSimpleTween(e,s,o,n,g,this.owner.getY(),t,r=>this.owner.setY(r),i?()=>this._deleteFromScene():null)}addObjectPositionZTween(e,t,n,o,i){this._addObjectPositionZTween(e,t,n,o/1e3,i,this.owner.getRuntimeScene())}addObjectPositionZTween2(e,t,n,o,i,s){this._addObjectPositionZTween(t,n,o,i,s,this.owner)}_addObjectPositionZTween(e,t,n,o,i,s){const{owner:r}=this;!S(r)||this._tweens.addSimpleTween(e,s,o,n,g,r.getZ(),t,a=>r.setZ(a),i?()=>this._deleteFromScene():null)}addObjectAngleTween(e,t,n,o,i){this._addObjectAngleTween(e,t,n,o/1e3,i,this.owner.getRuntimeScene())}addObjectAngleTween2(e,t,n,o,i){this._addObjectAngleTween(e,t,n,o,i,this.owner)}_addObjectAngleTween(e,t,n,o,i,s){this._tweens.addSimpleTween(e,s,o,n,g,this.owner.getAngle(),t,r=>this.owner.setAngle(r),i?()=>this._deleteFromScene():null)}addObjectRotationXTween(e,t,n,o,i,s){const{owner:r}=this;!S(r)||this._tweens.addSimpleTween(t,this.owner,i,o,g,r.getRotationX(),n,a=>r.setRotationX(a),s?()=>this._deleteFromScene():null)}addObjectRotationYTween(e,t,n,o,i,s){const{owner:r}=this;!S(r)||this._tweens.addSimpleTween(t,this.owner,i,o,g,r.getRotationY(),n,a=>r.setRotationY(a),s?()=>this._deleteFromScene():null)}addObjectScaleTween(e,t,n,o,i,s,r){this._addObjectScaleTween(e,t,n,o,i/1e3,s,r,this.owner.getRuntimeScene(),g)}addObjectScaleTween2(e,t,n,o,i,s,r){this._addObjectScaleTween(e,t,n,o,i,s,r,this.owner,m)}_addObjectScaleTween(e,t,n,o,i,s,r,a,l){const d=this.owner;if(!O(d))return;t<0&&(t=0),n<0&&(n=0);const c=r?([b,T])=>{const f=d.getCenterXInScene(),u=d.getCenterYInScene();d.setScaleX(b),d.setScaleY(T),d.setCenterPositionInScene(f,u)}:([b,T])=>{d.setScaleX(b),d.setScaleY(T)};this._tweens.addMultiTween(e,a,i,o,l,[d.getScaleX(),d.getScaleY()],[t,n],c,s?()=>this._deleteFromScene():null)}addObjectScaleTween3(e,t,n,o,i,s){this._addObjectScaleXTween(e,t,n,o,i,s,this.owner,m);const r=this.owner;if(!O(r))return;const a=S(r)?r:null,l=s?d=>{const c=r.getCenterXInScene(),b=r.getCenterYInScene(),T=a?a.getCenterZInScene():0;r.setScale(d),r.setCenterXInScene(c),r.setCenterYInScene(b),a&&a.setCenterZInScene(T)}:d=>r.setScale(d);this._tweens.addSimpleTween(e,this.owner,o,n,m,r.getScale(),t,l,i?()=>this._deleteFromScene():null)}addObjectScaleXTween(e,t,n,o,i,s){this._addObjectScaleXTween(e,t,n,o/1e3,i,s,this.owner.getRuntimeScene(),g)}addObjectScaleXTween2(e,t,n,o,i,s){this._addObjectScaleXTween(e,t,n,o,i,s,this.owner,m)}_addObjectScaleXTween(e,t,n,o,i,s,r,a){const l=this.owner;if(!O(l))return;const d=s?c=>{const b=l.getCenterXInScene();l.setScaleX(c),l.setCenterXInScene(b)}:c=>l.setScaleX(c);this._tweens.addSimpleTween(e,r,o,n,a,l.getScaleX(),t,d,i?()=>this._deleteFromScene():null)}addObjectScaleYTween(e,t,n,o,i,s){this._addObjectScaleYTween(e,t,n,o/1e3,i,s,this.owner.getRuntimeScene(),g)}addObjectScaleYTween2(e,t,n,o,i,s){this._addObjectScaleYTween(e,t,n,o,i,s,this.owner,m)}_addObjectScaleYTween(e,t,n,o,i,s,r,a){const l=this.owner;if(!O(l))return;const d=s?c=>{const b=l.getCenterYInScene();l.setScaleY(c),l.setCenterYInScene(b)}:c=>l.setScaleY(c);this._tweens.addSimpleTween(e,r,o,n,a,l.getScaleY(),t,d,i?()=>this._deleteFromScene():null)}addObjectOpacityTween(e,t,n,o,i){this._addObjectOpacityTween(e,t,n,o/1e3,i,this.owner.getRuntimeScene())}addObjectOpacityTween2(e,t,n,o,i){this._addObjectOpacityTween(e,t,n,o,i,this.owner)}_addObjectOpacityTween(e,t,n,o,i,s){const r=this.owner;!R(r)||this._tweens.addSimpleTween(e,s,o,n,g,r.getOpacity(),t,a=>r.setOpacity(a),i?()=>this._deleteFromScene():null)}addNumberEffectPropertyTween(e,t,n,o,i,s,r,a){const l=this.owner.getRendererEffects()[o];l||p.error(`The object "${this.owner.name}" doesn't have any effect called "${o}"`),this._tweens.addSimpleTween(t,this.owner,r,s,g,l?l.getDoubleParameter(i):0,n,d=>{l&&l.updateDoubleParameter(i,d)},a?()=>this._deleteFromScene():null)}addColorEffectPropertyTween(e,t,n,o,i,s,r,a){const l=this.owner.getRendererEffects()[o];l||p.error(`The object "${this.owner.name}" doesn't have any effect called "${o}"`);const d=w.hexNumberToRGB(l?l.getColorParameter(i):0),c=w.rgbOrHexToRGBColor(n);this._tweens.addMultiTween(t,this.owner,r,s,g,w.evtTools.tween.rgbToHsl(d.r,d.g,d.b),w.evtTools.tween.rgbToHsl(c[0],c[1],c[2]),([b,T,f])=>{if(l){const u=w.evtTools.tween.hslToRgb(b,T,f);l.updateColorParameter(i,w.rgbToHexNumber(u[0],u[1],u[2]))}},a?()=>this._deleteFromScene():null)}addObjectColorTween(e,t,n,o,i,s){this._addObjectColorTween(e,t,n,o/1e3,i,s,this.owner.getRuntimeScene())}addObjectColorTween2(e,t,n,o,i,s=!0){this._addObjectColorTween(e,t,n,o,i,s,this.owner)}_addObjectColorTween(e,t,n,o,i,s,r){const a=this.owner;if(!C(a))return;const l=w.rgbOrHexToRGBColor(a.getColor()),d=w.rgbOrHexToRGBColor(t);let c,b,T;s?(c=w.evtTools.tween.rgbToHsl(l[0],l[1],l[2]),b=w.evtTools.tween.rgbToHsl(d[0],d[1],d[2]),T=([f,u,j])=>{const _=w.evtTools.tween.hslToRgb(f,u,j);a.setColor(Math.floor(_[0])+";"+Math.floor(_[1])+";"+Math.floor(_[2]))}):(c=l,b=d,T=([f,u,j])=>{a.setColor(Math.floor(f)+";"+Math.floor(u)+";"+Math.floor(j))}),this._tweens.addMultiTween(e,r,o,n,g,c,b,T,i?()=>this._deleteFromScene():null)}addObjectColorHSLTween(e,t,n,o,i,s,r,a){this._addObjectColorHSLTween(e,t,n,o,i,s,r/1e3,a,this.owner.getRuntimeScene())}addObjectColorHSLTween2(e,t,n,o,i,s,r,a){this._addObjectColorHSLTween(e,t,n,o,i,s,r,a,this.owner)}_addObjectColorHSLTween(e,t,n,o,i,s,r,a,l){if(!C(this.owner))return;const d=this.owner,c=d.getColor().split(";");if(c.length<3)return;const b=w.evtTools.tween.rgbToHsl(parseFloat(c[0]),parseFloat(c[1]),parseFloat(c[2])),T=n?t:b[0],f=o===-1?b[1]:Math.min(Math.max(o,0),100),u=i===-1?b[2]:Math.min(Math.max(i,0),100);this._tweens.addMultiTween(e,l,r,s,g,b,[T,f,u],([j,_,P])=>{const v=w.evtTools.tween.hslToRgb(j,_,P);d.setColor(Math.floor(v[0])+";"+Math.floor(v[1])+";"+Math.floor(v[2]))},a?()=>this._deleteFromScene():null)}addTextObjectCharacterSizeTween(e,t,n,o,i){this._addTextObjectCharacterSizeTween(e,t,n,o/1e3,i,this.owner.getRuntimeScene(),g)}addTextObjectCharacterSizeTween2(e,t,n,o,i){this._addTextObjectCharacterSizeTween(e,t,n,o,i,this.owner,m)}_addTextObjectCharacterSizeTween(e,t,n,o,i,s,r){const a=this.owner;!F(a)||this._tweens.addSimpleTween(e,s,o,n,r,a.getCharacterSize(),t,l=>a.setCharacterSize(l),i?()=>this._deleteFromScene():null)}addObjectWidthTween(e,t,n,o,i){this._addObjectWidthTween(e,t,n,o/1e3,i,this.owner.getRuntimeScene())}addObjectWidthTween2(e,t,n,o,i){this._addObjectWidthTween(e,t,n,o,i,this.owner)}_addObjectWidthTween(e,t,n,o,i,s){this._tweens.addSimpleTween(e,s,o,n,g,this.owner.getWidth(),t,r=>this.owner.setWidth(r),i?()=>this._deleteFromScene():null)}addObjectHeightTween(e,t,n,o,i){this._addObjectHeightTween(e,t,n,o/1e3,i,this.owner.getRuntimeScene())}addObjectHeightTween2(e,t,n,o,i){this._addObjectHeightTween(e,t,n,o,i,this.owner)}_addObjectHeightTween(e,t,n,o,i,s){this._tweens.addSimpleTween(e,s,o,n,g,this.owner.getHeight(),t,r=>this.owner.setHeight(r),i?()=>this._deleteFromScene():null)}addObjectDepthTween(e,t,n,o,i){this._addObjectDepthTween(e,t,n,o/1e3,i,this.owner.getRuntimeScene())}addObjectDepthTween2(e,t,n,o,i,s){this._addObjectDepthTween(t,n,o,i,s,this.owner)}_addObjectDepthTween(e,t,n,o,i,s){const{owner:r}=this;!S(r)||this._tweens.addSimpleTween(e,s,o,n,g,r.getDepth(),t,a=>r.setDepth(a),i?()=>this._deleteFromScene():null)}isPlaying(e){return this._tweens.isPlaying(e)}exists(e){return this._tweens.exists(e)}hasFinished(e){return this._tweens.hasFinished(e)}pauseTween(e){this._isActive&&this._tweens.pauseTween(e)}stopTween(e,t){this._isActive&&this._tweens.stopTween(e,t)}resumeTween(e){this._isActive&&this._tweens.resumeTween(e)}removeTween(e){this._tweens.removeTween(e)}getProgress(e){return this._tweens.getProgress(e)}getValue(e){return this._tweens.getValue(e)}onDeActivate(){this._isActive=!1}onActivate(){this._isActive=!0}}w.TweenRuntimeBehavior=X,w.registerBehavior("Tween::TweenBehavior",w.TweenRuntimeBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=tweenruntimebehavior.js.map diff --git a/FlammeBonus.png b/FlammeBonus.png new file mode 100644 index 0000000000000000000000000000000000000000..8bcf5f94f41402458d88bcbbc594f9cbe697d458 Binary files /dev/null and b/FlammeBonus.png differ diff --git a/FlashyRock.glb b/FlashyRock.glb new file mode 100644 index 0000000000000000000000000000000000000000..fcc98eb2dcfefba18c818469a3f8131e75bd9b81 --- /dev/null +++ b/FlashyRock.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:92f95539bbc335ba09ab12adfc6deadbd6d4584c96b08d0c4d11071e1a0a4261 +size 5492 diff --git a/GreyBlock.glb b/GreyBlock.glb new file mode 100644 index 0000000000000000000000000000000000000000..4c2086709047ff8af08f13c3fa2714dd27079109 --- /dev/null +++ b/GreyBlock.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:87e7b442ee5b5cd84a974881db35c86f3487c50af24139279d5dda760f5fec29 +size 19156 diff --git a/JoueurSelectionMask.png b/JoueurSelectionMask.png new file mode 100644 index 0000000000000000000000000000000000000000..1381b75ce187147f5b30d593879f6dae8eba3ab7 Binary files /dev/null and b/JoueurSelectionMask.png differ diff --git a/LICENSE.GDevelop.txt b/LICENSE.GDevelop.txt new file mode 100644 index 0000000000000000000000000000000000000000..b707a925c34caeb6240db8fe913186dd2f7cb2d8 --- /dev/null +++ b/LICENSE.GDevelop.txt @@ -0,0 +1,2 @@ +Part of this app is using the GDevelop game engine, which is licensed under the MIT license. +Find more information on https://gdevelop.io/. \ No newline at end of file diff --git a/Model3DManager.js b/Model3DManager.js new file mode 100644 index 0000000000000000000000000000000000000000..e2e5eeabf9fb866f38d5d4b5c44bb25aa0741e95 --- /dev/null +++ b/Model3DManager.js @@ -0,0 +1,2 @@ +var gdjs;(function(d){const a=new d.Logger("Model3DManager"),i=["model3D"];class l{constructor(r){this._loadedThreeModels=new d.ResourceCache;this._downloadedArrayBuffers=new d.ResourceCache;this._loader=null;this._dracoLoader=null;if(this._resourceLoader=r,typeof THREE!="undefined"){this._loader=new THREE_ADDONS.GLTFLoader,this._dracoLoader=new THREE_ADDONS.DRACOLoader,this._dracoLoader.setDecoderPath("./pixi-renderers/draco/gltf/"),this._loader.setDRACOLoader(this._dracoLoader);const e=new THREE.Group;e.add(new THREE.Mesh(new THREE.BoxGeometry(1,1,1),new THREE.MeshBasicMaterial({color:"#ff00ff"}))),this._invalidModel={scene:e,animations:[],cameras:[],scenes:[],asset:{},userData:{},parser:null}}}getResourceKinds(){return i}async processResource(r){const e=this._resourceLoader.getResource(r);if(!e){a.warn('Unable to find texture for resource "'+r+'".');return}const t=this._loader;if(!t)return;const s=this._downloadedArrayBuffers.get(e);if(!!s){this._downloadedArrayBuffers.delete(e);try{const o=await t.parseAsync(s,"");this._loadedThreeModels.set(e,o)}catch(o){a.error("Can't fetch the 3D model file "+e.file+", error: "+o)}}}async loadResource(r){const e=this._resourceLoader.getResource(r);if(!e){a.warn('Unable to find texture for resource "'+r+'".');return}if(!this._loader||this._loadedThreeModels.get(e))return;const s=this._resourceLoader.getFullUrl(e.file);try{const o=await fetch(s,{credentials:this._resourceLoader.checkIfCredentialsRequired(s)?"include":"omit"});if(!o.ok)throw new Error("Network response was not ok");const n=await o.arrayBuffer();this._downloadedArrayBuffers.set(e,n)}catch(o){a.error("Can't fetch the 3D model file "+e.file+", error: "+o)}}getModel(r){return this._loadedThreeModels.getFromName(r)||this._invalidModel}dispose(){this._loadedThreeModels.clear(),this._downloadedArrayBuffers.clear(),this._loader=null,this._dracoLoader=null,this._invalidModel&&(this._invalidModel.cameras=[],this._invalidModel.animations=[],this._invalidModel.scenes=[],this._invalidModel.userData={},this._invalidModel.asset={},this._invalidModel.scene.clear())}}d.Model3DManager=l})(gdjs||(gdjs={})); +//# sourceMappingURL=Model3DManager.js.map diff --git a/New image.png b/New image.png new file mode 100644 index 0000000000000000000000000000000000000000..fd17c69a46a9294dd0de83d31799492b9a002088 Binary files /dev/null and b/New image.png differ diff --git a/NewObject.png b/NewObject.png new file mode 100644 index 0000000000000000000000000000000000000000..e64659d07f1925dde552f139cea5dcb51a9b8baf Binary files /dev/null and b/NewObject.png differ diff --git a/NewSprite.png b/NewSprite.png new file mode 100644 index 0000000000000000000000000000000000000000..8406785e1ec52da75854926e3470d06924e1155d Binary files /dev/null and b/NewSprite.png differ diff --git a/Orange.png b/Orange.png new file mode 100644 index 0000000000000000000000000000000000000000..56da6c303d48ab542322f4af38986fb7832ec9b7 Binary files /dev/null and b/Orange.png differ diff --git a/OrangeBunny.glb b/OrangeBunny.glb new file mode 100644 index 0000000000000000000000000000000000000000..2c75fa758f7e12385c3ed13a691256007424c296 --- /dev/null +++ b/OrangeBunny.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5190b37364448c7909c84a2ac1d43f6eca5e929d5df2e9d8d5b7aadb247793b8 +size 1108668 diff --git a/OrangeBunnyIcon.png b/OrangeBunnyIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..ae472b3361a57aaaab99870eecb03090eb42ce1e Binary files /dev/null and b/OrangeBunnyIcon.png differ diff --git a/Pink.png b/Pink.png new file mode 100644 index 0000000000000000000000000000000000000000..1fb004f86968ff87ac34f2468aaad9b8ca881574 Binary files /dev/null and b/Pink.png differ diff --git a/PinkBunny.glb b/PinkBunny.glb new file mode 100644 index 0000000000000000000000000000000000000000..afbe67ebdbef0e86a0af172bb2effb561d47f54d --- /dev/null +++ b/PinkBunny.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:22287ec25bd5edf7818fa35d56b11acc6f992a3ae7be64b58571dfc1bc2d9b13 +size 1108668 diff --git a/PinkBunnyIcon.png b/PinkBunnyIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..ea1396967f9fb62b6f86f34b0e5535403018a928 Binary files /dev/null and b/PinkBunnyIcon.png differ diff --git a/Purple.png b/Purple.png new file mode 100644 index 0000000000000000000000000000000000000000..72c3697f2482c06e67f54edc309229b48cc2abf3 Binary files /dev/null and b/Purple.png differ diff --git a/PurpleBunny.glb b/PurpleBunny.glb new file mode 100644 index 0000000000000000000000000000000000000000..bc863a64f8e46614cf608aa1ec65bae60d081a26 --- /dev/null +++ b/PurpleBunny.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ba129bd4c18d171c5c276076beff41c56dfe0fd1e118c89f7aed96325d7007e +size 1108672 diff --git a/PurpleBunnyIcon.png b/PurpleBunnyIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..2c01bb900f39d267398afc59954f8fb1b9e49dab Binary files /dev/null and b/PurpleBunnyIcon.png differ diff --git a/ResourceCache.js b/ResourceCache.js new file mode 100644 index 0000000000000000000000000000000000000000..b4e7d89df4d5a85a218e1829d792bc54a465c091 --- /dev/null +++ b/ResourceCache.js @@ -0,0 +1,2 @@ +var gdjs;(function(a){class n{constructor(){this._nameToContent=new Map;this._fileToContent=new Map}getFromName(e){return this._nameToContent.get(e)||null}get(e){let t=this._nameToContent.get(e.name);return t||(t=this._fileToContent.get(e.file),t?(this._nameToContent.set(e.name,t),t):null)}set(e,t){this._nameToContent.set(e.name,t),this._fileToContent.set(e.file,t)}delete(e){this._nameToContent.delete(e.name),this._fileToContent.delete(e.file)}clear(){this._nameToContent.clear(),this._fileToContent.clear()}}a.ResourceCache=n})(gdjs||(gdjs={})); +//# sourceMappingURL=ResourceCache.js.map diff --git a/ResourceLoader.js b/ResourceLoader.js new file mode 100644 index 0000000000000000000000000000000000000000..473557df78e8be959dbaa420481ae09fe054216e --- /dev/null +++ b/ResourceLoader.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){const c=new i.Logger("ResourceLoader"),f=(t,e,s)=>{if(t.startsWith("data:")||t.startsWith("blob:"))return t;const n=t.indexOf("?")===-1?"?":"&";return t+n+e+"="+s},_=t=>t.startsWith("https://project-resources.gdevelop.io/")||t.startsWith("https://project-resources-dev.gdevelop.io/"),g=20,R=5,d=3;class v{constructor(e){this.isFinished=!1;this.sceneName=e,this.onProgressCallbacks=new Array,this.onFinishCallbacks=new Array}registerCallback(e,s){if(this.isFinished){e();return}this.onFinishCallbacks.push(e),s&&this.onProgressCallbacks.push(s)}onProgress(e,s){for(const n of this.onProgressCallbacks)n(e,s)}onFinish(){this.isFinished=!0;for(const e of this.onFinishCallbacks)e()}}class w{constructor(e,s,n,r){this._sceneToLoadQueue=new Array;this._spineAtlasManager=null;this._spineManager=null;this.currentLoadingSceneName="";this.currentSceneLoadingProgress=0;this._isLoadingInForeground=!0;this._runtimeGame=e,this._resources=new Map,this._globalResources=n,this._sceneResources=new Map,this._sceneNamesToLoad=new Set,this._sceneNamesToMakeReady=new Set,this.setResources(s,n,r),this._imageManager=new i.ImageManager(this),this._soundManager=new i.SoundManager(this),this._fontManager=new i.FontManager(this),this._jsonManager=new i.JsonManager(this),this._bitmapFontManager=new i.BitmapFontManager(this,this._imageManager),this._model3DManager=new i.Model3DManager(this),i.SpineAtlasManager&&i.SpineManager&&(this._spineAtlasManager=new i.SpineAtlasManager(this,this._imageManager),this._spineManager=new i.SpineManager(this,this._spineAtlasManager));const a=[this._imageManager,this._soundManager,this._fontManager,this._jsonManager,this._bitmapFontManager,this._model3DManager];this._spineAtlasManager&&a.push(this._spineAtlasManager),this._spineManager&&a.push(this._spineManager),this._resourceManagersMap=new Map;for(const o of a)for(const u of o.getResourceKinds())this._resourceManagersMap.set(u,o)}getRuntimeGame(){return this._runtimeGame}setResources(e,s,n){this._globalResources=s,this._sceneResources.clear(),this._sceneNamesToLoad.clear(),this._sceneNamesToMakeReady.clear();for(const r of n)this._sceneResources.set(r.name,r.usedResources.map(a=>a.name)),this._sceneNamesToLoad.add(r.name),this._sceneNamesToMakeReady.add(r.name);this._sceneToLoadQueue.length=0;for(let r=n.length-1;r>=0;r--){const a=n[r];this._sceneToLoadQueue.push(new v(a.name))}this._resources.clear();for(const r of e)!r.file||this._resources.set(r.name,r)}async loadAllResources(e){let s=0;await h([...this._resources.values()],g,d,async n=>{await this._loadResource(n),await this._processResource(n),s++,e(s,this._resources.size)}),this._sceneNamesToLoad.clear(),this._sceneNamesToMakeReady.clear()}async loadGlobalAndFirstSceneResources(e,s){const n=this._sceneResources.get(e);if(!n){c.warn(`Can't load resource for unknown scene: "`+e+'".');return}let r=0;const a=[...this._globalResources,...n.values()];await h(a,g,d,async o=>{const u=this._resources.get(o);if(!u){c.warn('Unable to find resource "'+o+'".');return}await this._loadResource(u),await this._processResource(u),r++,s(r,a.length)}),this._setSceneAssetsLoaded(e),this._setSceneAssetsReady(e)}async loadAllSceneInBackground(){for(;this._sceneToLoadQueue.length>0;){const e=this._sceneToLoadQueue[this._sceneToLoadQueue.length-1];e!==void 0&&(this.currentLoadingSceneName=e.sceneName,this.areSceneAssetsLoaded(e.sceneName)?this._sceneToLoadQueue.pop():(await this._doLoadSceneResources(e.sceneName,async(s,n)=>e.onProgress(s,n)),this._sceneToLoadQueue.splice(this._sceneToLoadQueue.findIndex(s=>s===e),1),e.onFinish()))}this.currentLoadingSceneName=""}async _doLoadSceneResources(e,s){const n=this._sceneResources.get(e);if(!n){c.warn(`Can't load resource for unknown scene: "`+e+'".');return}let r=0;await h([...n.values()],this._isLoadingInForeground?g:R,d,async a=>{const o=this._resources.get(a);if(!o){c.warn('Unable to find resource "'+a+'".');return}await this._loadResource(o),r++,this.currentSceneLoadingProgress=r/this._resources.size,s&&await s(r,this._resources.size)}),this._setSceneAssetsLoaded(e)}async _loadResource(e){const s=this._resourceManagersMap.get(e.kind);if(!s){c.warn('Unknown resource kind: "'+e.kind+'" for: "'+e.name+'".');return}await s.loadResource(e.name)}async loadAndProcessSceneResources(e,s){if(this.areSceneAssetsReady(e))return;await this.loadSceneResources(e,s);const n=this._sceneResources.get(e);if(!n){c.warn(`Can't load resource for unknown scene: "`+e+'".');return}let r=0;for(const a of n){const o=this._resources.get(a);if(!o){c.warn('Unable to find resource "'+a+'".');continue}await this._processResource(o),r++,s&&await s(r,n.length)}this._setSceneAssetsReady(e)}async loadSceneResources(e,s){this._isLoadingInForeground=!0;const n=this._prioritizeScene(e);return new Promise((r,a)=>{if(!n){this._isLoadingInForeground=!1,r();return}n.registerCallback(()=>{this._isLoadingInForeground=!1,r()},s)})}dispose(){for(const e of this._resourceManagersMap.values())e.dispose()}_prioritizeScene(e){const s=this._sceneToLoadQueue.findIndex(r=>r.sceneName===e);if(s<0)return null;const n=this._sceneToLoadQueue[s];return this._sceneToLoadQueue.splice(s,1),this._sceneToLoadQueue.push(n),n}async _processResource(e){const s=this._resourceManagersMap.get(e.kind);if(!s){c.warn('Unknown resource kind: "'+e.kind+'" for: "'+e.name+'".');return}await s.processResource(e.name)}getSceneLoadingProgress(e){return e===this.currentLoadingSceneName?this.currentSceneLoadingProgress:this.areSceneAssetsLoaded(e)?1:0}areSceneAssetsLoaded(e){return!this._sceneNamesToLoad.has(e)}areSceneAssetsReady(e){return!this._sceneNamesToMakeReady.has(e)}_setSceneAssetsLoaded(e){this._sceneNamesToLoad.delete(e)}_setSceneAssetsReady(e){this._sceneNamesToMakeReady.delete(e)}getResource(e){return this._resources.get(e)||null}getFullUrl(e){const{gdevelopResourceToken:s}=this._runtimeGame._options;return!s||!_(e)?e:f(e,"gd_resource_token",encodeURIComponent(s))}checkIfCredentialsRequired(e){return this._runtimeGame._options.gdevelopResourceToken?!1:!!_(e)}getSoundManager(){return this._soundManager}getImageManager(){return this._imageManager}getFontManager(){return this._fontManager}getBitmapFontManager(){return this._bitmapFontManager}getJsonManager(){return this._jsonManager}getModel3DManager(){return this._model3DManager}getSpineManager(){return this._spineManager}getSpineAtlasManager(){return this._spineAtlasManager}}i.ResourceLoader=w;const p=(t,e,s)=>{const n=[],r=[];let a=0,o=0;return new Promise((u,y)=>{const m=()=>{if(t.length===0){u({results:n,errors:r});return}for(;an.push(l)).catch(l=>r.push({item:M,error:l})).finally(()=>{a--,o===t.length&&a===0?u({results:n,errors:r}):m()})}};m()})},h=async(t,e,s,n)=>{const r=await p(t,e,n);r.errors.length!==0&&c.warn("Some assets couldn't be downloaded. Trying again now.");for(let a=1;aa==="3d"?1:a==="2d+3d"||a===""?2:0;let s;(function(t){t[t.PERSPECTIVE=0]="PERSPECTIVE",t[t.ORTHOGRAPHIC=1]="ORTHOGRAPHIC"})(s=i.RuntimeLayerCameraType||(i.RuntimeLayerCameraType={}));const l=a=>a==="orthographic"?1:0;let o;(function(t){t[t.DO_NOTHING=0]="DO_NOTHING",t[t.TOP_LEFT_ANCHORED_IF_NEVER_MOVED=1]="TOP_LEFT_ANCHORED_IF_NEVER_MOVED"})(o=i.RuntimeLayerDefaultCameraBehavior||(i.RuntimeLayerDefaultCameraBehavior={}));const c=a=>a==="top-left-anchored-if-never-moved"?1:0;class d{constructor(e,t){this._timeScale=1;this._defaultZOrder=0;this._rendererEffects={};this._name=e.name,this._renderingType=f(e.renderingType),this._cameraType=l(e.cameraType),this._defaultCameraBehavior=c(e.defaultCameraBehavior||"top-left-anchored-if-never-moved"),this._hidden=!e.visibility,this._initialCamera3DFieldOfView=e.camera3DFieldOfView||45,this._initialCamera3DNearPlaneDistance=e.camera3DNearPlaneDistance||.1,this._initialCamera3DFarPlaneDistance=e.camera3DFarPlaneDistance||2e3,this._initialEffectsData=e.effects||[],this._runtimeScene=t,this._effectsManager=t.getGame().getEffectsManager(),this._isLightingLayer=e.isLightingLayer,this._followBaseLayerCamera=e.followBaseLayerCamera,this._clearColor=[e.ambientLightColorR/255,e.ambientLightColorG/255,e.ambientLightColorB/255,1],this._renderer=new i.LayerRenderer(this,t.getRenderer(),t.getGame().getRenderer()),this.show(!this._hidden);for(let r=0;r=0&&(this._timeScale=e)}getTimeScale(){return this._timeScale}getElapsedTime(e){return(e||this._runtimeScene).getElapsedTime()*this._timeScale}followBaseLayer(){const e=this._runtimeScene.getLayer("");this.setCameraX(e.getCameraX()),this.setCameraY(e.getCameraY()),this.setCameraRotation(e.getCameraRotation()),this.setCameraZoom(e.getCameraZoom())}getClearColor(){return this._clearColor}setClearColor(e,t,r){this._clearColor[0]=e/255,this._clearColor[1]=t/255,this._clearColor[2]=r/255,this._renderer.updateClearColor()}setFollowBaseLayerCamera(e){this._followBaseLayerCamera=e}isLightingLayer(){return this._isLightingLayer}}i.RuntimeLayer=d})(gdjs||(gdjs={})); +//# sourceMappingURL=RuntimeLayer.js.map diff --git a/SmoothParticle.png b/SmoothParticle.png new file mode 100644 index 0000000000000000000000000000000000000000..871c194ccc645f90c7a7acc1224477b5dbda9738 Binary files /dev/null and b/SmoothParticle.png differ diff --git a/Soil2.png b/Soil2.png new file mode 100644 index 0000000000000000000000000000000000000000..118c7f1d6392586ce514a4657318fa55b4ed13ce Binary files /dev/null and b/Soil2.png differ diff --git a/SoilBorder.png b/SoilBorder.png new file mode 100644 index 0000000000000000000000000000000000000000..8b71d4c8e48ad051c3ad77871e8f9605f6401477 Binary files /dev/null and b/SoilBorder.png differ diff --git a/SoilCorner.png b/SoilCorner.png new file mode 100644 index 0000000000000000000000000000000000000000..58fc2d149d62f4ac0442a2364323289b73ac7899 Binary files /dev/null and b/SoilCorner.png differ diff --git a/SpriteAnimator.js b/SpriteAnimator.js new file mode 100644 index 0000000000000000000000000000000000000000..8fc2b2e9c08b48ed02cd55ad3bd5a59bfab904c4 --- /dev/null +++ b/SpriteAnimator.js @@ -0,0 +1,2 @@ +var gdjs;(function(a){class c{constructor(t,i){this.center={x:0,y:0};this.origin={x:0,y:0};this.hasCustomHitBoxes=!1;this.customHitBoxes=[];this.image=t?t.image:"",this.texture=i.getAnimationFrameTexture(this.image),this.points=new Hashtable,this.reinitialize(t,i)}reinitialize(t,i){this.image=t.image,this.texture=i.getAnimationFrameTexture(this.image),this.points.clear();for(let n=0,o=t.points.length;n=this.customHitBoxes.length&&this.customHitBoxes.push(new a.Polygon);let s=0;for(const u=m.length;s=this.customHitBoxes[n].vertices.length&&this.customHitBoxes[n].vertices.push([0,0]),this.customHitBoxes[n].vertices[s][0]=l.x,this.customHitBoxes[n].vertices[s][1]=l.y}this.customHitBoxes[n].vertices.length=s}this.customHitBoxes.length=n}else this.customHitBoxes.length=0}getPoint(t){return t==="Centre"||t==="Center"?this.center:t==="Origin"?this.origin:this.points.containsKey(t)?this.points.get(t):this.origin}}a.SpriteAnimationFrame=c;class _{constructor(t,i){this.frames=[];this.timeBetweenFrames=t?t.timeBetweenFrames:1,this.loop=!!t.looping,this.reinitialize(t,i)}reinitialize(t,i){this.timeBetweenFrames=t?t.timeBetweenFrames:1,this.loop=!!t.looping;let e=0;for(const r=t.sprites.length;e=this._animations.length||this._currentDirection>=this._animations[this._currentAnimation].directions.length)return!1;const i=this._animations[this._currentAnimation].directions[this._currentDirection],e=this.getAnimationDuration();if(!this._animationPaused&&(i.loop||this._animationElapsedTime!==e)&&i.timeBetweenFrames){const r=this._animationElapsedTime+t*this._animationSpeedScale;return this.setAnimationElapsedTime(i.loop?a.evtTools.common.mod(r,e):a.evtTools.common.clamp(r,0,e))}return!1}setOnFrameChangeCallback(t){this._onFrameChange=t}getAnimationIndex(){return this._currentAnimation}setAnimationIndex(t){return t=t|0,t=0?(this._currentAnimation=t,this._currentFrameIndex=0,this._animationElapsedTime=0,this.invalidateFrame(),!0):!1}getAnimationName(){return this._currentAnimation>=this._animations.length?"":this._animations[this._currentAnimation].name}setAnimationName(t){if(!t)return!1;for(let i=0;i=this._animations.length||this._currentDirection>=this._animations[this._currentAnimation].directions.length)return!0;const t=this._animations[this._currentAnimation].directions[this._currentDirection];return t.loop?!1:this._currentFrameIndex===t.frames.length-1&&this._animationElapsedTime===t.frames.length*t.timeBetweenFrames}isAnimationPaused(){return this._animationPaused}pauseAnimation(){this._animationPaused=!0}resumeAnimation(){this._animationPaused=!1}getAnimationSpeedScale(){return this._animationSpeedScale}setAnimationSpeedScale(t){this._animationSpeedScale=t}setAnimationFrameIndex(t){if(this._currentAnimation>=this._animations.length||this._currentDirection>=this._animations[this._currentAnimation].directions.length)return!1;const i=this._animations[this._currentAnimation].directions[this._currentDirection];return t>=0&&t=this._animations.length)return 0;const t=this._animations[this._currentAnimation];return this._currentDirection>=t.directions.length?0:t.directions[this._currentDirection].frames.length}setDirectionOrAngle(t,i){if(this._currentAnimation>=this._animations.length)return null;const e=this._animations[this._currentAnimation];return e.hasMultipleDirections?(i=i|0,i===this._currentDirection||i>=e.directions.length||e.directions[i].frames.length===0?null:(this._currentDirection=i,this._currentFrameIndex=0,this._animationElapsedTime=0,this.invalidateFrame(),0)):t===i?null:i}getDirectionOrAngle(t){return this._currentAnimation>=this._animations.length?0:this._animations[this._currentAnimation].hasMultipleDirections?this._currentDirection:t}getAngle(t){return this._currentAnimation>=this._animations.length?0:this._animations[this._currentAnimation].hasMultipleDirections?this._currentDirection*45:t}setAngle(t,i){return this._currentAnimation>=this._animations.length?null:this._animations[this._currentAnimation].hasMultipleDirections?(i=i%360,i<0&&(i+=360),this.setDirectionOrAngle(t,Math.round(i/45)%8)):t===i?null:i}hasAnimationEndedLegacy(){if(this._currentAnimation>=this._animations.length||this._currentDirection>=this._animations[this._currentAnimation].directions.length)return!0;const t=this._animations[this._currentAnimation].directions[this._currentDirection];return t.loop?!1:this._currentFrameIndex===t.frames.length-1}}a.SpriteAnimator=g})(gdjs||(gdjs={})); +//# sourceMappingURL=SpriteAnimator.js.map diff --git a/affinetransformation.js b/affinetransformation.js new file mode 100644 index 0000000000000000000000000000000000000000..916c62031c3a42b48dc02d11a1580867057eac1f --- /dev/null +++ b/affinetransformation.js @@ -0,0 +1,2 @@ +var gdjs;(function(c){class y{constructor(){this.matrix=new Float32Array([1,0,0,1,0,0])}setToIdentity(){const o=this.matrix;o[0]=1,o[1]=0,o[2]=0,o[3]=1,o[4]=0,o[5]=0}isIdentity(){const o=this.matrix;return o[0]===1&&o[1]===0&&o[2]===0&&o[3]===1&&o[4]===0&&o[5]===0}equals(o){const t=this.matrix,a=o.matrix;return this===o||t[0]===a[0]&&t[1]===a[1]&&t[2]===a[2]&&t[3]===a[3]&&t[4]===a[4]&&t[5]===a[5]}nearlyEquals(o,t){const a=this.matrix,s=o.matrix;return this===o||c.nearlyEqual(a[0],s[0],t)&&c.nearlyEqual(a[1],s[1],t)&&c.nearlyEqual(a[2],s[2],t)&&c.nearlyEqual(a[3],s[3],t)&&c.nearlyEqual(a[4],s[4],t)&&c.nearlyEqual(a[5],s[5],t)}copyFrom(o){const t=this.matrix,a=o.matrix;return t[0]=a[0],t[1]=a[1],t[2]=a[2],t[3]=a[3],t[4]=a[4],t[5]=a[5],this}setToTranslation(o,t){const a=this.matrix;a[0]=1,a[1]=0,a[2]=0,a[3]=1,a[4]=o,a[5]=t}translate(o,t){var a=this.matrix;a[4]=a[0]*o+a[2]*t+a[4],a[5]=a[1]*o+a[3]*t+a[5]}setToScale(o,t){const a=this.matrix;a[0]=o,a[1]=0,a[2]=0,a[3]=t,a[4]=0,a[5]=0}scale(o,t){const a=this.matrix;a[0]*=o,a[1]*=o,a[2]*=t,a[3]*=t}setToRotation(o){const t=this.matrix;let a=Math.cos(o),s=Math.sin(o);(a===-1||a===1)&&(s=0),(s===-1||s===1)&&(a=0),t[0]=a,t[1]=s,t[2]=-s,t[3]=a,t[4]=0,t[5]=0}rotate(o){const t=this.matrix;let a=Math.cos(o),s=Math.sin(o);(a===-1||a===1)&&(s=0),(s===-1||s===1)&&(a=0);const i=t[0],n=t[1],m=t[2],r=t[3];t[0]=i*a+m*s,t[1]=n*a+r*s,t[2]=i*-s+m*a,t[3]=n*-s+r*a}setToRotationAround(o,t,a){const s=this.matrix;let i=Math.cos(o),n=Math.sin(o);(i===-1||i===1)&&(n=0),(n===-1||n===1)&&(i=0),s[0]=i,s[1]=n,s[2]=-n,s[3]=i,s[4]=t-t*i+a*n,s[5]=a-t*n+a*i}rotateAround(o,t,a){this.translate(t,a),this.rotate(o),this.translate(-t,-a)}setToFlipX(o){const t=this.matrix;t[0]=-1,t[1]=0,t[2]=0,t[3]=1,t[4]=2*o,t[5]=0}flipX(o){this.translate(o,0),this.scale(-1,1),this.translate(-o,0)}setToFlipY(o){const t=this.matrix;t[0]=-1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=2*o}flipY(o){this.translate(0,o),this.scale(1,-1),this.translate(0,-o)}concatenate(o){const t=this.matrix,a=o.matrix,s=t[0],i=t[1],n=t[2],m=t[3],r=t[4],h=t[5],l=a[0],e=a[1],x=a[2],f=a[3],u=a[4],T=a[5];t[0]=l*s+e*n,t[1]=l*i+e*m,t[2]=x*s+f*n,t[3]=x*i+f*m,t[4]=u*s+T*n+r,t[5]=u*i+T*m+h}preConcatenate(o){const t=this.matrix,a=o.matrix,s=t[0],i=t[1],n=t[2],m=t[3],r=t[4],h=t[5],l=a[0],e=a[1],x=a[2],f=a[3],u=a[4],T=a[5];t[0]=s*l+i*x,t[1]=s*e+i*f,t[2]=n*l+m*x,t[3]=n*e+m*f,t[4]=r*l+h*x+u,t[5]=r*e+h*f+T}transform(o,t){const a=this.matrix,s=a[0]*o[0]+a[2]*o[1]+a[4],i=a[1]*o[0]+a[3]*o[1]+a[5];t[0]=s,t[1]=i}invert(){const o=this.matrix,t=o[0],a=o[1],s=o[2],i=o[3],n=o[4],m=o[5],r=t*i-a*s;return o[0]=i/r,o[1]=-a/r,o[2]=-s/r,o[3]=t/r,o[4]=(s*m-i*n)/r,o[5]=-(t*m-a*n)/r,this}toString(){const o=this.matrix;return`[[${o[0]} ${o[1]}] [${o[2]} ${o[3]}] [${o[4]} ${o[5]}]]`}}c.AffineTransformation=y})(gdjs||(gdjs={})); +//# sourceMappingURL=affinetransformation.js.map diff --git a/blockRoundedLong.glb b/blockRoundedLong.glb new file mode 100644 index 0000000000000000000000000000000000000000..0884a72b7a8379fad6dd3d515f1e83b36610d884 --- /dev/null +++ b/blockRoundedLong.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e6b67e13c7f82d52cbae0d53b1f243a63cd1794b0d3a61b951b0aad9e37c813 +size 20732 diff --git a/code0.js b/code0.js new file mode 100644 index 0000000000000000000000000000000000000000..913737a12e4da591b5573def3838ec7d5d14ad6a --- /dev/null +++ b/code0.js @@ -0,0 +1,2375 @@ +gdjs.GameCode = {}; +gdjs.GameCode.localVariables = []; +gdjs.GameCode.GDPlayer1Objects3_1final = []; + +gdjs.GameCode.GDPlayer2Objects3_1final = []; + +gdjs.GameCode.GDPlayer3Objects3_1final = []; + +gdjs.GameCode.GDPlayer4Objects3_1final = []; + +gdjs.GameCode.forEachCount0_2 = 0; + +gdjs.GameCode.forEachCount0_3 = 0; + +gdjs.GameCode.forEachCount0_5 = 0; + +gdjs.GameCode.forEachCount1_2 = 0; + +gdjs.GameCode.forEachCount1_3 = 0; + +gdjs.GameCode.forEachCount1_5 = 0; + +gdjs.GameCode.forEachCount2_2 = 0; + +gdjs.GameCode.forEachCount2_3 = 0; + +gdjs.GameCode.forEachCount2_5 = 0; + +gdjs.GameCode.forEachCount3_2 = 0; + +gdjs.GameCode.forEachCount3_3 = 0; + +gdjs.GameCode.forEachCount3_5 = 0; + +gdjs.GameCode.forEachIndex2 = 0; + +gdjs.GameCode.forEachIndex3 = 0; + +gdjs.GameCode.forEachIndex4 = 0; + +gdjs.GameCode.forEachIndex5 = 0; + +gdjs.GameCode.forEachObjects2 = []; + +gdjs.GameCode.forEachObjects3 = []; + +gdjs.GameCode.forEachObjects4 = []; + +gdjs.GameCode.forEachObjects5 = []; + +gdjs.GameCode.forEachTemporary3 = null; + +gdjs.GameCode.forEachTemporary4 = null; + +gdjs.GameCode.forEachTotalCount2 = 0; + +gdjs.GameCode.forEachTotalCount3 = 0; + +gdjs.GameCode.forEachTotalCount4 = 0; + +gdjs.GameCode.forEachTotalCount5 = 0; + +gdjs.GameCode.GDPlayer1Objects1= []; +gdjs.GameCode.GDPlayer1Objects2= []; +gdjs.GameCode.GDPlayer1Objects3= []; +gdjs.GameCode.GDPlayer1Objects4= []; +gdjs.GameCode.GDPlayer1Objects5= []; +gdjs.GameCode.GDPlayer1Objects6= []; +gdjs.GameCode.GDBlueBunnyObjects1= []; +gdjs.GameCode.GDBlueBunnyObjects2= []; +gdjs.GameCode.GDBlueBunnyObjects3= []; +gdjs.GameCode.GDBlueBunnyObjects4= []; +gdjs.GameCode.GDBlueBunnyObjects5= []; +gdjs.GameCode.GDBlueBunnyObjects6= []; +gdjs.GameCode.GDPlayer2Objects1= []; +gdjs.GameCode.GDPlayer2Objects2= []; +gdjs.GameCode.GDPlayer2Objects3= []; +gdjs.GameCode.GDPlayer2Objects4= []; +gdjs.GameCode.GDPlayer2Objects5= []; +gdjs.GameCode.GDPlayer2Objects6= []; +gdjs.GameCode.GDPurpleBunnyObjects1= []; +gdjs.GameCode.GDPurpleBunnyObjects2= []; +gdjs.GameCode.GDPurpleBunnyObjects3= []; +gdjs.GameCode.GDPurpleBunnyObjects4= []; +gdjs.GameCode.GDPurpleBunnyObjects5= []; +gdjs.GameCode.GDPurpleBunnyObjects6= []; +gdjs.GameCode.GDPlayer3Objects1= []; +gdjs.GameCode.GDPlayer3Objects2= []; +gdjs.GameCode.GDPlayer3Objects3= []; +gdjs.GameCode.GDPlayer3Objects4= []; +gdjs.GameCode.GDPlayer3Objects5= []; +gdjs.GameCode.GDPlayer3Objects6= []; +gdjs.GameCode.GDOrangeBunnyObjects1= []; +gdjs.GameCode.GDOrangeBunnyObjects2= []; +gdjs.GameCode.GDOrangeBunnyObjects3= []; +gdjs.GameCode.GDOrangeBunnyObjects4= []; +gdjs.GameCode.GDOrangeBunnyObjects5= []; +gdjs.GameCode.GDOrangeBunnyObjects6= []; +gdjs.GameCode.GDPlayer4Objects1= []; +gdjs.GameCode.GDPlayer4Objects2= []; +gdjs.GameCode.GDPlayer4Objects3= []; +gdjs.GameCode.GDPlayer4Objects4= []; +gdjs.GameCode.GDPlayer4Objects5= []; +gdjs.GameCode.GDPlayer4Objects6= []; +gdjs.GameCode.GDPinkBunnyObjects1= []; +gdjs.GameCode.GDPinkBunnyObjects2= []; +gdjs.GameCode.GDPinkBunnyObjects3= []; +gdjs.GameCode.GDPinkBunnyObjects4= []; +gdjs.GameCode.GDPinkBunnyObjects5= []; +gdjs.GameCode.GDPinkBunnyObjects6= []; +gdjs.GameCode.GDBombObjects1= []; +gdjs.GameCode.GDBombObjects2= []; +gdjs.GameCode.GDBombObjects3= []; +gdjs.GameCode.GDBombObjects4= []; +gdjs.GameCode.GDBombObjects5= []; +gdjs.GameCode.GDBombObjects6= []; +gdjs.GameCode.GDBombModelObjects1= []; +gdjs.GameCode.GDBombModelObjects2= []; +gdjs.GameCode.GDBombModelObjects3= []; +gdjs.GameCode.GDBombModelObjects4= []; +gdjs.GameCode.GDBombModelObjects5= []; +gdjs.GameCode.GDBombModelObjects6= []; +gdjs.GameCode.GDExplosionObjects1= []; +gdjs.GameCode.GDExplosionObjects2= []; +gdjs.GameCode.GDExplosionObjects3= []; +gdjs.GameCode.GDExplosionObjects4= []; +gdjs.GameCode.GDExplosionObjects5= []; +gdjs.GameCode.GDExplosionObjects6= []; +gdjs.GameCode.GDBonusObjects1= []; +gdjs.GameCode.GDBonusObjects2= []; +gdjs.GameCode.GDBonusObjects3= []; +gdjs.GameCode.GDBonusObjects4= []; +gdjs.GameCode.GDBonusObjects5= []; +gdjs.GameCode.GDBonusObjects6= []; +gdjs.GameCode.GDScoreTextObjects1= []; +gdjs.GameCode.GDScoreTextObjects2= []; +gdjs.GameCode.GDScoreTextObjects3= []; +gdjs.GameCode.GDScoreTextObjects4= []; +gdjs.GameCode.GDScoreTextObjects5= []; +gdjs.GameCode.GDScoreTextObjects6= []; +gdjs.GameCode.GDScoreIcon1Objects1= []; +gdjs.GameCode.GDScoreIcon1Objects2= []; +gdjs.GameCode.GDScoreIcon1Objects3= []; +gdjs.GameCode.GDScoreIcon1Objects4= []; +gdjs.GameCode.GDScoreIcon1Objects5= []; +gdjs.GameCode.GDScoreIcon1Objects6= []; +gdjs.GameCode.GDScoreIcon2Objects1= []; +gdjs.GameCode.GDScoreIcon2Objects2= []; +gdjs.GameCode.GDScoreIcon2Objects3= []; +gdjs.GameCode.GDScoreIcon2Objects4= []; +gdjs.GameCode.GDScoreIcon2Objects5= []; +gdjs.GameCode.GDScoreIcon2Objects6= []; +gdjs.GameCode.GDScoreIcon3Objects1= []; +gdjs.GameCode.GDScoreIcon3Objects2= []; +gdjs.GameCode.GDScoreIcon3Objects3= []; +gdjs.GameCode.GDScoreIcon3Objects4= []; +gdjs.GameCode.GDScoreIcon3Objects5= []; +gdjs.GameCode.GDScoreIcon3Objects6= []; +gdjs.GameCode.GDScoreIcon4Objects1= []; +gdjs.GameCode.GDScoreIcon4Objects2= []; +gdjs.GameCode.GDScoreIcon4Objects3= []; +gdjs.GameCode.GDScoreIcon4Objects4= []; +gdjs.GameCode.GDScoreIcon4Objects5= []; +gdjs.GameCode.GDScoreIcon4Objects6= []; +gdjs.GameCode.GDRockObjects1= []; +gdjs.GameCode.GDRockObjects2= []; +gdjs.GameCode.GDRockObjects3= []; +gdjs.GameCode.GDRockObjects4= []; +gdjs.GameCode.GDRockObjects5= []; +gdjs.GameCode.GDRockObjects6= []; +gdjs.GameCode.GDCrateObjects1= []; +gdjs.GameCode.GDCrateObjects2= []; +gdjs.GameCode.GDCrateObjects3= []; +gdjs.GameCode.GDCrateObjects4= []; +gdjs.GameCode.GDCrateObjects5= []; +gdjs.GameCode.GDCrateObjects6= []; +gdjs.GameCode.GDBlockRoundedLongObjects1= []; +gdjs.GameCode.GDBlockRoundedLongObjects2= []; +gdjs.GameCode.GDBlockRoundedLongObjects3= []; +gdjs.GameCode.GDBlockRoundedLongObjects4= []; +gdjs.GameCode.GDBlockRoundedLongObjects5= []; +gdjs.GameCode.GDBlockRoundedLongObjects6= []; +gdjs.GameCode.GDExplosionParticleEmitterObjects1= []; +gdjs.GameCode.GDExplosionParticleEmitterObjects2= []; +gdjs.GameCode.GDExplosionParticleEmitterObjects3= []; +gdjs.GameCode.GDExplosionParticleEmitterObjects4= []; +gdjs.GameCode.GDExplosionParticleEmitterObjects5= []; +gdjs.GameCode.GDExplosionParticleEmitterObjects6= []; +gdjs.GameCode.GDUpgradeParticleEmitterObjects1= []; +gdjs.GameCode.GDUpgradeParticleEmitterObjects2= []; +gdjs.GameCode.GDUpgradeParticleEmitterObjects3= []; +gdjs.GameCode.GDUpgradeParticleEmitterObjects4= []; +gdjs.GameCode.GDUpgradeParticleEmitterObjects5= []; +gdjs.GameCode.GDUpgradeParticleEmitterObjects6= []; +gdjs.GameCode.GDSoilObjects1= []; +gdjs.GameCode.GDSoilObjects2= []; +gdjs.GameCode.GDSoilObjects3= []; +gdjs.GameCode.GDSoilObjects4= []; +gdjs.GameCode.GDSoilObjects5= []; +gdjs.GameCode.GDSoilObjects6= []; +gdjs.GameCode.GDSoilBorderObjects1= []; +gdjs.GameCode.GDSoilBorderObjects2= []; +gdjs.GameCode.GDSoilBorderObjects3= []; +gdjs.GameCode.GDSoilBorderObjects4= []; +gdjs.GameCode.GDSoilBorderObjects5= []; +gdjs.GameCode.GDSoilBorderObjects6= []; +gdjs.GameCode.GDSoilCornerObjects1= []; +gdjs.GameCode.GDSoilCornerObjects2= []; +gdjs.GameCode.GDSoilCornerObjects3= []; +gdjs.GameCode.GDSoilCornerObjects4= []; +gdjs.GameCode.GDSoilCornerObjects5= []; +gdjs.GameCode.GDSoilCornerObjects6= []; +gdjs.GameCode.GDNew3DBoxObjects1= []; +gdjs.GameCode.GDNew3DBoxObjects2= []; +gdjs.GameCode.GDNew3DBoxObjects3= []; +gdjs.GameCode.GDNew3DBoxObjects4= []; +gdjs.GameCode.GDNew3DBoxObjects5= []; +gdjs.GameCode.GDNew3DBoxObjects6= []; + + +gdjs.GameCode.mapOfGDgdjs_9546GameCode_9546GDSoilObjects3Objects = Hashtable.newFrom({"Soil": gdjs.GameCode.GDSoilObjects3}); +gdjs.GameCode.eventsList0 = function(runtimeScene) { + +};gdjs.GameCode.eventsList1 = function(runtimeScene) { + +};gdjs.GameCode.eventsList2 = function(runtimeScene) { + +{ + + +let isConditionTrue_0 = false; +{ +{gdjs.evtTools.runtimeScene.createObjectsFromExternalLayout(runtimeScene, runtimeScene.getGame().getVariables().getFromIndex(2).getAsString(), 0, 0, 0); +}{gdjs.evtTools.runtimeScene.createObjectsFromExternalLayout(runtimeScene, "SoilBorders", 0, 0, 0); +}} + +} + + +{ + +gdjs.copyArray(runtimeScene.getObjects("Rock"), gdjs.GameCode.GDRockObjects2); + +for (gdjs.GameCode.forEachIndex3 = 0;gdjs.GameCode.forEachIndex3 < gdjs.GameCode.GDRockObjects2.length;++gdjs.GameCode.forEachIndex3) { +gdjs.GameCode.GDSoilObjects3.length = 0; + +gdjs.GameCode.GDRockObjects3.length = 0; + + +gdjs.GameCode.forEachTemporary3 = gdjs.GameCode.GDRockObjects2[gdjs.GameCode.forEachIndex3]; +gdjs.GameCode.GDRockObjects3.push(gdjs.GameCode.forEachTemporary3); +let isConditionTrue_0 = false; +if (true) { +{gdjs.evtTools.object.createObjectOnScene((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : runtimeScene), gdjs.GameCode.mapOfGDgdjs_9546GameCode_9546GDSoilObjects3Objects, 0, 0, ""); +}{for(var i = 0, len = gdjs.GameCode.GDSoilObjects3.length ;i < len;++i) { + gdjs.GameCode.GDSoilObjects3[i].setCenterPositionInScene((( gdjs.GameCode.GDRockObjects3.length === 0 ) ? 0 :gdjs.GameCode.GDRockObjects3[0].getCenterXInScene()),(( gdjs.GameCode.GDRockObjects3.length === 0 ) ? 0 :gdjs.GameCode.GDRockObjects3[0].getCenterYInScene())); +} +}{for(var i = 0, len = gdjs.GameCode.GDSoilObjects3.length ;i < len;++i) { + gdjs.GameCode.GDSoilObjects3[i].setAngle(90 * gdjs.random(3)); +} +}{for(var i = 0, len = gdjs.GameCode.GDSoilObjects3.length ;i < len;++i) { + gdjs.GameCode.GDSoilObjects3[i].setAngle(gdjs.GameCode.GDSoilObjects3[i].getAngle() + (gdjs.randomFloatInRange(-(15), 15))); +} +}{for(var i = 0, len = gdjs.GameCode.GDSoilObjects3.length ;i < len;++i) { + gdjs.GameCode.GDSoilObjects3[i].getBehavior("Object3D").setZ(gdjs.GameCode.GDSoilObjects3[i].getBehavior("Object3D").getZ() + (-(10))); +} +}} +} + +} + + +{ + + + +} + + +{ + +gdjs.copyArray(runtimeScene.getObjects("Player1"), gdjs.GameCode.GDPlayer1Objects2); +gdjs.copyArray(runtimeScene.getObjects("Player2"), gdjs.GameCode.GDPlayer2Objects2); +gdjs.copyArray(runtimeScene.getObjects("Player3"), gdjs.GameCode.GDPlayer3Objects2); +gdjs.copyArray(runtimeScene.getObjects("Player4"), gdjs.GameCode.GDPlayer4Objects2); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.GameCode.GDPlayer1Objects2.length;i runtimeScene.getGame().getVariables().getFromIndex(1).getAsNumber() ) { + isConditionTrue_0 = true; + gdjs.GameCode.GDPlayer1Objects2[k] = gdjs.GameCode.GDPlayer1Objects2[i]; + ++k; + } +} +gdjs.GameCode.GDPlayer1Objects2.length = k; +for (var i = 0, k = 0, l = gdjs.GameCode.GDPlayer2Objects2.length;i runtimeScene.getGame().getVariables().getFromIndex(1).getAsNumber() ) { + isConditionTrue_0 = true; + gdjs.GameCode.GDPlayer2Objects2[k] = gdjs.GameCode.GDPlayer2Objects2[i]; + ++k; + } +} +gdjs.GameCode.GDPlayer2Objects2.length = k; +for (var i = 0, k = 0, l = gdjs.GameCode.GDPlayer3Objects2.length;i runtimeScene.getGame().getVariables().getFromIndex(1).getAsNumber() ) { + isConditionTrue_0 = true; + gdjs.GameCode.GDPlayer3Objects2[k] = gdjs.GameCode.GDPlayer3Objects2[i]; + ++k; + } +} +gdjs.GameCode.GDPlayer3Objects2.length = k; +for (var i = 0, k = 0, l = gdjs.GameCode.GDPlayer4Objects2.length;i runtimeScene.getGame().getVariables().getFromIndex(1).getAsNumber() ) { + isConditionTrue_0 = true; + gdjs.GameCode.GDPlayer4Objects2[k] = gdjs.GameCode.GDPlayer4Objects2[i]; + ++k; + } +} +gdjs.GameCode.GDPlayer4Objects2.length = k; +if (isConditionTrue_0) { +/* Reuse gdjs.GameCode.GDPlayer1Objects2 */ +/* Reuse gdjs.GameCode.GDPlayer2Objects2 */ +/* Reuse gdjs.GameCode.GDPlayer3Objects2 */ +/* Reuse gdjs.GameCode.GDPlayer4Objects2 */ +{for(var i = 0, len = gdjs.GameCode.GDPlayer1Objects2.length ;i < len;++i) { + gdjs.GameCode.GDPlayer1Objects2[i].deleteFromScene(runtimeScene); +} +for(var i = 0, len = gdjs.GameCode.GDPlayer2Objects2.length ;i < len;++i) { + gdjs.GameCode.GDPlayer2Objects2[i].deleteFromScene(runtimeScene); +} +for(var i = 0, len = gdjs.GameCode.GDPlayer3Objects2.length ;i < len;++i) { + gdjs.GameCode.GDPlayer3Objects2[i].deleteFromScene(runtimeScene); +} +for(var i = 0, len = gdjs.GameCode.GDPlayer4Objects2.length ;i < len;++i) { + gdjs.GameCode.GDPlayer4Objects2[i].deleteFromScene(runtimeScene); +} +}} + +} + + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(runtimeScene.getObjects("Player1"), gdjs.GameCode.GDPlayer1Objects2); +gdjs.copyArray(runtimeScene.getObjects("Player2"), gdjs.GameCode.GDPlayer2Objects2); +gdjs.copyArray(runtimeScene.getObjects("Player3"), gdjs.GameCode.GDPlayer3Objects2); +gdjs.copyArray(runtimeScene.getObjects("Player4"), gdjs.GameCode.GDPlayer4Objects2); +{for(var i = 0, len = gdjs.GameCode.GDPlayer1Objects2.length ;i < len;++i) { + gdjs.GameCode.GDPlayer1Objects2[i].getBehavior("PlayerBehavior").SetInitialBombCapacity(runtimeScene.getGame().getVariables().getFromIndex(3).getAsNumber(), (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +for(var i = 0, len = gdjs.GameCode.GDPlayer2Objects2.length ;i < len;++i) { + gdjs.GameCode.GDPlayer2Objects2[i].getBehavior("PlayerBehavior").SetInitialBombCapacity(runtimeScene.getGame().getVariables().getFromIndex(3).getAsNumber(), (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +for(var i = 0, len = gdjs.GameCode.GDPlayer3Objects2.length ;i < len;++i) { + gdjs.GameCode.GDPlayer3Objects2[i].getBehavior("PlayerBehavior").SetInitialBombCapacity(runtimeScene.getGame().getVariables().getFromIndex(3).getAsNumber(), (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +for(var i = 0, len = gdjs.GameCode.GDPlayer4Objects2.length ;i < len;++i) { + gdjs.GameCode.GDPlayer4Objects2[i].getBehavior("PlayerBehavior").SetInitialBombCapacity(runtimeScene.getGame().getVariables().getFromIndex(3).getAsNumber(), (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}{for(var i = 0, len = gdjs.GameCode.GDPlayer1Objects2.length ;i < len;++i) { + gdjs.GameCode.GDPlayer1Objects2[i].getBehavior("PlayerBehavior").SetInitialBombRange(runtimeScene.getGame().getVariables().getFromIndex(4).getAsNumber(), (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +for(var i = 0, len = gdjs.GameCode.GDPlayer2Objects2.length ;i < len;++i) { + gdjs.GameCode.GDPlayer2Objects2[i].getBehavior("PlayerBehavior").SetInitialBombRange(runtimeScene.getGame().getVariables().getFromIndex(4).getAsNumber(), (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +for(var i = 0, len = gdjs.GameCode.GDPlayer3Objects2.length ;i < len;++i) { + gdjs.GameCode.GDPlayer3Objects2[i].getBehavior("PlayerBehavior").SetInitialBombRange(runtimeScene.getGame().getVariables().getFromIndex(4).getAsNumber(), (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +for(var i = 0, len = gdjs.GameCode.GDPlayer4Objects2.length ;i < len;++i) { + gdjs.GameCode.GDPlayer4Objects2[i].getBehavior("PlayerBehavior").SetInitialBombRange(runtimeScene.getGame().getVariables().getFromIndex(4).getAsNumber(), (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +{ + +gdjs.copyArray(runtimeScene.getObjects("ScoreIcon1"), gdjs.GameCode.GDScoreIcon1Objects2); +gdjs.copyArray(runtimeScene.getObjects("ScoreIcon2"), gdjs.GameCode.GDScoreIcon2Objects2); +gdjs.copyArray(runtimeScene.getObjects("ScoreIcon3"), gdjs.GameCode.GDScoreIcon3Objects2); +gdjs.copyArray(runtimeScene.getObjects("ScoreIcon4"), gdjs.GameCode.GDScoreIcon4Objects2); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.GameCode.GDScoreIcon1Objects2.length;i runtimeScene.getGame().getVariables().getFromIndex(1).getAsNumber() ) { + isConditionTrue_0 = true; + gdjs.GameCode.GDScoreIcon1Objects2[k] = gdjs.GameCode.GDScoreIcon1Objects2[i]; + ++k; + } +} +gdjs.GameCode.GDScoreIcon1Objects2.length = k; +for (var i = 0, k = 0, l = gdjs.GameCode.GDScoreIcon2Objects2.length;i runtimeScene.getGame().getVariables().getFromIndex(1).getAsNumber() ) { + isConditionTrue_0 = true; + gdjs.GameCode.GDScoreIcon2Objects2[k] = gdjs.GameCode.GDScoreIcon2Objects2[i]; + ++k; + } +} +gdjs.GameCode.GDScoreIcon2Objects2.length = k; +for (var i = 0, k = 0, l = gdjs.GameCode.GDScoreIcon3Objects2.length;i runtimeScene.getGame().getVariables().getFromIndex(1).getAsNumber() ) { + isConditionTrue_0 = true; + gdjs.GameCode.GDScoreIcon3Objects2[k] = gdjs.GameCode.GDScoreIcon3Objects2[i]; + ++k; + } +} +gdjs.GameCode.GDScoreIcon3Objects2.length = k; +for (var i = 0, k = 0, l = gdjs.GameCode.GDScoreIcon4Objects2.length;i runtimeScene.getGame().getVariables().getFromIndex(1).getAsNumber() ) { + isConditionTrue_0 = true; + gdjs.GameCode.GDScoreIcon4Objects2[k] = gdjs.GameCode.GDScoreIcon4Objects2[i]; + ++k; + } +} +gdjs.GameCode.GDScoreIcon4Objects2.length = k; +if (isConditionTrue_0) { +/* Reuse gdjs.GameCode.GDScoreIcon1Objects2 */ +/* Reuse gdjs.GameCode.GDScoreIcon2Objects2 */ +/* Reuse gdjs.GameCode.GDScoreIcon3Objects2 */ +/* Reuse gdjs.GameCode.GDScoreIcon4Objects2 */ +{for(var i = 0, len = gdjs.GameCode.GDScoreIcon1Objects2.length ;i < len;++i) { + gdjs.GameCode.GDScoreIcon1Objects2[i].deleteFromScene(runtimeScene); +} +for(var i = 0, len = gdjs.GameCode.GDScoreIcon2Objects2.length ;i < len;++i) { + gdjs.GameCode.GDScoreIcon2Objects2[i].deleteFromScene(runtimeScene); +} +for(var i = 0, len = gdjs.GameCode.GDScoreIcon3Objects2.length ;i < len;++i) { + gdjs.GameCode.GDScoreIcon3Objects2[i].deleteFromScene(runtimeScene); +} +for(var i = 0, len = gdjs.GameCode.GDScoreIcon4Objects2.length ;i < len;++i) { + gdjs.GameCode.GDScoreIcon4Objects2[i].deleteFromScene(runtimeScene); +} +}} + +} + + +{ + +gdjs.copyArray(runtimeScene.getObjects("ScoreText"), gdjs.GameCode.GDScoreTextObjects2); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.GameCode.GDScoreTextObjects2.length;i runtimeScene.getGame().getVariables().getFromIndex(1).getAsNumber() ) { + isConditionTrue_0 = true; + gdjs.GameCode.GDScoreTextObjects2[k] = gdjs.GameCode.GDScoreTextObjects2[i]; + ++k; + } +} +gdjs.GameCode.GDScoreTextObjects2.length = k; +if (isConditionTrue_0) { +/* Reuse gdjs.GameCode.GDScoreTextObjects2 */ +{for(var i = 0, len = gdjs.GameCode.GDScoreTextObjects2.length ;i < len;++i) { + gdjs.GameCode.GDScoreTextObjects2[i].deleteFromScene(runtimeScene); +} +}} + +} + + +{ + + + +} + + +{ + + + +} + + +{ + +gdjs.copyArray(runtimeScene.getObjects("Player1"), gdjs.GameCode.GDPlayer1Objects1); +gdjs.copyArray(runtimeScene.getObjects("Player2"), gdjs.GameCode.GDPlayer2Objects1); +gdjs.copyArray(runtimeScene.getObjects("Player3"), gdjs.GameCode.GDPlayer3Objects1); +gdjs.copyArray(runtimeScene.getObjects("Player4"), gdjs.GameCode.GDPlayer4Objects1); + +gdjs.GameCode.forEachTotalCount2 = 0; +gdjs.GameCode.forEachObjects2.length = 0; +gdjs.GameCode.forEachCount0_2 = gdjs.GameCode.GDPlayer1Objects1.length; +gdjs.GameCode.forEachTotalCount2 += gdjs.GameCode.forEachCount0_2; +gdjs.GameCode.forEachObjects2.push.apply(gdjs.GameCode.forEachObjects2,gdjs.GameCode.GDPlayer1Objects1); +gdjs.GameCode.forEachCount1_2 = gdjs.GameCode.GDPlayer2Objects1.length; +gdjs.GameCode.forEachTotalCount2 += gdjs.GameCode.forEachCount1_2; +gdjs.GameCode.forEachObjects2.push.apply(gdjs.GameCode.forEachObjects2,gdjs.GameCode.GDPlayer2Objects1); +gdjs.GameCode.forEachCount2_2 = gdjs.GameCode.GDPlayer3Objects1.length; +gdjs.GameCode.forEachTotalCount2 += gdjs.GameCode.forEachCount2_2; +gdjs.GameCode.forEachObjects2.push.apply(gdjs.GameCode.forEachObjects2,gdjs.GameCode.GDPlayer3Objects1); +gdjs.GameCode.forEachCount3_2 = gdjs.GameCode.GDPlayer4Objects1.length; +gdjs.GameCode.forEachTotalCount2 += gdjs.GameCode.forEachCount3_2; +gdjs.GameCode.forEachObjects2.push.apply(gdjs.GameCode.forEachObjects2,gdjs.GameCode.GDPlayer4Objects1); +for (gdjs.GameCode.forEachIndex2 = 0;gdjs.GameCode.forEachIndex2 < gdjs.GameCode.forEachTotalCount2;++gdjs.GameCode.forEachIndex2) { +gdjs.copyArray(runtimeScene.getObjects("ScoreText"), gdjs.GameCode.GDScoreTextObjects2); +gdjs.GameCode.GDPlayer1Objects2.length = 0; + +gdjs.GameCode.GDPlayer2Objects2.length = 0; + +gdjs.GameCode.GDPlayer3Objects2.length = 0; + +gdjs.GameCode.GDPlayer4Objects2.length = 0; + + +if (gdjs.GameCode.forEachIndex2 < gdjs.GameCode.forEachCount0_2) { + gdjs.GameCode.GDPlayer1Objects2.push(gdjs.GameCode.forEachObjects2[gdjs.GameCode.forEachIndex2]); +} +else if (gdjs.GameCode.forEachIndex2 < gdjs.GameCode.forEachCount0_2+gdjs.GameCode.forEachCount1_2) { + gdjs.GameCode.GDPlayer2Objects2.push(gdjs.GameCode.forEachObjects2[gdjs.GameCode.forEachIndex2]); +} +else if (gdjs.GameCode.forEachIndex2 < gdjs.GameCode.forEachCount0_2+gdjs.GameCode.forEachCount1_2+gdjs.GameCode.forEachCount2_2) { + gdjs.GameCode.GDPlayer3Objects2.push(gdjs.GameCode.forEachObjects2[gdjs.GameCode.forEachIndex2]); +} +else if (gdjs.GameCode.forEachIndex2 < gdjs.GameCode.forEachCount0_2+gdjs.GameCode.forEachCount1_2+gdjs.GameCode.forEachCount2_2+gdjs.GameCode.forEachCount3_2) { + gdjs.GameCode.GDPlayer4Objects2.push(gdjs.GameCode.forEachObjects2[gdjs.GameCode.forEachIndex2]); +} +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.GameCode.GDScoreTextObjects2.length;i (gdjs.GameCode.asyncCallback17740044(runtimeScene, asyncObjectsList))); +} +} + +} + + +};gdjs.GameCode.eventsList14 = function(runtimeScene) { + +{ + + + +} + + +{ + +gdjs.copyArray(gdjs.GameCode.GDBombObjects1, gdjs.GameCode.GDBombObjects2); + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.object.pickAllObjects((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : runtimeScene), gdjs.GameCode.mapOfGDgdjs_9546GameCode_9546GDBombObjects2Objects); +if (isConditionTrue_0) { +gdjs.copyArray(gdjs.GameCode.GDBlockRoundedLongObjects1, gdjs.GameCode.GDBlockRoundedLongObjects2); + +/* Reuse gdjs.GameCode.GDBombObjects2 */ +gdjs.copyArray(gdjs.GameCode.GDCrateObjects1, gdjs.GameCode.GDCrateObjects2); + +gdjs.copyArray(gdjs.GameCode.GDExplosionObjects1, gdjs.GameCode.GDExplosionObjects2); + +gdjs.copyArray(gdjs.GameCode.GDExplosionParticleEmitterObjects1, gdjs.GameCode.GDExplosionParticleEmitterObjects2); + +gdjs.copyArray(gdjs.GameCode.GDRockObjects1, gdjs.GameCode.GDRockObjects2); + +{gdjs.evtsExt__Bomb__ExplodeByChainReaction.func(runtimeScene, gdjs.GameCode.mapOfGDgdjs_9546GameCode_9546GDBombObjects2Objects, "BombBehavior", gdjs.GameCode.mapOfGDgdjs_9546GameCode_9546GDExplosionObjects2Objects, "ExplosionBehavior", gdjs.GameCode.mapOfGDgdjs_9546GameCode_9546GDCrateObjects2ObjectsGDgdjs_9546GameCode_9546GDRockObjects2ObjectsGDgdjs_9546GameCode_9546GDBlockRoundedLongObjects2Objects, gdjs.GameCode.mapOfGDgdjs_9546GameCode_9546GDExplosionParticleEmitterObjects2Objects, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +}} + +} + + +{ + +/* Reuse gdjs.GameCode.GDCrateObjects1 */ +/* Reuse gdjs.GameCode.GDExplosionObjects1 */ + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.object.pickAllObjects((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : runtimeScene), gdjs.GameCode.mapOfGDgdjs_9546GameCode_9546GDExplosionObjects1Objects); +if (isConditionTrue_0) { +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.object.hitBoxesCollisionTest(gdjs.GameCode.mapOfGDgdjs_9546GameCode_9546GDExplosionObjects1Objects, gdjs.GameCode.mapOfGDgdjs_9546GameCode_9546GDCrateObjects1Objects, false, runtimeScene, false); +} +if (isConditionTrue_0) { + +{ //Subevents +gdjs.GameCode.eventsList13(runtimeScene);} //End of subevents +} + +} + + +};gdjs.GameCode.eventsList15 = function(runtimeScene) { + +{ + + + +} + + +{ + +gdjs.copyArray(runtimeScene.getObjects("Bomb"), gdjs.GameCode.GDBombObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.GameCode.GDBombObjects1.length;i0?1:-1},n.cbrt=function(t){return Math.pow(t,1/3)},n.nthroot=function(t,e){return Math.pow(t,1/e)},n.mod=function(t,e){return t-e*Math.floor(t/e)},n.angleDifference=function(t,e){return o.evtTools.common.mod(o.evtTools.common.mod(t-e,360)+180,360)-180},n.angleBetweenPositions=function(t,e,r,i){return Math.atan2(i-e,r-t)*180/Math.PI},n.distanceBetweenPositions=function(t,e,r,i){return Math.sqrt((t-r)*(t-r)+(e-i)*(e-i))},n.lerp=function(t,e,r){return t+(e-t)*r},n.exponentialInterpolation=(t,e,r)=>{if(r===0)return t;if(r===1)return e;if(t<=0||e<=0)return 0;const i=Math.log(t),l=Math.log(e);return Math.exp(i+(l-i)*r)},n.trunc=function(t){return t|0},n.getXFromAngleAndDistance=function(t,e){return e*Math.cos(o.toRad(t))},n.getYFromAngleAndDistance=function(t,e){return e*Math.sin(o.toRad(t))},n.roundTo=function(t,e){return!e||!Number.isInteger(e)?Math.round(t):Math.round(t*Math.pow(10,e))/Math.pow(10,e)},n.floorTo=function(t,e){return!e||!Number.isInteger(e)?Math.floor(t):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)},n.ceilTo=function(t,e){return!e||!Number.isInteger(e)?Math.ceil(t):Math.ceil(t*Math.pow(10,e))/Math.pow(10,e)},n.pi=function(){return Math.PI},n.lerpAngle=function(t,e,r){return t+o.evtTools.common.angleDifference(e,t)*r},n.resolveAsyncEventsFunction=t=>{!!t&&!!t.task&&!!t.task.resolve&&t.task.resolve()};const c=()=>{if(typeof cc!="undefined"&&cc.sys)return cc.sys.isMobile;if(typeof Cocoon!="undefined"&&Cocoon.App)return!0;if(typeof window!="undefined"&&window.cordova)return!0;if(typeof window!="undefined"){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))||/iPad|iPhone|iPod/.test(navigator.platform))return!0;if(/MacIntel/.test(navigator.platform))return!!navigator.maxTouchPoints&&navigator.maxTouchPoints>2}return!1};let a=null;n.isMobile=()=>a!==null?a:a=c()})(p=u.common||(u.common={}))})(s=o.evtTools||(o.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=commontools.js.map diff --git a/events-tools/inputtools.js b/events-tools/inputtools.js new file mode 100644 index 0000000000000000000000000000000000000000..46a371c3c746f299ca118b4bdbcab64398f161c3 --- /dev/null +++ b/events-tools/inputtools.js @@ -0,0 +1,2 @@ +var gdjs;(function(o){let i;(function(c){let d;(function(n){n.lastTouchId=0,n.lastEndedTouchId=0,n.keysNameToCode={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,Num0:48,Num1:49,Num2:50,Num3:51,Num4:52,Num5:53,Num6:54,Num7:55,Num8:56,Num9:57,Numpad0:96,Numpad1:97,Numpad2:98,Numpad3:99,Numpad4:100,Numpad5:101,Numpad6:102,Numpad7:103,Numpad8:104,Numpad9:105,LShift:1016,RShift:2016,LControl:1017,RControl:2017,LAlt:1018,RAlt:2018,LSystem:1091,RSystem:2091,SemiColon:186,Comma:188,Period:190,Quote:222,Slash:191,BackSlash:220,Equal:187,Dash:189,Menu:93,LBracket:219,RBracket:221,Tilde:192,Space:32,Back:8,Tab:9,Delete:46,Insert:45,Escape:27,PageUp:33,PageDown:34,End:35,Home:36,Return:13,NumpadPageUp:3033,NumpadPageDown:3034,NumpadEnd:3035,NumpadHome:3036,NumpadReturn:3013,Add:107,Subtract:109,Multiply:106,Divide:111,NumpadAdd:3107,NumpadSubtract:3109,NumpadMultiply:3106,NumpadDivide:3111,Left:37,Up:38,Right:39,Down:40,NumpadLeft:3037,NumpadUp:3038,NumpadRight:3039,NumpadDown:3040,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,Pause:19};const u={};for(const e in n.keysNameToCode)n.keysNameToCode.hasOwnProperty(e)&&(u[n.keysNameToCode[e]]=e);n.mouseButtonsNameToCode={Left:o.InputManager.MOUSE_LEFT_BUTTON,Right:o.InputManager.MOUSE_RIGHT_BUTTON,Middle:o.InputManager.MOUSE_MIDDLE_BUTTON,Back:o.InputManager.MOUSE_BACK_BUTTON,Forward:o.InputManager.MOUSE_FORWARD_BUTTON},n.isKeyPressed=function(e,t){return o.evtTools.input.keysNameToCode.hasOwnProperty(t)?e.getGame().getInputManager().isKeyPressed(o.evtTools.input.keysNameToCode[t]):!1},n.wasKeyReleased=function(e,t){return o.evtTools.input.keysNameToCode.hasOwnProperty(t)?e.getGame().getInputManager().wasKeyReleased(o.evtTools.input.keysNameToCode[t]):!1},n.lastPressedKey=function(e){const t=e.getGame().getInputManager().getLastPressedKey();return u.hasOwnProperty(t)?u[t]:""},n.anyKeyPressed=function(e){return e.getGame().getInputManager().anyKeyPressed()},n.anyKeyReleased=function(e){return e.getGame().getInputManager().anyKeyReleased()},n.isMouseButtonPressed=function(e,t){return o.evtTools.input.mouseButtonsNameToCode.hasOwnProperty(t)?e.getGame().getInputManager().isMouseButtonPressed(o.evtTools.input.mouseButtonsNameToCode[t]):!1},n.isMouseButtonReleased=function(e,t){return o.evtTools.input.mouseButtonsNameToCode.hasOwnProperty(t)?e.getGame().getInputManager().isMouseButtonReleased(o.evtTools.input.mouseButtonsNameToCode[t]):!1},n.hideCursor=function(e){e.getScene().getRenderer().hideCursor()},n.showCursor=function(e){e.getScene().getRenderer().showCursor()},n.getMouseWheelDelta=function(e){return e.getGame().getInputManager().getMouseWheelDelta()},n.isScrollingUp=function(e){return e.getGame().getInputManager().isScrollingUp()},n.isScrollingDown=function(e){return e.getGame().getInputManager().isScrollingDown()},n.getMouseX=function(e,t,r){return n.getCursorX(e,t,r)},n.getMouseY=function(e,t,r){return n.getCursorY(e,t,r)},n.getCursorX=function(e,t,r){const a=o.staticArray(o.evtTools.input.getCursorX);return e.getLayer(t).convertCoords(e.getGame().getInputManager().getCursorX(),e.getGame().getInputManager().getCursorY(),0,a)[0]},n.getCursorY=function(e,t,r){const a=o.staticArray(o.evtTools.input.getCursorY);return e.getLayer(t).convertCoords(e.getGame().getInputManager().getCursorX(),e.getGame().getInputManager().getCursorY(),0,a)[1]},n.getMouseOnlyCursorX=function(e,t,r){const a=o.staticArray(o.evtTools.input.getMouseOnlyCursorX);return e.getLayer(t).convertCoords(e.getGame().getInputManager().getMouseX(),e.getGame().getInputManager().getMouseY(),0,a)[0]},n.getMouseOnlyCursorY=function(e,t,r){const a=o.staticArray(o.evtTools.input.getMouseOnlyCursorY);return e.getLayer(t).convertCoords(e.getGame().getInputManager().getMouseX(),e.getGame().getInputManager().getMouseY(),0,a)[1]},n.isMouseInsideCanvas=function(e){return e.getGame().getInputManager().isMouseInsideCanvas()};const I=function(e,t){return e.cursorOnObject(t)};n.cursorOnObject=function(e,t,r,a){return o.evtTools.object.pickObjectsIf(I,e,a,t)},n.getTouchX=function(e,t,r,a){const g=o.staticArray(o.evtTools.input.getTouchX);return e.getLayer(r).convertCoords(e.getGame().getInputManager().getTouchX(t),e.getGame().getInputManager().getTouchY(t),0,g)[0]},n.getTouchY=(e,t,r,a)=>{const g=o.staticArray(o.evtTools.input.getTouchY);return e.getLayer(r).convertCoords(e.getGame().getInputManager().getTouchX(t),e.getGame().getInputManager().getTouchY(t),0,g)[1]},n.hasAnyTouchStarted=e=>{const t=e.getGame().getInputManager().getStartedTouchIdentifiers();return t.length>1||t.length>0&&t[0]!==o.InputManager.MOUSE_TOUCH_ID},n.getStartedTouchCount=e=>{const t=e.getGame().getInputManager().getStartedTouchIdentifiers();return t.length+(t.includes(o.InputManager.MOUSE_TOUCH_ID)?-1:0)},n.getStartedTouchIdentifier=(e,t)=>{const r=e.getGame().getInputManager().getStartedTouchIdentifiers(),a=r.indexOf(o.InputManager.MOUSE_TOUCH_ID);return a<0?r[t]:r[te.getGame().getInputManager().getStartedTouchIdentifiers().length>0,n.getStartedTouchOrMouseCount=e=>e.getGame().getInputManager().getStartedTouchIdentifiers().length,n.getStartedTouchOrMouseIdentifier=(e,t)=>e.getGame().getInputManager().getStartedTouchIdentifiers()[t]||0,n.hasTouchEnded=(e,t)=>e.getGame().getInputManager().hasTouchEnded(t),n.getLastTouchId=function(){return o.evtTools.input.lastTouchId||0},n.getLastEndedTouchId=function(){return o.evtTools.input.lastEndedTouchId||0},n.popStartedTouch=function(e){const t=e.getGame().getInputManager().popStartedTouch();return t!==void 0?(o.evtTools.input.lastTouchId=t,!0):!1},n.popEndedTouch=function(e){const t=e.getGame().getInputManager().popEndedTouch();return t!==void 0?(o.evtTools.input.lastEndedTouchId=t,!0):!1},n.touchSimulateMouse=function(e,t){e.getGame().getInputManager().touchSimulateMouse(t)}})(d=c.input||(c.input={}))})(i=o.evtTools||(o.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=inputtools.js.map diff --git a/events-tools/networktools.js b/events-tools/networktools.js new file mode 100644 index 0000000000000000000000000000000000000000..73d071b90d7f890809a73fac7bc2ba7285ff164e --- /dev/null +++ b/events-tools/networktools.js @@ -0,0 +1,2 @@ +var gdjs;(function(u){let p;(function(g){let d;(function(r){r.sendAsyncRequest=function(n,s,i,o,c,a){const e=t=>{t instanceof ProgressEvent&&t.currentTarget&&t.currentTarget instanceof XMLHttpRequest&&t.currentTarget.status===0?a.setString("REQUEST_NOT_SENT"):a.setString(""+t)};try{const t=new XMLHttpRequest;t.onerror=e,t.ontimeout=e,t.onabort=e,t.onreadystatechange=()=>{t.readyState===4&&(t.status>=400&&e(""+t.status),c.setString(t.responseText))},t.open(i,n),t.setRequestHeader("Content-Type",o===""?"application/x-www-form-urlencoded":o),t.send(s)}catch(t){e(t)}},r.sendAwaitableAsyncRequest=(n,s,i,o,c,a)=>new u.PromiseTask(fetch(n,{body:i!=="GET"?s:void 0,method:i,headers:{"Content-Type":o||"application/x-www-form-urlencoded"}}).then(async e=>{const t=await e.text();e.status>=400&&a.setString(""+e.status),c.setString(t)},e=>{a.setString(""+e)})),r.sendDeprecatedSynchronousRequest=function(n,s,i,o,c,a){try{let e;if(typeof XMLHttpRequest!="undefined")e=new XMLHttpRequest;else{const t=["MSXML2.XmlHttp.5.0","MSXML2.XmlHttp.4.0","MSXML2.XmlHttp.3.0","MSXML2.XmlHttp.2.0","Microsoft.XmlHttp"];for(let l=0,b=t.length;l=s&&(n=s-1);let i=0,f=null;for(let r in t.items)if(t.items.hasOwnProperty(r)){let u=t.items[r];if(n-i=j&&(j=p.farSqDist,a=k,c=p.farX,l=p.farY))}}return a?(o.evtTools.object.pickOnly(e,a),f.setNumber(c),r.setNumber(l),!0):!1},g.doCreateObjectOnScene=function(e,t,s,n,i,f){const r=e.createObject(t),u=e.getLayer(f);return r!==null&&(r.setPosition(n,i),r.setLayer(f),r.setZOrder(u.getDefaultZOrder()),s.containsKey(t)&&s.get(t).push(r)),r},g.createObjectOnScene=function(e,t,s,n,i){return o.evtTools.object.doCreateObjectOnScene(e,t.firstKey(),t,s,n,i)},g.createObjectFromGroupOnScene=function(e,t,s,n,i,f){o.evtTools.object.doCreateObjectOnScene(e,s,t,n,i,f)},g.getPickedInstancesCount=e=>{let t=0;const s=o.staticArray(o.evtTools.object.getPickedInstancesCount);e.values(s);for(let n=0,i=s.length;n{let s=0;const n=o.staticArray(o.evtTools.object.getSceneInstancesCount);t.keys(n);const i=new Set(n);for(const f of i)s+=e.getInstancesCountOnScene(f);return s},g.pickedObjectsCount=g.getPickedInstancesCount})(w=O.object||(O.object={}))})(y=o.evtTools||(o.evtTools={}));class C{constructor(){this.objectsLists=new Map;this.localVariablesContainers=[];this.callbacks=new Map;this.parent=null}static from(O){const h=new C;return h.parent=O,h}getOrCreateList(O){return this.objectsLists.has(O)||this.objectsLists.set(O,[]),this.objectsLists.get(O)}getObjects(O){return!this.objectsLists.has(O)&&this.parent?this.parent.getObjects(O):this.objectsLists.get(O)||[]}addObject(O,h){const m=this.getOrCreateList(O);if(m.includes(h))return;m.push(h);const v=()=>this.removeObject(O,h);this.callbacks.set(h,v),h.registerDestroyCallback(v)}removeObject(O,h){const m=this.getOrCreateList(O),v=m.indexOf(h);v!==-1&&(m.splice(v,1),h.unregisterDestroyCallback(this.callbacks.get(h)),this.callbacks.delete(h))}restoreLocalVariablesContainers(O){o.copyArray(this.localVariablesContainers,O)}backupLocalVariablesContainers(O){o.copyArray(O,this.localVariablesContainers)}}o.LongLivedObjectsList=C})(gdjs||(gdjs={})); +//# sourceMappingURL=objecttools.js.map diff --git a/events-tools/runtimescenetools.js b/events-tools/runtimescenetools.js new file mode 100644 index 0000000000000000000000000000000000000000..8f7deb9ea09e0c95c6c54965e174bdba0a7a8f2c --- /dev/null +++ b/events-tools/runtimescenetools.js @@ -0,0 +1,2 @@ +var gdjs;(function(r){let c;(function(i){let u;(function(s){s.sceneJustBegins=function(e){return e.getScene().getTimeManager().isFirstFrame()},s.sceneJustResumed=function(e){return e.getScene().sceneJustResumed()},s.getSceneName=function(e){return e.getScene().getName()},s.setBackgroundColor=function(e,t){const n=t.split(";");n.length<3||e.getScene().setBackgroundColor(parseInt(n[0]),parseInt(n[1]),parseInt(n[2]))},s.getElapsedTimeInSeconds=function(e){return e.getScene().getTimeManager().getElapsedTime()/1e3},s.setTimeScale=function(e,t){return e.getScene().getTimeManager().setTimeScale(t)},s.getTimeScale=function(e){return e.getScene().getTimeManager().getTimeScale()},s.timerElapsedTime=function(e,t,n){const a=e.getScene().getTimeManager();return a.hasTimer(n)?a.getTimer(n).getTime()/1e3>=t:(a.addTimer(n),!1)},s.timerPaused=function(e,t){const n=e.getScene().getTimeManager();return n.hasTimer(t)?n.getTimer(t).isPaused():!1},s.resetTimer=function(e,t){const n=e.getScene().getTimeManager();n.hasTimer(t)?n.getTimer(t).reset():n.addTimer(t)},s.pauseTimer=function(e,t){const n=e.getScene().getTimeManager();n.hasTimer(t)||n.addTimer(t),n.getTimer(t).setPaused(!0)},s.unpauseTimer=function(e,t){const n=e.getScene().getTimeManager();return n.hasTimer(t)||n.addTimer(t),n.getTimer(t).setPaused(!1)},s.removeTimer=function(e,t){e.getScene().getTimeManager().removeTimer(t)};class m extends r.AsyncTask{constructor(t){super();this.timeElapsedOnScene=0;this.duration=t}update(t){return this.timeElapsedOnScene+=t.getScene().getTimeManager().getElapsedTime(),this.timeElapsedOnScene>=this.duration}}s.WaitTask=m,s.wait=e=>new m(e*1e3),s.getTimerElapsedTimeInSeconds=function(e,t){const n=e.getScene().getTimeManager();return n.hasTimer(t)?n.getTimer(t).getTime()/1e3:0},s.getTimerElapsedTimeInSecondsOrNaN=function(e,t){const n=e.getScene().getTimeManager();return n.hasTimer(t)?n.getTimer(t).getTime()/1e3:Number.NaN},s.getTimeFromStartInSeconds=function(e){return e.getScene().getTimeManager().getTimeFromStart()/1e3},s.getTime=function(e,t){if(t==="timestamp")return Date.now();const n=new Date;if(t==="hour")return n.getHours();if(t==="min")return n.getMinutes();if(t==="sec")return n.getSeconds();if(t==="mday")return n.getDate();if(t==="mon")return n.getMonth();if(t==="year")return n.getFullYear()-1900;if(t==="wday")return n.getDay();if(t==="yday"){const a=new Date(n.getFullYear(),0,0),o=n.getTime()-a.getTime(),g=1e3*60*60*24;return Math.floor(o/g)}return 0},s.replaceScene=function(e,t,n){!e.getGame().getSceneAndExtensionsData(t)||e.getScene().requestChange(n?r.SceneChangeRequest.CLEAR_SCENES:r.SceneChangeRequest.REPLACE_SCENE,t)},s.pushScene=function(e,t){!e.getGame().getSceneAndExtensionsData(t)||e.getScene().requestChange(r.SceneChangeRequest.PUSH_SCENE,t)},s.popScene=function(e){e.getScene().requestChange(r.SceneChangeRequest.POP_SCENE)},s.stopGame=function(e){e.getScene().requestChange(r.SceneChangeRequest.STOP_GAME)},s.createObjectsFromExternalLayout=function(e,t,n,a,o){const g=e.getGame().getExternalLayoutData(t);g!==null&&e.getScene().createObjectsFrom(g.instances,n,a,o||0,!1)},s.hasGameJustResumed=e=>e.getGame().hasJustResumed(),s.doesSceneExist=(e,t)=>e.getGame().hasScene(t),s.prioritizeLoadingOfScene=(e,t)=>{e.getGame().prioritizeLoadingOfScene(t)},s.getSceneLoadingProgress=(e,t)=>e.getGame().getSceneLoadingProgress(t),s.areSceneAssetsLoaded=(e,t)=>e.getGame().areSceneAssetsLoaded(t)})(u=i.runtimeScene||(i.runtimeScene={}))})(c=r.evtTools||(r.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=runtimescenetools.js.map diff --git a/events-tools/soundtools.js b/events-tools/soundtools.js new file mode 100644 index 0000000000000000000000000000000000000000..ec587a1590ad107564155a052aabc3c2e876fd14 --- /dev/null +++ b/events-tools/soundtools.js @@ -0,0 +1,2 @@ +var gdjs;(function(u){let s;(function(i){let r;(function(o){o.getGlobalVolume=function(n){return n.getScene().getSoundManager().getGlobalVolume()},o.setGlobalVolume=function(n,t){n.getScene().getSoundManager().setGlobalVolume(t)},o.unloadAllAudio=function(n){n.getScene().getSoundManager().unloadAll()},o.playSound=function(n,t,e,g,a){n.getScene().getSoundManager().playSound(t,e,g,a)},o.playSoundOnChannel=function(n,t,e,g,a,c){n.getScene().getSoundManager().playSoundOnChannel(t,e,g,a,c)},o.stopSoundOnChannel=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);e&&e.stop()},o.pauseSoundOnChannel=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);e&&e.pause()},o.continueSoundOnChannel=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);e&&(e.playing()||e.play())},o.isSoundOnChannelPlaying=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);return e?e.playing():!1},o.isSoundOnChannelPaused=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);return e?e.paused():!1},o.isSoundOnChannelStopped=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);return e?e.stopped():!0},o.getSoundOnChannelVolume=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);return e?e.getVolume()*100:100},o.setSoundOnChannelVolume=function(n,t,e){const g=n.getScene().getSoundManager().getSoundOnChannel(t);g&&g.setVolume(e/100)},o.getSoundOnChannelPlayingOffset=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);return e?e.getSeek():0},o.setSoundOnChannelPlayingOffset=function(n,t,e){const g=n.getScene().getSoundManager().getSoundOnChannel(t);g&&g.setSeek(e)},o.getSoundOnChannelPitch=function(n,t){const e=n.getScene().getSoundManager().getSoundOnChannel(t);return e?e.getRate():1},o.setSoundOnChannelPitch=function(n,t,e){const g=n.getScene().getSoundManager().getSoundOnChannel(t);g&&g.setRate(e)},o.preloadSound=(n,t)=>n.getScene().getSoundManager().loadAudio(t,!1),o.unloadSound=(n,t)=>n.getScene().getSoundManager().unloadAudio(t,!1),o.playMusic=function(n,t,e,g,a){n.getScene().getSoundManager().playMusic(t,e,g,a)},o.playMusicOnChannel=function(n,t,e,g,a,c){n.getScene().getSoundManager().playMusicOnChannel(t,e,g,a,c)},o.stopMusicOnChannel=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);e&&e.stop()},o.pauseMusicOnChannel=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);e&&e.pause()},o.continueMusicOnChannel=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);e&&(e.playing()||e.play())},o.isMusicOnChannelPlaying=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);return e?e.playing():!1},o.isMusicOnChannelPaused=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);return e?e.paused():!1},o.isMusicOnChannelStopped=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);return e?e.stopped():!0},o.getMusicOnChannelVolume=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);return e?e.getVolume()*100:100},o.setMusicOnChannelVolume=function(n,t,e){const g=n.getScene().getSoundManager().getMusicOnChannel(t);g&&g.setVolume(e/100)},o.getMusicOnChannelPlayingOffset=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);return e?e.getSeek():0},o.setMusicOnChannelPlayingOffset=function(n,t,e){const g=n.getScene().getSoundManager().getMusicOnChannel(t);g&&g.setSeek(e)},o.getMusicOnChannelPitch=function(n,t){const e=n.getScene().getSoundManager().getMusicOnChannel(t);return e?e.getRate():1},o.setMusicOnChannelPitch=function(n,t,e){const g=n.getScene().getSoundManager().getMusicOnChannel(t);g&&g.setRate(e)},o.preloadMusic=(n,t)=>n.getScene().getSoundManager().loadAudio(t,!0),o.unloadMusic=(n,t)=>n.getScene().getSoundManager().unloadAudio(t,!0),o.fadeSoundVolume=(n,t,e,g)=>{const a=n.getScene().getSoundManager().getSoundOnChannel(t);a&&a.fade(a.getVolume(),e/100,g*1e3)},o.fadeMusicVolume=(n,t,e,g)=>{const a=n.getScene().getSoundManager().getMusicOnChannel(t);a&&a.fade(a.getVolume(),e/100,g*1e3)}})(r=i.sound||(i.sound={}))})(s=u.evtTools||(u.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=soundtools.js.map diff --git a/events-tools/storagetools.js b/events-tools/storagetools.js new file mode 100644 index 0000000000000000000000000000000000000000..2a41f6d93b1f087c700b3d715cd52eebfe18c2ba --- /dev/null +++ b/events-tools/storagetools.js @@ -0,0 +1,2 @@ +var gdjs;(function(S){const f=new S.Logger("Storage");let d;(function(p){let h;(function(a){let c=null;try{typeof cc!="undefined"?c=cc.sys.localStorage:typeof window!="undefined"&&(c=window.localStorage)}catch(t){f.error("Unable to get access to the localStorage: "+t)}c||f.error("Storage actions won't work as no localStorage was found.");const u=new Hashtable;a.loadJSONFileFromStorage=t=>{if(u.containsKey(t))return;let i=null;try{c&&(i=c.getItem("GDJS_"+t))}catch(l){f.error('Unable to load data from localStorage for "'+t+'": '+l)}let o={};try{i&&(o=JSON.parse(i))}catch(l){f.error('Unable to load data from "'+t+'" - data is not valid JSON: '+l)}u.put(t,o)},a.unloadJSONFile=t=>{if(!u.containsKey(t))return;const i=u.get(t),o=JSON.stringify(i);try{c&&c.setItem("GDJS_"+t,o)}catch(l){f.error('Unable to save data to localStorage for "'+t+'": '+l)}u.remove(t)};const g=(t,i)=>{let o=!1;u.containsKey(t)||(o=!0,a.loadJSONFileFromStorage(t));const l=i(u.get(t));return o&&a.unloadJSONFile(t),l};a.clearJSONFile=t=>g(t,i=>{for(const o in i)i.hasOwnProperty(o)&&delete i[o];return!0}),a.elementExistsInJSONFile=(t,i)=>g(t,o=>{const l=i.split("/");let n=o;for(let e=0;eg(t,o=>{const l=i.split("/");let n=o;for(let e=0;eg(t,l=>{const n=i.split("/");let e=l;for(let r=0;rg(t,l=>{const n=i.split("/");let e=l;for(let r=0;rg(t,n=>{const e=i.split("/");let r=n;for(let s=0;sg(t,n=>{const e=i.split("/");let r=n;for(let s=0;s=0?t.substr(n,r):""},e.strAt=function(t,n){return n=0?t.substr(n,1):""},e.strRepeat=function(t,n){let r="";for(let o=0;oo.length));)i=o.indexOf(n,u);return o},e.strRFindFrom=s.evtTools.string.strFindLastFrom})(f=c.string||(c.string={}))})(p=s.evtTools||(s.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=stringtools.js.map diff --git a/events-tools/variabletools.js b/events-tools/variabletools.js new file mode 100644 index 0000000000000000000000000000000000000000..4d87d6f30937e0eae3963b0b59f007590b24f8f7 --- /dev/null +++ b/events-tools/variabletools.js @@ -0,0 +1,2 @@ +var gdjs;(function(a){let l;(function(o){let i;(function(r){r.getVariableNumber=function(e){return e.getAsNumber()},r.getVariableString=function(e){return e.getAsString()},r.getVariableBoolean=function(e,t){return e.getAsBoolean()===t},r.setVariableBoolean=function(e,t){e.setBoolean(t)},r.toggleVariableBoolean=function(e){e.setBoolean(!e.getAsBoolean())},r.sceneVariableExists=function(e,t){return e.getScene().getVariables().has(t)},r.globalVariableExists=function(e,t){return e.getGame().getVariables().has(t)},r.variableChildExists=function(e,t){return e.hasChild(t)},r.variableRemoveChild=function(e,t){e.removeChild(t)},r.variableClearChildren=function(e){e.clearChildren()},r.variablePushCopy=function(e,t){e.pushVariableCopy(t)},r.valuePush=function(e,t){e.pushValue(t)},r.variableRemoveAt=function(e,t){e.removeAtIndex(t)},r.getVariableChildCount=function(e){return e.getChildrenCount()},r.getFirstVariableNumber=function(e){return e.getChildrenCount()===0?0:e.getAllChildrenArray()[0].getAsNumber()},r.getFirstVariableString=function(e){return e.getChildrenCount()===0?"":e.getAllChildrenArray()[0].getAsString()},r.getLastVariableNumber=function(e){const t=e.getAllChildrenArray();return t.length===0?0:t[t.length-1].getAsNumber()},r.getLastVariableString=function(e){const t=e.getAllChildrenArray();return t.length===0?"":t[t.length-1].getAsString()}})(i=o.variable||(o.variable={}));let s;(function(n){n.getVariableNumber=a.evtTools.variable.getVariableNumber,n.getVariableString=a.evtTools.variable.getVariableString,n.getVariableBoolean=a.evtTools.variable.getVariableBoolean,n.setVariableBoolean=a.evtTools.variable.setVariableBoolean,n.toggleVariableBoolean=a.evtTools.variable.toggleVariableBoolean,n.sceneVariableExists=a.evtTools.variable.sceneVariableExists,n.globalVariableExists=a.evtTools.variable.globalVariableExists,n.variableChildExists=a.evtTools.variable.variableChildExists,n.variableRemoveChild=a.evtTools.variable.variableRemoveChild,n.variableClearChildren=a.evtTools.variable.variableClearChildren,n.variablePushCopy=a.evtTools.variable.variablePushCopy,n.valuePush=a.evtTools.variable.valuePush,n.variableRemoveAt=a.evtTools.variable.variableRemoveAt,n.getVariableChildCount=a.evtTools.variable.getVariableChildCount})(s=o.common||(o.common={}))})(l=a.evtTools||(a.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=variabletools.js.map diff --git a/events-tools/windowtools.js b/events-tools/windowtools.js new file mode 100644 index 0000000000000000000000000000000000000000..080febda32163735e9cb9e0683ee2bbc03796ab1 --- /dev/null +++ b/events-tools/windowtools.js @@ -0,0 +1,2 @@ +var gdjs;(function(r){let s;(function(u){let m;(function(t){t.setMargins=function(e,n,o,i,g){e.getGame().getRenderer().setMargins(n,o,i,g)},t.setFullScreen=function(e,n,o){e.getGame().getRenderer().keepAspectRatio(o),e.getGame().getRenderer().setFullScreen(n)},t.isFullScreen=function(e){return e.getGame().getRenderer().isFullScreen()},t.setWindowSize=function(e,n,o,i){e.getGame().getRenderer().setWindowSize(n,o),i&&e.getGame().setGameResolutionSize(n,o)},t.centerWindow=function(e){e.getGame().getRenderer().centerWindow()},t.setGameResolutionSize=function(e,n,o){e.getGame().setGameResolutionSize(n,o)},t.setGameResolutionResizeMode=function(e,n){e.getGame().setGameResolutionResizeMode(n)},t.setAdaptGameResolutionAtRuntime=function(e,n){e.getGame().setAdaptGameResolutionAtRuntime(n)},t.setWindowTitle=function(e,n){e.getGame().getRenderer().setWindowTitle(n)},t.getWindowTitle=function(e){return e.getGame().getRenderer().getWindowTitle()},t.getWindowInnerWidth=function(){return r.RuntimeGameRenderer&&r.RuntimeGameRenderer.getWindowInnerWidth?r.RuntimeGameRenderer.getWindowInnerWidth():typeof t!="undefined"?t.innerWidth:800},t.getWindowInnerHeight=function(){return r.RuntimeGameRenderer&&r.RuntimeGameRenderer.getWindowInnerHeight?r.RuntimeGameRenderer.getWindowInnerHeight():typeof t!="undefined"?t.innerHeight:800},t.getGameResolutionWidth=function(e){return e.getGame().getGameResolutionWidth()},t.getGameResolutionHeight=function(e){return e.getGame().getGameResolutionHeight()},t.openURL=function(e,n){return n.getGame().getRenderer().openURL(e)}})(m=u.window||(u.window={}))})(s=r.evtTools||(r.evtTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=windowtools.js.map diff --git a/fontfaceobserver-font-manager/fontfaceobserver-font-manager.js b/fontfaceobserver-font-manager/fontfaceobserver-font-manager.js new file mode 100644 index 0000000000000000000000000000000000000000..b9bef0857ef672205d4e69b02e0681cda995b0ac --- /dev/null +++ b/fontfaceobserver-font-manager/fontfaceobserver-font-manager.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){const s=new i.Logger("Font manager"),d=["font"];class c{constructor(r){this._loadedFontFamily=new i.ResourceCache;this._loadedFontFamilySet=new Set;this._resourceLoader=r}getResourceKinds(){return d}getFontFamily(r){return this._loadedFontFamily.getFromName(r)||"Arial"}getFontFile(r){const e=this._resourceLoader.getResource(r);return e?e.file||"":r}_getFontFamilyFromFilename(r){let e="gdjs_font_"+r.file.toLowerCase().replace(/[^\w]/gi,"-");const o=e;let n=2;for(;this._loadedFontFamilySet.has(e);)e=e+"-"+n,n++;return o}_loadFont(r,e){const o={},n="url("+encodeURI(e)+")";if(typeof FontFace!="undefined")return fetch(this._resourceLoader.getFullUrl(e),{credentials:this._resourceLoader.checkIfCredentialsRequired(e)?"include":"same-origin"}).then(t=>{if(!t.ok){const a="Unable to fetch "+e+" to be loaded as a font. HTTP status is: "+t.status+".";throw s.error(a),new Error(a)}return t.arrayBuffer()}).then(t=>{const a=new FontFace(r,t,o);document.fonts.add(a)});{const t=document.createElement("style");return t.appendChild(document.createTextNode("@font-face { font-family: '"+r+"'; src: "+n+"; }")),document.head.appendChild(t),new FontFaceObserver(r,o).load()}}async processResource(r){}async loadResource(r){const e=this._resourceLoader.getResource(r);if(!e){s.warn('Unable to find font for resource "'+r+'".');return}if(this._loadedFontFamily.get(e))return;const o=e.file;if(!o)return;const n=this._getFontFamilyFromFilename(e);this._loadedFontFamily.set(e,n),this._loadedFontFamilySet.add(n);try{await this._loadFont(n,o)}catch(t){s.error('Error loading font resource "'+e.name+'" (file: '+o+"): "+(t.message||"Unknown error"))}}dispose(){this._loadedFontFamily.clear(),this._loadedFontFamilySet.clear()}}i.FontFaceObserverFontManager=c,i.FontManager=c})(gdjs||(gdjs={})); +//# sourceMappingURL=fontfaceobserver-font-manager.js.map diff --git a/fontfaceobserver-font-manager/fontfaceobserver.js b/fontfaceobserver-font-manager/fontfaceobserver.js new file mode 100644 index 0000000000000000000000000000000000000000..3ff4b31f89ff9c3854135a09035b65654de419cb --- /dev/null +++ b/fontfaceobserver-font-manager/fontfaceobserver.js @@ -0,0 +1,16 @@ +(function() { +var module; //Define an undefined module variable to avoid fontfaceobserver thinking it's used in an environment using require. + +/* Font Face Observer v2.0.13 - © Bram Stein. License: BSD-3-Clause */(function(){'use strict';var f,g=[];function l(a){g.push(a);1==g.length&&f()}function m(){for(;g.length;)g[0](),g.shift()}f=function(){setTimeout(m)};function n(a){this.a=p;this.b=void 0;this.f=[];var b=this;try{a(function(a){q(b,a)},function(a){r(b,a)})}catch(c){r(b,c)}}var p=2;function t(a){return new n(function(b,c){c(a)})}function u(a){return new n(function(b){b(a)})}function q(a,b){if(a.a==p){if(b==a)throw new TypeError;var c=!1;try{var d=b&&b.then;if(null!=b&&"object"==typeof b&&"function"==typeof d){d.call(b,function(b){c||q(a,b);c=!0},function(b){c||r(a,b);c=!0});return}}catch(e){c||r(a,e);return}a.a=0;a.b=b;v(a)}} +function r(a,b){if(a.a==p){if(b==a)throw new TypeError;a.a=1;a.b=b;v(a)}}function v(a){l(function(){if(a.a!=p)for(;a.f.length;){var b=a.f.shift(),c=b[0],d=b[1],e=b[2],b=b[3];try{0==a.a?"function"==typeof c?e(c.call(void 0,a.b)):e(a.b):1==a.a&&("function"==typeof d?e(d.call(void 0,a.b)):b(a.b))}catch(h){b(h)}}})}n.prototype.g=function(a){return this.c(void 0,a)};n.prototype.c=function(a,b){var c=this;return new n(function(d,e){c.f.push([a,b,d,e]);v(c)})}; +function w(a){return new n(function(b,c){function d(c){return function(d){h[c]=d;e+=1;e==a.length&&b(h)}}var e=0,h=[];0==a.length&&b(h);for(var k=0;kparseInt(a[1],10)}else C=!1;return C}function J(){null===F&&(F=!!document.fonts);return F} +function K(){if(null===E){var a=document.createElement("div");try{a.style.font="condensed 100px sans-serif"}catch(b){}E=""!==a.style.font}return E}function L(a,b){return[a.style,a.weight,K()?a.stretch:"","100px",b].join(" ")} +A.prototype.load=function(a,b){var c=this,k=a||"BESbswy",q=0,D=b||3E3,H=(new Date).getTime();return new Promise(function(a,b){if(J()&&!G()){var M=new Promise(function(a,b){function e(){(new Date).getTime()-H>=D?b():document.fonts.load(L(c,'"'+c.family+'"'),k).then(function(c){1<=c.length?a():setTimeout(e,25)},function(){b()})}e()}),N=new Promise(function(a,c){q=setTimeout(c,D)});Promise.race([N,M]).then(function(){clearTimeout(q);a(c)},function(){b(c)})}else m(function(){function u(){var b;if(b=-1!= +f&&-1!=g||-1!=f&&-1!=h||-1!=g&&-1!=h)(b=f!=g&&f!=h&&g!=h)||(null===B&&(b=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),B=!!b&&(536>parseInt(b[1],10)||536===parseInt(b[1],10)&&11>=parseInt(b[2],10))),b=B&&(f==v&&g==v&&h==v||f==w&&g==w&&h==w||f==x&&g==x&&h==x)),b=!b;b&&(d.parentNode&&d.parentNode.removeChild(d),clearTimeout(q),a(c))}function I(){if((new Date).getTime()-H>=D)d.parentNode&&d.parentNode.removeChild(d),b(c);else{var a=document.hidden;if(!0===a||void 0===a)f=e.a.offsetWidth, +g=n.a.offsetWidth,h=p.a.offsetWidth,u();q=setTimeout(I,50)}}var e=new r(k),n=new r(k),p=new r(k),f=-1,g=-1,h=-1,v=-1,w=-1,x=-1,d=document.createElement("div");d.dir="ltr";t(e,L(c,"sans-serif"));t(n,L(c,"serif"));t(p,L(c,"monospace"));d.appendChild(e.a);d.appendChild(n.a);d.appendChild(p.a);document.body.appendChild(d);v=e.a.offsetWidth;w=n.a.offsetWidth;x=p.a.offsetWidth;I();z(e,function(a){f=a;u()});t(e,L(c,'"'+c.family+'",sans-serif'));z(n,function(a){g=a;u()});t(n,L(c,'"'+c.family+'",serif')); +z(p,function(a){h=a;u()});t(p,L(c,'"'+c.family+'",monospace'))})})};"object"===typeof module?module.exports=A:(window.FontFaceObserver=A,window.FontFaceObserver.prototype.load=A.prototype.load);}()); +})() \ No newline at end of file diff --git a/force.js b/force.js new file mode 100644 index 0000000000000000000000000000000000000000..b2002e647935512b13e662cfe4e4ec1d870e374b --- /dev/null +++ b/force.js @@ -0,0 +1,2 @@ +var gdjs;(function(e){class s{constructor(t,i,h){this._dirty=!1;this._x=t||0,this._y=i||0,this._angle=Math.atan2(i,t)*180/Math.PI,this._length=Math.sqrt(t*t+i*i),this._multiplier=h}getX(){return this._x}getY(){return this._y}setX(t){this._x=t,this._dirty=!0}setY(t){this._y=t,this._dirty=!0}clear(){this._x=0,this._y=0,this._length=0,this._dirty=!1}addForce(t){this._x+=t._x,this._y+=t._y,this._dirty=!0}add(t,i){this._x+=t,this._y+=i,this._dirty=!0}setAngle(t){this._dirty&&(this._length=Math.sqrt(this._x*this._x+this._y*this._y),this._dirty=!1),this._angle=t;const i=t/180*Math.PI;this._x=Math.cos(i)*this._length,this._y=Math.sin(i)*this._length}setLength(t){this._dirty&&(this._angle=Math.atan2(this._y,this._x)*180/Math.PI,this._dirty=!1),this._length=t;const i=this._angle/180*Math.PI;this._x=Math.cos(i)*this._length,this._y=Math.sin(i)*this._length}getAngle(){return this._dirty&&(this._angle=Math.atan2(this._y,this._x)*180/Math.PI,this._length=Math.sqrt(this._x*this._x+this._y*this._y),this._dirty=!1),this._angle}getLength(){return this._dirty&&(this._angle=Math.atan2(this._y,this._x)*180/Math.PI,this._length=Math.sqrt(this._x*this._x+this._y*this._y),this._dirty=!1),this._length}getMultiplier(){return this._multiplier}setMultiplier(t){this._multiplier=t}getNetworkSyncData(){return{x:this._x,y:this._y,a:this._angle,l:this._length,m:this._multiplier}}updateFromNetworkSyncData(t){this._x=t.x,this._y=t.y,this._angle=t.a,this._length=t.l,this._multiplier=t.m}}e.Force=s})(gdjs||(gdjs={})); +//# sourceMappingURL=force.js.map diff --git a/gd.js b/gd.js new file mode 100644 index 0000000000000000000000000000000000000000..552369e4abc83e5c75bd625d287721f21f6997f2 --- /dev/null +++ b/gd.js @@ -0,0 +1,2 @@ +var gdjs;(function(t){const i=new t.Logger("Engine runtime"),l=/^(#{0,1}[A-Fa-f0-9]{6})$/,s=/^(#{0,1}[A-Fa-f0-9]{3})$/,b=/^(\d{1,3};\d{1,3};\d{1,3})/;let f;(function(n){const e=!0})(f=t.evtTools||(t.evtTools={})),t.objectsTypes=new Hashtable,t.behaviorsTypes=new Hashtable,t.callbacksFirstRuntimeSceneLoaded=[],t.callbacksRuntimeSceneLoaded=[],t.callbacksRuntimeScenePreEvents=[],t.callbacksRuntimeScenePostEvents=[],t.callbacksRuntimeScenePaused=[],t.callbacksRuntimeSceneResumed=[],t.callbacksRuntimeSceneUnloading=[],t.callbacksRuntimeSceneUnloaded=[],t.callbacksObjectDeletedFromScene=[],t.gdevelopLogo="",t.rgbToHex=function(e,n,r){return""+((1<<24)+(e<<16)+(n<<8)+r).toString(16).slice(1)},t.hexToRGBColor=function(e){const n=parseInt(e.replace("#",""),16);return Number.isFinite(n)?[n>>16&255,n>>8&255,n&255]:[0,0,0]},t.shorthandHexToRGBColor=function(e){const n=parseInt(e.replace("#",""),16);return Number.isFinite(n)?[17*(n>>8&15),17*(n>>4&15),17*(n&15)]:[0,0,0]},t.rgbOrHexToRGBColor=function(e){const n=t.extractRGBString(e);if(n){const a=n.split(";");if(a.length===3)return[Math.min(255,parseInt(a[0],10)),Math.min(255,parseInt(a[1],10)),Math.min(255,parseInt(a[2],10))]}const r=t.extractHexString(e);if(r)return t.hexToRGBColor(r);const o=t.extractShorthandHexString(e);return o?t.shorthandHexToRGBColor(o):[0,0,0]},t.rgbOrHexStringToNumber=e=>{const n=t.rgbOrHexToRGBColor(e);return t.rgbToHexNumber(n[0],n[1],n[2])},t.rgbToHexNumber=function(e,n,r){return(e<<16)+(n<<8)+r},t.hexNumberToRGB=e=>({r:e>>16&255,g:e>>8&255,b:e&255,a:255}),t.hexNumberToRGBArray=e=>[e>>16&255,e>>8&255,e&255],t.extractHexString=e=>{const n=e.match(l);return n?n[0]:null},t.extractShorthandHexString=e=>{const n=e.match(s);return n?n[0]:null},t.extractRGBString=e=>{const n=e.match(b);return n?n[0]:null},t.random=function(e){return e<=0?0:Math.floor(Math.random()*(e+1))},t.randomInRange=function(e,n){return e+t.random(n-e)},t.randomFloat=function(e){return e<=0?0:Math.random()*e},t.randomFloatInRange=function(e,n){return e+t.randomFloat(n-e)},t.randomWithStep=function(e,n,r){return r<=0?e+t.random(n-e):e+t.random(Math.floor((n-e)/r))*r},t.toRad=function(e){return e/180*Math.PI},t.toDegrees=function(e){return e*180/Math.PI},t.registerObject=function(e,n){t.objectsTypes.put(e,n)},t.registerBehavior=function(e,n){t.behaviorsTypes.put(e,n)},t.registerFirstRuntimeSceneLoadedCallback=function(e){t.callbacksFirstRuntimeSceneLoaded.push(e)},t.registerRuntimeSceneLoadedCallback=function(e){t.callbacksRuntimeSceneLoaded.push(e)},t.registerRuntimeScenePreEventsCallback=function(e){t.callbacksRuntimeScenePreEvents.push(e)},t.registerRuntimeScenePostEventsCallback=function(e){t.callbacksRuntimeScenePostEvents.push(e)},t.registerRuntimeScenePausedCallback=function(e){t.callbacksRuntimeScenePaused.push(e)},t.registerRuntimeSceneResumedCallback=function(e){t.callbacksRuntimeSceneResumed.push(e)},t.registerRuntimeSceneUnloadingCallback=function(e){t.callbacksRuntimeSceneUnloading.push(e)},t.registerRuntimeSceneUnloadedCallback=function(e){t.callbacksRuntimeSceneUnloaded.push(e)},t.registerObjectDeletedFromSceneCallback=function(e){t.callbacksObjectDeletedFromScene.push(e)},t._unregisterCallback=function(e){const n=r=>{for(let o=0;oa?(a^Math.random()*16>>a/4).toString(16):(""+1e7+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,o);return o()}if(!t.makeUuid.hex){t.makeUuid.hex=[];for(var e=0;e<256;e++)t.makeUuid.hex[e]=(e<16?"0":"")+e.toString(16)}const n=t.makeUuid.hex;var r=crypto.getRandomValues(new Uint8Array(16));return r[6]=r[6]&15|64,r[8]=r[8]&63|128,n[r[0]]+n[r[1]]+n[r[2]]+n[r[3]]+"-"+n[r[4]]+n[r[5]]+"-"+n[r[6]]+n[r[7]]+"-"+n[r[8]]+n[r[9]]+"-"+n[r[10]]+n[r[11]]+n[r[12]]+n[r[13]]+n[r[14]]+n[r[15]]},t.nearlyEqual=(e,n,r)=>{const o=Math.abs(e),a=Math.abs(n),c=Math.abs(e-n);return e===n?!0:e==0||n==0||o+a{u.push(e)},t.getAllAsynchronouslyLoadingLibraryPromise=()=>Promise.all(u)})(gdjs||(gdjs={})),console.warn=console.warn||console.log,console.error=console.error||console.log; +//# sourceMappingURL=gd.js.map diff --git a/gdjs-evtsext__behaviorremapper__remapfortopdown.js b/gdjs-evtsext__behaviorremapper__remapfortopdown.js new file mode 100644 index 0000000000000000000000000000000000000000..34a7cc92c17eb67cb6f89cb3063b7ce411294447 --- /dev/null +++ b/gdjs-evtsext__behaviorremapper__remapfortopdown.js @@ -0,0 +1,610 @@ + +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown || {}; + +/** + * Behavior generated from Remap Top-down + */ +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown = class RemapForTopdown extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.Up = behaviorData.Up !== undefined ? behaviorData.Up : "w"; + this._behaviorData.Left = behaviorData.Left !== undefined ? behaviorData.Left : "a"; + this._behaviorData.Right = behaviorData.Right !== undefined ? behaviorData.Right : "d"; + this._behaviorData.Down = behaviorData.Down !== undefined ? behaviorData.Down : "s"; + this._behaviorData.Topdown = behaviorData.Topdown !== undefined ? behaviorData.Topdown : ""; + } + + // Hot-reload: + updateFromBehaviorData(oldBehaviorData, newBehaviorData) { + + if (oldBehaviorData.Up !== newBehaviorData.Up) + this._behaviorData.Up = newBehaviorData.Up; + if (oldBehaviorData.Left !== newBehaviorData.Left) + this._behaviorData.Left = newBehaviorData.Left; + if (oldBehaviorData.Right !== newBehaviorData.Right) + this._behaviorData.Right = newBehaviorData.Right; + if (oldBehaviorData.Down !== newBehaviorData.Down) + this._behaviorData.Down = newBehaviorData.Down; + if (oldBehaviorData.Topdown !== newBehaviorData.Topdown) + this._behaviorData.Topdown = newBehaviorData.Topdown; + + return true; + } + + // Network sync: + getNetworkSyncData() { + return { + ...super.getNetworkSyncData(), + props: { + + Up: this._behaviorData.Up, + Left: this._behaviorData.Left, + Right: this._behaviorData.Right, + Down: this._behaviorData.Down, + Topdown: this._behaviorData.Topdown, + } + }; + } + updateFromNetworkSyncData(networkSyncData) { + super.updateFromNetworkSyncData(networkSyncData); + + if (networkSyncData.props.Up !== undefined) + this._behaviorData.Up = networkSyncData.props.Up; + if (networkSyncData.props.Left !== undefined) + this._behaviorData.Left = networkSyncData.props.Left; + if (networkSyncData.props.Right !== undefined) + this._behaviorData.Right = networkSyncData.props.Right; + if (networkSyncData.props.Down !== undefined) + this._behaviorData.Down = networkSyncData.props.Down; + if (networkSyncData.props.Topdown !== undefined) + this._behaviorData.Topdown = networkSyncData.props.Topdown; + } + + // Properties: + + _getUp() { + return this._behaviorData.Up !== undefined ? this._behaviorData.Up : "w"; + } + _setUp(newValue) { + this._behaviorData.Up = newValue; + } + _getLeft() { + return this._behaviorData.Left !== undefined ? this._behaviorData.Left : "a"; + } + _setLeft(newValue) { + this._behaviorData.Left = newValue; + } + _getRight() { + return this._behaviorData.Right !== undefined ? this._behaviorData.Right : "d"; + } + _setRight(newValue) { + this._behaviorData.Right = newValue; + } + _getDown() { + return this._behaviorData.Down !== undefined ? this._behaviorData.Down : "s"; + } + _setDown(newValue) { + this._behaviorData.Down = newValue; + } + _getTopdown() { + return this._behaviorData.Topdown !== undefined ? this._behaviorData.Topdown : ""; + } + _setTopdown(newValue) { + this._behaviorData.Topdown = newValue; + } +} + +/** + * Shared data generated from Remap Top-down + */ +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.SharedData = class RemapForTopdownSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._BehaviorRemapper_RemapForTopdownSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._BehaviorRemapper_RemapForTopdownSharedData = new gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.SharedData( + initialData + ); + } + return instanceContainer._BehaviorRemapper_RemapForTopdownSharedData; +} + +// Methods: +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext = {}; +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1= []; +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects2= []; + + +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.input.isKeyPressed(runtimeScene, (( gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1.length === 0 ) ? "" :gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getUp())); +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1 */ +{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Topdown")).simulateUpKey(); +} +}} + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.input.isKeyPressed(runtimeScene, (( gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1.length === 0 ) ? "" :gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getLeft())); +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1 */ +{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Topdown")).simulateLeftKey(); +} +}} + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.input.isKeyPressed(runtimeScene, (( gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1.length === 0 ) ? "" :gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getRight())); +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1 */ +{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Topdown")).simulateRightKey(); +} +}} + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.input.isKeyPressed(runtimeScene, (( gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1.length === 0 ) ? "" :gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getDown())); +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1 */ +{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Topdown")).simulateDownKey(); +} +}} + +} + + +}; + +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEvents = function(parentEventsFunctionContext) { +this._onceTriggers.startNewFrame(); +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Topdown": this._getTopdown() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("BehaviorRemapper"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("BehaviorRemapper"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.doStepPreEventsContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext = {}; +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects1= []; +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects2= []; + + +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = eventsFunctionContext.getOnceTriggers().triggerOnce(17008932); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setUp((typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("up") : "")); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setLeft((typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("left") : "")); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setRight((typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("right") : "")); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setDown((typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("down") : "")); +} +}} + +} + + +}; + +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustom = function(up, left, down, right, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Topdown": this._getTopdown() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("BehaviorRemapper"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("BehaviorRemapper"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "up") return up; +if (argName === "left") return left; +if (argName === "down") return down; +if (argName === "right") return right; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetCustomContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext = {}; +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1= []; +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects2= []; + + +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = ((typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("options") : "") == "WASD"); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setUp("w"); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setLeft("a"); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setDown("s"); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setRight("d"); +} +}} + +} + + +{ + + + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = ((typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("options") : "") == "ZQSD"); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setUp("z"); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setLeft("q"); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setDown("s"); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setDown("d"); +} +}} + +} + + +{ + + + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = ((typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("options") : "") == "Numpad"); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setUp("NumpadUp"); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setLeft("NumpadLeft"); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setDown("NumpadDown"); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setRight("NumpadRight"); +} +}} + +} + + +{ + + + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = ((typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("options") : "") == "IJKL"); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setUp("i"); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setLeft("j"); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setDown("k"); +} +}{for(var i = 0, len = gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setRight("l"); +} +}} + +} + + +}; + +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPreset = function(options, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Topdown": this._getTopdown() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("BehaviorRemapper"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("BehaviorRemapper"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "options") return options; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown.prototype.SetPresetContext.GDObjectObjects2.length = 0; + + +return; +} + + +gdjs.registerBehavior("BehaviorRemapper::RemapForTopdown", gdjs.evtsExt__BehaviorRemapper__RemapForTopdown.RemapForTopdown); diff --git a/gdjs-evtsext__bomb__bombanimator.js b/gdjs-evtsext__bomb__bombanimator.js new file mode 100644 index 0000000000000000000000000000000000000000..9a692ac4544d551efbb30e8fcddcd6ed83bf3c3e --- /dev/null +++ b/gdjs-evtsext__bomb__bombanimator.js @@ -0,0 +1,260 @@ + +gdjs.evtsExt__Bomb__BombAnimator = gdjs.evtsExt__Bomb__BombAnimator || {}; + +/** + * Behavior generated from + */ +gdjs.evtsExt__Bomb__BombAnimator.BombAnimator = class BombAnimator extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.Tween3D = behaviorData.Tween3D !== undefined ? behaviorData.Tween3D : ""; + this._behaviorData.Tween = behaviorData.Tween !== undefined ? behaviorData.Tween : ""; + this._behaviorData.Wobble = behaviorData.Wobble !== undefined ? behaviorData.Wobble : ""; + } + + // Hot-reload: + updateFromBehaviorData(oldBehaviorData, newBehaviorData) { + + if (oldBehaviorData.Tween3D !== newBehaviorData.Tween3D) + this._behaviorData.Tween3D = newBehaviorData.Tween3D; + if (oldBehaviorData.Tween !== newBehaviorData.Tween) + this._behaviorData.Tween = newBehaviorData.Tween; + if (oldBehaviorData.Wobble !== newBehaviorData.Wobble) + this._behaviorData.Wobble = newBehaviorData.Wobble; + + return true; + } + + // Network sync: + getNetworkSyncData() { + return { + ...super.getNetworkSyncData(), + props: { + + Tween3D: this._behaviorData.Tween3D, + Tween: this._behaviorData.Tween, + Wobble: this._behaviorData.Wobble, + } + }; + } + updateFromNetworkSyncData(networkSyncData) { + super.updateFromNetworkSyncData(networkSyncData); + + if (networkSyncData.props.Tween3D !== undefined) + this._behaviorData.Tween3D = networkSyncData.props.Tween3D; + if (networkSyncData.props.Tween !== undefined) + this._behaviorData.Tween = networkSyncData.props.Tween; + if (networkSyncData.props.Wobble !== undefined) + this._behaviorData.Wobble = networkSyncData.props.Wobble; + } + + // Properties: + + _getTween3D() { + return this._behaviorData.Tween3D !== undefined ? this._behaviorData.Tween3D : ""; + } + _setTween3D(newValue) { + this._behaviorData.Tween3D = newValue; + } + _getTween() { + return this._behaviorData.Tween !== undefined ? this._behaviorData.Tween : ""; + } + _setTween(newValue) { + this._behaviorData.Tween = newValue; + } + _getWobble() { + return this._behaviorData.Wobble !== undefined ? this._behaviorData.Wobble : ""; + } + _setWobble(newValue) { + this._behaviorData.Wobble = newValue; + } +} + +/** + * Shared data generated from + */ +gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.SharedData = class BombAnimatorSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._Bomb_BombAnimatorSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._Bomb_BombAnimatorSharedData = new gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.SharedData( + initialData + ); + } + return instanceContainer._Bomb_BombAnimatorSharedData; +} + +// Methods: +gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext = {}; +gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1= []; +gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).setRotationX(20); +} +}} + +} + + +{ + + +{ +const variables = new gdjs.VariablesContainer(); +{ +const variable = new gdjs.Variable(); +variable.setNumber(0); +variables._declare("Scale", variable); +} +eventsFunctionContext.localVariables.push(variables); +} +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1); +{eventsFunctionContext.localVariables[0].getFromIndex(0).setNumber((( gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Wobble")).ScaleMin((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)))); +}{for(var i = 0, len = gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Wobble")).SetScaleMin(0.065 * eventsFunctionContext.localVariables[0].getFromIndex(0).getAsNumber(), (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}{for(var i = 0, len = gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Wobble")).TweenScaleMin(eventsFunctionContext.localVariables[0].getFromIndex(0).getAsNumber(), 0.5, "easeInOutQuad", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}{eventsFunctionContext.localVariables[0].getFromIndex(0).setNumber((( gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Wobble")).ScaleMax((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)))); +}{for(var i = 0, len = gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Wobble")).SetScaleMax(0.065 * eventsFunctionContext.localVariables[0].getFromIndex(0).getAsNumber(), (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}{for(var i = 0, len = gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Wobble")).TweenScaleMax(eventsFunctionContext.localVariables[0].getFromIndex(0).getAsNumber(), 0.5, "easeInOutQuad", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} +eventsFunctionContext.localVariables.pop(); + +} + + +{ + + + +} + + +{ + + + +} + + +}; + +gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreated = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Tween3D": this._getTween3D() +, "Tween": this._getTween() +, "Wobble": this._getWobble() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Bomb"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Bomb"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.onCreatedContext.GDObjectObjects2.length = 0; + + +return; +} + +gdjs.evtsExt__Bomb__BombAnimator.BombAnimator.prototype.doStepPreEvents = function() { + this._onceTriggers.startNewFrame(); +}; + + +gdjs.registerBehavior("Bomb::BombAnimator", gdjs.evtsExt__Bomb__BombAnimator.BombAnimator); diff --git a/gdjs-evtsext__bomb__bombbehavior.js b/gdjs-evtsext__bomb__bombbehavior.js new file mode 100644 index 0000000000000000000000000000000000000000..a85c4abea3191f1fb56c4255fddeea3b3cde42ad --- /dev/null +++ b/gdjs-evtsext__bomb__bombbehavior.js @@ -0,0 +1,1029 @@ + +gdjs.evtsExt__Bomb__BombBehavior = gdjs.evtsExt__Bomb__BombBehavior || {}; + +/** + * Behavior generated from + */ +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior = class BombBehavior extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.Delay = behaviorData.Delay !== undefined ? behaviorData.Delay : Number("3") || 0; + this._behaviorData.PlayerId = Number("0") || 0; + this._behaviorData.ExplosionRange = Number("2") || 0; + } + + // Hot-reload: + updateFromBehaviorData(oldBehaviorData, newBehaviorData) { + + if (oldBehaviorData.Delay !== newBehaviorData.Delay) + this._behaviorData.Delay = newBehaviorData.Delay; + if (oldBehaviorData.PlayerId !== newBehaviorData.PlayerId) + this._behaviorData.PlayerId = newBehaviorData.PlayerId; + if (oldBehaviorData.ExplosionRange !== newBehaviorData.ExplosionRange) + this._behaviorData.ExplosionRange = newBehaviorData.ExplosionRange; + + return true; + } + + // Network sync: + getNetworkSyncData() { + return { + ...super.getNetworkSyncData(), + props: { + + Delay: this._behaviorData.Delay, + PlayerId: this._behaviorData.PlayerId, + ExplosionRange: this._behaviorData.ExplosionRange, + } + }; + } + updateFromNetworkSyncData(networkSyncData) { + super.updateFromNetworkSyncData(networkSyncData); + + if (networkSyncData.props.Delay !== undefined) + this._behaviorData.Delay = networkSyncData.props.Delay; + if (networkSyncData.props.PlayerId !== undefined) + this._behaviorData.PlayerId = networkSyncData.props.PlayerId; + if (networkSyncData.props.ExplosionRange !== undefined) + this._behaviorData.ExplosionRange = networkSyncData.props.ExplosionRange; + } + + // Properties: + + _getDelay() { + return this._behaviorData.Delay !== undefined ? this._behaviorData.Delay : Number("3") || 0; + } + _setDelay(newValue) { + this._behaviorData.Delay = newValue; + } + _getPlayerId() { + return this._behaviorData.PlayerId !== undefined ? this._behaviorData.PlayerId : Number("0") || 0; + } + _setPlayerId(newValue) { + this._behaviorData.PlayerId = newValue; + } + _getExplosionRange() { + return this._behaviorData.ExplosionRange !== undefined ? this._behaviorData.ExplosionRange : Number("2") || 0; + } + _setExplosionRange(newValue) { + this._behaviorData.ExplosionRange = newValue; + } +} + +/** + * Shared data generated from + */ +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.SharedData = class BombBehaviorSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._Bomb_BombBehaviorSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._Bomb_BombBehaviorSharedData = new gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.SharedData( + initialData + ); + } + return instanceContainer._Bomb_BombBehaviorSharedData; +} + +// Methods: +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.onCreatedContext = {}; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.onCreatedContext.GDObjectObjects1= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.onCreatedContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.onCreatedContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.onCreatedContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.onCreatedContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.onCreatedContext.GDObjectObjects1[i].resetTimer("Detonator"); +} +}} + +} + + +}; + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.onCreated = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Bomb"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Bomb"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.onCreatedContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.onCreatedContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.onCreatedContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.InitializeContext = {}; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.InitializeContext.GDObjectObjects1= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.InitializeContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.InitializeContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.InitializeContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.InitializeContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.InitializeContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setPlayerId(eventsFunctionContext.getArgument("PlayerId")); +} +}{for(var i = 0, len = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.InitializeContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.InitializeContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setExplosionRange(eventsFunctionContext.getArgument("Range")); +} +}} + +} + + +}; + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.Initialize = function(PlayerId, Range, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Bomb"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Bomb"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "PlayerId") return PlayerId; +if (argName === "Range") return Range; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.InitializeContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.InitializeContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.InitializeContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.InitializeContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.InitializeContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplodeContext = {}; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplodeContext.GDObjectObjects1= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplodeContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplodeContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplodeContext.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplodeContext.GDObjectObjects1.length;i= eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getDelay() ) { + isConditionTrue_0 = true; + gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplodeContext.GDObjectObjects1[k] = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplodeContext.GDObjectObjects1[i]; + ++k; + } +} +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplodeContext.GDObjectObjects1.length = k; +if (isConditionTrue_0) { +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = true; }}} + +} + + +}; + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplode = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Bomb"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Bomb"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplodeContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplodeContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplodeContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplodeContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.IsReadyToExplodeContext.GDObjectObjects2.length = 0; + + +return !!eventsFunctionContext.returnValue; +} +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext = {}; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects2= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects2= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObstacleObjects1= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObstacleObjects2= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDParticleEmitterObjects1= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDParticleEmitterObjects2= []; + + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDExplosionObjects1Objects = Hashtable.newFrom({"Explosion": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDParticleEmitterObjects1Objects = Hashtable.newFrom({"ParticleEmitter": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDParticleEmitterObjects1}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDExplosionObjects1Objects = Hashtable.newFrom({"Explosion": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDObstacleObjects1Objects = Hashtable.newFrom({"Obstacle": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObstacleObjects1}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDParticleEmitterObjects1Objects = Hashtable.newFrom({"ParticleEmitter": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDParticleEmitterObjects1}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDExplosionObjects1Objects = Hashtable.newFrom({"Explosion": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDObstacleObjects1Objects = Hashtable.newFrom({"Obstacle": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObstacleObjects1}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDParticleEmitterObjects1Objects = Hashtable.newFrom({"ParticleEmitter": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDParticleEmitterObjects1}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDExplosionObjects1Objects = Hashtable.newFrom({"Explosion": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDObstacleObjects1Objects = Hashtable.newFrom({"Obstacle": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObstacleObjects1}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDParticleEmitterObjects1Objects = Hashtable.newFrom({"ParticleEmitter": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDParticleEmitterObjects1}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDExplosionObjects1Objects = Hashtable.newFrom({"Explosion": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDObstacleObjects1Objects = Hashtable.newFrom({"Obstacle": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObstacleObjects1}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDParticleEmitterObjects1Objects = Hashtable.newFrom({"ParticleEmitter": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDParticleEmitterObjects1}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + + +} + + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1.length = 0; + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDParticleEmitterObjects1.length = 0; + +{gdjs.evtTools.object.createObjectOnScene((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : runtimeScene), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDExplosionObjects1Objects, (( gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1[0].getX()), (( gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1[0].getY()), ""); +}{for(var i = 0, len = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1[i].setZOrder((gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1[i].getPointY("")) + 12); +} +}{for(var i = 0, len = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("ExplosionBehavior")).Inizialize(eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getPlayerId(), 0, 0, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}{gdjs.evtTools.object.createObjectOnScene((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : runtimeScene), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDParticleEmitterObjects1Objects, (( gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1[0].getCenterXInScene()), (( gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1[0].getCenterYInScene()), ""); +}{for(var i = 0, len = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1[i].hide(); +} +}} + +} + + +{ + + + +} + + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Explosion"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1); +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1); +gdjs.copyArray(eventsFunctionContext.getObjects("Obstacle"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObstacleObjects1); +gdjs.copyArray(eventsFunctionContext.getObjects("ParticleEmitter"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDParticleEmitterObjects1); +{for(var i = 0, len = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).CreateExplosionArm(gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDExplosionObjects1Objects, eventsFunctionContext.getBehaviorName("ExplosionBehavior"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDObstacleObjects1Objects, gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDParticleEmitterObjects1Objects, 0, 1, 0, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}{for(var i = 0, len = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).CreateExplosionArm(gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDExplosionObjects1Objects, eventsFunctionContext.getBehaviorName("ExplosionBehavior"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDObstacleObjects1Objects, gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDParticleEmitterObjects1Objects, 180, -(1), 0, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}{for(var i = 0, len = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).CreateExplosionArm(gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDExplosionObjects1Objects, eventsFunctionContext.getBehaviorName("ExplosionBehavior"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDObstacleObjects1Objects, gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDParticleEmitterObjects1Objects, 90, 0, 1, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}{for(var i = 0, len = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).CreateExplosionArm(gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDExplosionObjects1Objects, eventsFunctionContext.getBehaviorName("ExplosionBehavior"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDObstacleObjects1Objects, gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546ExplodeContext_9546GDParticleEmitterObjects1Objects, -(90), 0, -(1), (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1[i].deleteFromScene(runtimeScene); +} +}} + +} + + +}; + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.Explode = function(Explosion, ExplosionBehavior, Obstacle, ParticleEmitter, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +, "Explosion": Explosion +, "Obstacle": Obstacle +, "ParticleEmitter": ParticleEmitter +}, + _objectArraysMap: { +"Object": thisObjectList +, "Explosion": gdjs.objectsListsToArray(Explosion) +, "Obstacle": gdjs.objectsListsToArray(Obstacle) +, "ParticleEmitter": gdjs.objectsListsToArray(ParticleEmitter) +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "ExplosionBehavior": ExplosionBehavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Bomb"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Bomb"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects2.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObstacleObjects1.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObstacleObjects2.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDParticleEmitterObjects1.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDParticleEmitterObjects2.length = 0; + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects1.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDExplosionObjects2.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObstacleObjects1.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDObstacleObjects2.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDParticleEmitterObjects1.length = 0; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.ExplodeContext.GDParticleEmitterObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext = {}; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDObjectObjects1= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDObjectObjects2= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDObjectObjects3= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDObjectObjects4= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDObjectObjects5= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects1= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects2= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects3= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects4= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects5= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDObstacleObjects1= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDObstacleObjects2= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDObstacleObjects3= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDObstacleObjects4= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDObstacleObjects5= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDParticleEmitterObjects1= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDParticleEmitterObjects2= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDParticleEmitterObjects3= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDParticleEmitterObjects4= []; +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDParticleEmitterObjects5= []; + + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546CreateExplosionArmContext_9546GDExplosionObjects3Objects = Hashtable.newFrom({"Explosion": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects3}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546CreateExplosionArmContext_9546GDParticleEmitterObjects4Objects = Hashtable.newFrom({"ParticleEmitter": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDParticleEmitterObjects4}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546CreateExplosionArmContext_9546GDParticleEmitterObjects4Objects = Hashtable.newFrom({"ParticleEmitter": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDParticleEmitterObjects4}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546CreateExplosionArmContext_9546GDExplosionObjects3Objects = Hashtable.newFrom({"Explosion": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects3}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546CreateExplosionArmContext_9546GDObstacleObjects3Objects = Hashtable.newFrom({"Obstacle": gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDObstacleObjects3}); +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = !eventsFunctionContext.localVariables[0].getFromIndex(1).getAsBoolean(); +} +if (isConditionTrue_0) { +gdjs.copyArray(gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects3, gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects4); + +gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDParticleEmitterObjects4.length = 0; + +{gdjs.evtTools.object.createObjectOnScene((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : runtimeScene), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546CreateExplosionArmContext_9546GDParticleEmitterObjects4Objects, (( gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects4.length === 0 ) ? 0 :gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects4[0].getCenterXInScene()), (( gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects4.length === 0 ) ? 0 :gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects4[0].getCenterYInScene()), ""); +}{gdjs.evtTools.object.createObjectOnScene((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : runtimeScene), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546CreateExplosionArmContext_9546GDParticleEmitterObjects4Objects, (( gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects4.length === 0 ) ? 0 :gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects4[0].getCenterXInScene()) - eventsFunctionContext.getArgument("ExplosionDirectionX") * 30, (( gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects4.length === 0 ) ? 0 :gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects4[0].getCenterYInScene()) - eventsFunctionContext.getArgument("ExplosionDirectionY") * 30, ""); +}{for(var i = 0, len = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDParticleEmitterObjects4.length ;i < len;++i) { + gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDParticleEmitterObjects4[i].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).setZ(30); +} +}} + +} + + +{ + + + +} + + +{ + +/* Reuse gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects3 */ +gdjs.copyArray(eventsFunctionContext.getObjects("Obstacle"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDObstacleObjects3); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.object.hitBoxesCollisionTest(gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546CreateExplosionArmContext_9546GDExplosionObjects3Objects, gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595BombBehavior_9546BombBehavior_9546prototype_9546CreateExplosionArmContext_9546GDObstacleObjects3Objects, false, runtimeScene, false); +if (isConditionTrue_0) { +{eventsFunctionContext.localVariables[0].getFromIndex(0).setNumber(666); +}} + +} + + +};gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Explosion"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects3); +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDObjectObjects3); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Bomb__BombBehavior.BombBehavior.prototype.CreateExplosionArmContext.GDExplosionObjects3.length;i + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Bomb__ExplodeByChainReaction = {}; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.forEachIndex4 = 0; + +gdjs.evtsExt__Bomb__ExplodeByChainReaction.forEachObjects4 = []; + +gdjs.evtsExt__Bomb__ExplodeByChainReaction.forEachTemporary4 = null; + +gdjs.evtsExt__Bomb__ExplodeByChainReaction.forEachTotalCount4 = 0; + +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDBombObjects1= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDBombObjects2= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDBombObjects3= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDBombObjects4= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDExplosionObjects1= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDExplosionObjects2= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDExplosionObjects3= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDExplosionObjects4= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDObstacleObjects1= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDObstacleObjects2= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDObstacleObjects3= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDObstacleObjects4= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDParticleEmitterObjects1= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDParticleEmitterObjects2= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDParticleEmitterObjects3= []; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDParticleEmitterObjects4= []; + + +gdjs.evtsExt__Bomb__ExplodeByChainReaction.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595ExplodeByChainReaction_9546GDExplosionObjects4Objects = Hashtable.newFrom({"Explosion": gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDExplosionObjects4}); +gdjs.evtsExt__Bomb__ExplodeByChainReaction.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595ExplodeByChainReaction_9546GDBombObjects4Objects = Hashtable.newFrom({"Bomb": gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDBombObjects4}); +gdjs.evtsExt__Bomb__ExplodeByChainReaction.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595ExplodeByChainReaction_9546GDExplosionObjects4Objects = Hashtable.newFrom({"Explosion": gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDExplosionObjects4}); +gdjs.evtsExt__Bomb__ExplodeByChainReaction.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595ExplodeByChainReaction_9546GDExplosionObjects4Objects = Hashtable.newFrom({"Explosion": gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDExplosionObjects4}); +gdjs.evtsExt__Bomb__ExplodeByChainReaction.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595ExplodeByChainReaction_9546GDObstacleObjects4Objects = Hashtable.newFrom({"Obstacle": gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDObstacleObjects4}); +gdjs.evtsExt__Bomb__ExplodeByChainReaction.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595ExplodeByChainReaction_9546GDParticleEmitterObjects4Objects = Hashtable.newFrom({"ParticleEmitter": gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDParticleEmitterObjects4}); +gdjs.evtsExt__Bomb__ExplodeByChainReaction.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +};gdjs.evtsExt__Bomb__ExplodeByChainReaction.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + + + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Bomb"), gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDBombObjects3); + +for (gdjs.evtsExt__Bomb__ExplodeByChainReaction.forEachIndex4 = 0;gdjs.evtsExt__Bomb__ExplodeByChainReaction.forEachIndex4 < gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDBombObjects3.length;++gdjs.evtsExt__Bomb__ExplodeByChainReaction.forEachIndex4) { +gdjs.copyArray(eventsFunctionContext.getObjects("Explosion"), gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDExplosionObjects4); +gdjs.copyArray(eventsFunctionContext.getObjects("Obstacle"), gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDObstacleObjects4); +gdjs.copyArray(eventsFunctionContext.getObjects("ParticleEmitter"), gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDParticleEmitterObjects4); +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDBombObjects4.length = 0; + + +gdjs.evtsExt__Bomb__ExplodeByChainReaction.forEachTemporary4 = gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDBombObjects3[gdjs.evtsExt__Bomb__ExplodeByChainReaction.forEachIndex4]; +gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDBombObjects4.push(gdjs.evtsExt__Bomb__ExplodeByChainReaction.forEachTemporary4); +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.object.hitBoxesCollisionTest(gdjs.evtsExt__Bomb__ExplodeByChainReaction.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595ExplodeByChainReaction_9546GDExplosionObjects4Objects, gdjs.evtsExt__Bomb__ExplodeByChainReaction.mapOfGDgdjs_9546evtsExt_9595_9595Bomb_9595_9595ExplodeByChainReaction_9546GDBombObjects4Objects, false, runtimeScene, false); +if (isConditionTrue_0) { +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Bomb__ExplodeByChainReaction.GDBombObjects4.length;i 1 ) { + isConditionTrue_0 = true; + gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.doStepPreEventsContext.GDObjectObjects1[k] = gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.doStepPreEventsContext.GDObjectObjects1[i]; + ++k; + } +} +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.doStepPreEventsContext.GDObjectObjects1.length = k; +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.doStepPreEventsContext.GDObjectObjects1 */ +{for(var i = 0, len = gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.doStepPreEventsContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.doStepPreEventsContext.GDObjectObjects1[i].deleteFromScene(runtimeScene); +} +}} + +} + + +}; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.doStepPreEvents = function(parentEventsFunctionContext) { +this._onceTriggers.startNewFrame(); +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Bomb"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Bomb"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.doStepPreEventsContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.doStepPreEventsContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.doStepPreEventsContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.doStepPreEventsContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.doStepPreEventsContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreatedContext = {}; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreatedContext.GDObjectObjects1= []; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreatedContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreatedContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreatedContext.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreatedContext.GDObjectObjects1.length;i 0) ) { + isConditionTrue_0 = true; + gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreatedContext.GDObjectObjects1[k] = gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreatedContext.GDObjectObjects1[i]; + ++k; + } +} +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreatedContext.GDObjectObjects1.length = k; +if (isConditionTrue_0) { +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = true; }}} + +} + + +}; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreated = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Bomb"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Bomb"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreatedContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreatedContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.HasJustBeenCreatedContext.GDObjectObjects2.length = 0; + + +return !!eventsFunctionContext.returnValue; +} +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.PlayerIdContext = {}; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.PlayerIdContext.GDObjectObjects1= []; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.PlayerIdContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.PlayerIdContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getPlayerId(); }}} + +} + + +}; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.PlayerId = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Bomb"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Bomb"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.PlayerIdContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.PlayerIdContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.PlayerIdContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.PlayerIdContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.PlayerIdContext.GDObjectObjects2.length = 0; + + +return Number(eventsFunctionContext.returnValue) || 0; +} +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionXContext = {}; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionXContext.GDObjectObjects1= []; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionXContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionXContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getDirectionX(); }}} + +} + + +}; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionX = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Bomb"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Bomb"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionXContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionXContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionXContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionXContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionXContext.GDObjectObjects2.length = 0; + + +return Number(eventsFunctionContext.returnValue) || 0; +} +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionYContext = {}; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionYContext.GDObjectObjects1= []; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionYContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionYContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getDirectionY(); }}} + +} + + +}; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionY = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Bomb"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Bomb"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionYContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionYContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionYContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionYContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior.prototype.DirectionYContext.GDObjectObjects2.length = 0; + + +return Number(eventsFunctionContext.returnValue) || 0; +} + + +gdjs.registerBehavior("Bomb::ExplosionBehavior", gdjs.evtsExt__Bomb__ExplosionBehavior.ExplosionBehavior); diff --git a/gdjs-evtsext__bonus__bonusanimator.js b/gdjs-evtsext__bonus__bonusanimator.js new file mode 100644 index 0000000000000000000000000000000000000000..77643a9457125e81ca52380ec09aa4d9972e81f8 --- /dev/null +++ b/gdjs-evtsext__bonus__bonusanimator.js @@ -0,0 +1,404 @@ + +gdjs.evtsExt__Bonus__BonusAnimator = gdjs.evtsExt__Bonus__BonusAnimator || {}; + +/** + * Behavior generated from + */ +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator = class BonusAnimator extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.Tween3D = behaviorData.Tween3D !== undefined ? behaviorData.Tween3D : ""; + this._behaviorData.Tween = behaviorData.Tween !== undefined ? behaviorData.Tween : ""; + this._behaviorData.Shake3D = behaviorData.Shake3D !== undefined ? behaviorData.Shake3D : ""; + } + + // Hot-reload: + updateFromBehaviorData(oldBehaviorData, newBehaviorData) { + + if (oldBehaviorData.Tween3D !== newBehaviorData.Tween3D) + this._behaviorData.Tween3D = newBehaviorData.Tween3D; + if (oldBehaviorData.Tween !== newBehaviorData.Tween) + this._behaviorData.Tween = newBehaviorData.Tween; + if (oldBehaviorData.Shake3D !== newBehaviorData.Shake3D) + this._behaviorData.Shake3D = newBehaviorData.Shake3D; + + return true; + } + + // Network sync: + getNetworkSyncData() { + return { + ...super.getNetworkSyncData(), + props: { + + Tween3D: this._behaviorData.Tween3D, + Tween: this._behaviorData.Tween, + Shake3D: this._behaviorData.Shake3D, + } + }; + } + updateFromNetworkSyncData(networkSyncData) { + super.updateFromNetworkSyncData(networkSyncData); + + if (networkSyncData.props.Tween3D !== undefined) + this._behaviorData.Tween3D = networkSyncData.props.Tween3D; + if (networkSyncData.props.Tween !== undefined) + this._behaviorData.Tween = networkSyncData.props.Tween; + if (networkSyncData.props.Shake3D !== undefined) + this._behaviorData.Shake3D = networkSyncData.props.Shake3D; + } + + // Properties: + + _getTween3D() { + return this._behaviorData.Tween3D !== undefined ? this._behaviorData.Tween3D : ""; + } + _setTween3D(newValue) { + this._behaviorData.Tween3D = newValue; + } + _getTween() { + return this._behaviorData.Tween !== undefined ? this._behaviorData.Tween : ""; + } + _setTween(newValue) { + this._behaviorData.Tween = newValue; + } + _getShake3D() { + return this._behaviorData.Shake3D !== undefined ? this._behaviorData.Shake3D : ""; + } + _setShake3D(newValue) { + this._behaviorData.Shake3D = newValue; + } +} + +/** + * Shared data generated from + */ +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.SharedData = class BonusAnimatorSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._Bonus_BonusAnimatorSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._Bonus_BonusAnimatorSharedData = new gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.SharedData( + initialData + ); + } + return instanceContainer._Bonus_BonusAnimatorSharedData; +} + +// Methods: +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.onCreatedContext = {}; +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.onCreatedContext.GDObjectObjects1= []; +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.onCreatedContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.onCreatedContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.onCreatedContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.onCreatedContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.onCreatedContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).PlaySpawnAnimation((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +}; + +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.onCreated = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Tween3D": this._getTween3D() +, "Tween": this._getTween() +, "Shake3D": this._getShake3D() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Bonus"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Bonus"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.onCreatedContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.onCreatedContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.onCreatedContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext = {}; +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1= []; +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.asyncCallback17704604 = function (runtimeScene, eventsFunctionContext, asyncObjectsList) { +asyncObjectsList.restoreLocalVariablesContainers(eventsFunctionContext.localVariables); +gdjs.copyArray(asyncObjectsList.getObjects("Object"), gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects2); + +{for(var i = 0, len = gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects2[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween")).addObjectPositionZTween2(eventsFunctionContext.getBehaviorName("Object3D"), "Jump", 20, "easeOutBounce", 1, false); +} +}eventsFunctionContext.localVariables.length = 0; +} +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +{ +{ +const asyncObjectsList = new gdjs.LongLivedObjectsList(); +asyncObjectsList.backupLocalVariablesContainers(eventsFunctionContext.localVariables); +for (const obj of gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1) asyncObjectsList.addObject("Object", obj); +runtimeScene.getAsyncTasksManager().addTask(gdjs.evtTools.runtimeScene.wait(0.5), (runtimeScene) => (gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.asyncCallback17704604(runtimeScene, eventsFunctionContext, asyncObjectsList))); +} +} + +} + + +};gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.asyncCallback17707452 = function (runtimeScene, eventsFunctionContext, asyncObjectsList) { +asyncObjectsList.restoreLocalVariablesContainers(eventsFunctionContext.localVariables); +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects2); +{for(var i = 0, len = gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects2[i].getBehavior(eventsFunctionContext.getBehaviorName("Shake3D")).Shake(0.75, 0, 0.25, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}eventsFunctionContext.localVariables.length = 0; +} +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + + +{ +{ +const asyncObjectsList = new gdjs.LongLivedObjectsList(); +asyncObjectsList.backupLocalVariablesContainers(eventsFunctionContext.localVariables); +runtimeScene.getAsyncTasksManager().addTask(gdjs.evtTools.runtimeScene.wait(0.75), (runtimeScene) => (gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.asyncCallback17707452(runtimeScene, eventsFunctionContext, asyncObjectsList))); +} +} + +} + + +};gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.eventsList2 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween")).addObjectPositionZTween2(eventsFunctionContext.getBehaviorName("Object3D"), "Jump", 120, "easeOutQuad", 0.5, false); +} +} +{ //Subevents +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.eventsList0(runtimeScene, eventsFunctionContext);} //End of subevents +} + +} + + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1[i].setAngle(-(180)); +} +}{for(var i = 0, len = gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween")).addObjectAngleTween2("RotationZ", 0, "easeOutQuad", 1, false); +} +}{for(var i = 0, len = gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).setRotationX(-(160)); +} +}{for(var i = 0, len = gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween3D")).TweenRotationX("ToBillboard", -(20), 1, "easeOutQuad", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}{for(var i = 0, len = gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).setRotationY(-(90)); +} +}{for(var i = 0, len = gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween3D")).TweenRotationY("RotationY", 0, 1, "easeOutQuad", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +{ + + +let isConditionTrue_0 = false; +{ + +{ //Subevents +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.eventsList1(runtimeScene, eventsFunctionContext);} //End of subevents +} + +} + + +}; + +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimation = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Tween3D": this._getTween3D() +, "Tween": this._getTween() +, "Shake3D": this._getShake3D() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Bonus"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Bonus"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.eventsList2(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.PlaySpawnAnimationContext.GDObjectObjects2.length = 0; + + +return; +} + +gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator.prototype.doStepPreEvents = function() { + this._onceTriggers.startNewFrame(); +}; + + +gdjs.registerBehavior("Bonus::BonusAnimator", gdjs.evtsExt__Bonus__BonusAnimator.BonusAnimator); diff --git a/gdjs-evtsext__buttonstates__buttonfsm.js b/gdjs-evtsext__buttonstates__buttonfsm.js new file mode 100644 index 0000000000000000000000000000000000000000..b3af86c17b0980506391dc54388ad6470533d4fe --- /dev/null +++ b/gdjs-evtsext__buttonstates__buttonfsm.js @@ -0,0 +1,1721 @@ + +gdjs.evtsExt__ButtonStates__ButtonFSM = gdjs.evtsExt__ButtonStates__ButtonFSM || {}; + +/** + * Behavior generated from Button states + */ +gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM = class ButtonFSM extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.ShouldCheckHovering = true; + this._behaviorData.State = "Idle"; + this._behaviorData.TouchId = Number("0") || 0; + this._behaviorData.TouchIsInside = false; + this._behaviorData.MouseIsInside = false; + this._behaviorData.Index = Number("") || 0; + } + + // Hot-reload: + updateFromBehaviorData(oldBehaviorData, newBehaviorData) { + + if (oldBehaviorData.ShouldCheckHovering !== newBehaviorData.ShouldCheckHovering) + this._behaviorData.ShouldCheckHovering = newBehaviorData.ShouldCheckHovering; + if (oldBehaviorData.State !== newBehaviorData.State) + this._behaviorData.State = newBehaviorData.State; + if (oldBehaviorData.TouchId !== newBehaviorData.TouchId) + this._behaviorData.TouchId = newBehaviorData.TouchId; + if (oldBehaviorData.TouchIsInside !== newBehaviorData.TouchIsInside) + this._behaviorData.TouchIsInside = newBehaviorData.TouchIsInside; + if (oldBehaviorData.MouseIsInside !== newBehaviorData.MouseIsInside) + this._behaviorData.MouseIsInside = newBehaviorData.MouseIsInside; + if (oldBehaviorData.Index !== newBehaviorData.Index) + this._behaviorData.Index = newBehaviorData.Index; + + return true; + } + + // Network sync: + getNetworkSyncData() { + return { + ...super.getNetworkSyncData(), + props: { + + ShouldCheckHovering: this._behaviorData.ShouldCheckHovering, + State: this._behaviorData.State, + TouchId: this._behaviorData.TouchId, + TouchIsInside: this._behaviorData.TouchIsInside, + MouseIsInside: this._behaviorData.MouseIsInside, + Index: this._behaviorData.Index, + } + }; + } + updateFromNetworkSyncData(networkSyncData) { + super.updateFromNetworkSyncData(networkSyncData); + + if (networkSyncData.props.ShouldCheckHovering !== undefined) + this._behaviorData.ShouldCheckHovering = networkSyncData.props.ShouldCheckHovering; + if (networkSyncData.props.State !== undefined) + this._behaviorData.State = networkSyncData.props.State; + if (networkSyncData.props.TouchId !== undefined) + this._behaviorData.TouchId = networkSyncData.props.TouchId; + if (networkSyncData.props.TouchIsInside !== undefined) + this._behaviorData.TouchIsInside = networkSyncData.props.TouchIsInside; + if (networkSyncData.props.MouseIsInside !== undefined) + this._behaviorData.MouseIsInside = networkSyncData.props.MouseIsInside; + if (networkSyncData.props.Index !== undefined) + this._behaviorData.Index = networkSyncData.props.Index; + } + + // Properties: + + _getShouldCheckHovering() { + return this._behaviorData.ShouldCheckHovering !== undefined ? this._behaviorData.ShouldCheckHovering : true; + } + _setShouldCheckHovering(newValue) { + this._behaviorData.ShouldCheckHovering = newValue; + } + _toggleShouldCheckHovering() { + this._setShouldCheckHovering(!this._getShouldCheckHovering()); + } + _getState() { + return this._behaviorData.State !== undefined ? this._behaviorData.State : "Idle"; + } + _setState(newValue) { + this._behaviorData.State = newValue; + } + _getTouchId() { + return this._behaviorData.TouchId !== undefined ? this._behaviorData.TouchId : Number("0") || 0; + } + _setTouchId(newValue) { + this._behaviorData.TouchId = newValue; + } + _getTouchIsInside() { + return this._behaviorData.TouchIsInside !== undefined ? this._behaviorData.TouchIsInside : false; + } + _setTouchIsInside(newValue) { + this._behaviorData.TouchIsInside = newValue; + } + _toggleTouchIsInside() { + this._setTouchIsInside(!this._getTouchIsInside()); + } + _getMouseIsInside() { + return this._behaviorData.MouseIsInside !== undefined ? this._behaviorData.MouseIsInside : false; + } + _setMouseIsInside(newValue) { + this._behaviorData.MouseIsInside = newValue; + } + _toggleMouseIsInside() { + this._setMouseIsInside(!this._getMouseIsInside()); + } + _getIndex() { + return this._behaviorData.Index !== undefined ? this._behaviorData.Index : Number("") || 0; + } + _setIndex(newValue) { + this._behaviorData.Index = newValue; + } +} + +/** + * Shared data generated from Button states + */ +gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.SharedData = class ButtonFSMSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._ButtonStates_ButtonFSMSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._ButtonStates_ButtonFSMSharedData = new gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.SharedData( + initialData + ); + } + return instanceContainer._ButtonStates_ButtonFSMSharedData; +} + +// Methods: +gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext = {}; +gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects4_1final = []; + +gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects1= []; +gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects2= []; +gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects3= []; +gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects4= []; +gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects5= []; + + +gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + + +} + + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects3); +{for(var i = 0, len = gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects3.length ;i < len;++i) { + gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects3[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setMouseIsInside(false); +} +}} + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects3); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__ButtonStates__ButtonFSM.ButtonFSM.prototype.doStepPostEventsContext.GDObjectObjects3.length;i= (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Duration")) || 0 : 0) ) { + isConditionTrue_0 = true; + gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1[k] = gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1[i]; + ++k; + } +} +gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1.length = k; +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1 */ +{for(var i = 0, len = gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setTweenState("NoTween"); +} +}{for(var i = 0, len = gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setEffectValue((gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getTweenTargetedValue())); +} +}} + +} + + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Effect")).setEffectDoubleParameter((gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getEffectName()), (gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getEffectProperty()), (gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getEffectValue())); +} +}} + +} + + +}; + +gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTween = function(Duration, Easing, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "ButtonFSM": this._getButtonFSM() +, "Effect": this._getEffect() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ButtonStates"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ButtonStates"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Duration") return Duration; +if (argName === "Easing") return Easing; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween.prototype.PlayTweenContext.GDObjectObjects2.length = 0; + + +return; +} + + +gdjs.registerBehavior("ButtonStates::ButtonObjectEffectTween", gdjs.evtsExt__ButtonStates__ButtonObjectEffectTween.ButtonObjectEffectTween); diff --git a/gdjs-evtsext__flash__colortint-func.js b/gdjs-evtsext__flash__colortint-func.js new file mode 100644 index 0000000000000000000000000000000000000000..6b280092ef87ce0f431d490a6b15626e424106bc --- /dev/null +++ b/gdjs-evtsext__flash__colortint-func.js @@ -0,0 +1,105 @@ + +if (typeof gdjs.evtsExt__Flash__ColorTint !== "undefined") { + gdjs.evtsExt__Flash__ColorTint.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Flash__ColorTint = {}; +gdjs.evtsExt__Flash__ColorTint.GDObjectObjects1= []; + + +gdjs.evtsExt__Flash__ColorTint.userFunc0x8c2040 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +/** @type {gdjs.SpriteRuntimeObject} */ +const tintedObject = objects[0]; +const tint = tintedObject.getColor(); +eventsFunctionContext.returnValue = tint; +}; +gdjs.evtsExt__Flash__ColorTint.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Flash__ColorTint.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__Flash__ColorTint.GDObjectObjects1); +gdjs.evtsExt__Flash__ColorTint.userFunc0x8c2040(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Flash__ColorTint.func = function(runtimeScene, Object, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": gdjs.objectsListsToArray(Object) +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Flash"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Flash"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + +gdjs.evtsExt__Flash__ColorTint.GDObjectObjects1.length = 0; + +gdjs.evtsExt__Flash__ColorTint.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Flash__ColorTint.GDObjectObjects1.length = 0; + + +return "" + eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__Flash__ColorTint.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__flash__flash.js b/gdjs-evtsext__flash__flash.js new file mode 100644 index 0000000000000000000000000000000000000000..bac05be76fc2967b99a180097238c1d9ff5de1f7 --- /dev/null +++ b/gdjs-evtsext__flash__flash.js @@ -0,0 +1,937 @@ + +gdjs.evtsExt__Flash__Flash = gdjs.evtsExt__Flash__Flash || {}; + +/** + * Behavior generated from Flash visibility (blink) + */ +gdjs.evtsExt__Flash__Flash.Flash = class Flash extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__Flash__Flash.Flash.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.HalfPeriodTime = behaviorData.HalfPeriodTime !== undefined ? behaviorData.HalfPeriodTime : Number("0.1") || 0; + this._behaviorData.IsFlashing = false; + this._behaviorData.FlashDuration = Number("0") || 0; + } + + // Hot-reload: + updateFromBehaviorData(oldBehaviorData, newBehaviorData) { + + if (oldBehaviorData.HalfPeriodTime !== newBehaviorData.HalfPeriodTime) + this._behaviorData.HalfPeriodTime = newBehaviorData.HalfPeriodTime; + if (oldBehaviorData.IsFlashing !== newBehaviorData.IsFlashing) + this._behaviorData.IsFlashing = newBehaviorData.IsFlashing; + if (oldBehaviorData.FlashDuration !== newBehaviorData.FlashDuration) + this._behaviorData.FlashDuration = newBehaviorData.FlashDuration; + + return true; + } + + // Network sync: + getNetworkSyncData() { + return { + ...super.getNetworkSyncData(), + props: { + + HalfPeriodTime: this._behaviorData.HalfPeriodTime, + IsFlashing: this._behaviorData.IsFlashing, + FlashDuration: this._behaviorData.FlashDuration, + } + }; + } + updateFromNetworkSyncData(networkSyncData) { + super.updateFromNetworkSyncData(networkSyncData); + + if (networkSyncData.props.HalfPeriodTime !== undefined) + this._behaviorData.HalfPeriodTime = networkSyncData.props.HalfPeriodTime; + if (networkSyncData.props.IsFlashing !== undefined) + this._behaviorData.IsFlashing = networkSyncData.props.IsFlashing; + if (networkSyncData.props.FlashDuration !== undefined) + this._behaviorData.FlashDuration = networkSyncData.props.FlashDuration; + } + + // Properties: + + _getHalfPeriodTime() { + return this._behaviorData.HalfPeriodTime !== undefined ? this._behaviorData.HalfPeriodTime : Number("0.1") || 0; + } + _setHalfPeriodTime(newValue) { + this._behaviorData.HalfPeriodTime = newValue; + } + _getIsFlashing() { + return this._behaviorData.IsFlashing !== undefined ? this._behaviorData.IsFlashing : false; + } + _setIsFlashing(newValue) { + this._behaviorData.IsFlashing = newValue; + } + _toggleIsFlashing() { + this._setIsFlashing(!this._getIsFlashing()); + } + _getFlashDuration() { + return this._behaviorData.FlashDuration !== undefined ? this._behaviorData.FlashDuration : Number("0") || 0; + } + _setFlashDuration(newValue) { + this._behaviorData.FlashDuration = newValue; + } +} + +/** + * Shared data generated from Flash visibility (blink) + */ +gdjs.evtsExt__Flash__Flash.Flash.SharedData = class FlashSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__Flash__Flash.Flash.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._Flash_FlashSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._Flash_FlashSharedData = new gdjs.evtsExt__Flash__Flash.Flash.SharedData( + initialData + ); + } + return instanceContainer._Flash_FlashSharedData; +} + +// Methods: +gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext = {}; +gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1= []; +gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects2= []; +gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects3= []; + + +gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.mapOfGDgdjs_9546evtsExt_9595_9595Flash_9595_9595Flash_9546Flash_9546prototype_9546doStepPreEventsContext_9546GDObjectObjects2Objects = Hashtable.newFrom({"Object": gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects2}); +gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1, gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects2); + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects2.length;i (gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects2[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getHalfPeriodTime()) ) { + isConditionTrue_0 = true; + gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects2[k] = gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects2[i]; + ++k; + } +} +gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects2.length = k; +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects2 */ +{gdjs.evtsExt__Flash__ToggleVisibility.func(runtimeScene, gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.mapOfGDgdjs_9546evtsExt_9595_9595Flash_9595_9595Flash_9546Flash_9546prototype_9546doStepPreEventsContext_9546GDObjectObjects2Objects, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +}{for(var i = 0, len = gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects2[i].resetTimer("Flash_Visibility_Timer"); +} +}} + +} + + +};gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + +/* Reuse gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1 */ + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1.length;i 0 ) { + isConditionTrue_0 = true; + gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1[k] = gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1[i]; + ++k; + } +} +gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1.length = k; +if (isConditionTrue_0) { +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1.length;i (gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getFlashDuration()) ) { + isConditionTrue_0 = true; + gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1[k] = gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1[i]; + ++k; + } +} +gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1.length = k; +} +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1 */ +{for(var i = 0, len = gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).Stop((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +};gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.eventsList2 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.eventsList0(runtimeScene, eventsFunctionContext); +} + + +{ + + +gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.eventsList1(runtimeScene, eventsFunctionContext); +} + + +};gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.eventsList3 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Flash__Flash.Flash.prototype.doStepPreEventsContext.GDObjectObjects1.length;i + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Flash__IsTinted = {}; +gdjs.evtsExt__Flash__IsTinted.GDObjectObjects1= []; +gdjs.evtsExt__Flash__IsTinted.GDObjectObjects2= []; + + +gdjs.evtsExt__Flash__IsTinted.mapOfGDgdjs_9546evtsExt_9595_9595Flash_9595_9595IsTinted_9546GDObjectObjects1Objects = Hashtable.newFrom({"Object": gdjs.evtsExt__Flash__IsTinted.GDObjectObjects1}); +gdjs.evtsExt__Flash__IsTinted.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Flash__IsTinted.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = !(gdjs.evtsExt__Flash__ColorTint.func(runtimeScene, gdjs.evtsExt__Flash__IsTinted.mapOfGDgdjs_9546evtsExt_9595_9595Flash_9595_9595IsTinted_9546GDObjectObjects1Objects, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)) == "255;255;255"); +if (isConditionTrue_0) { +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = true; }}} + +} + + +}; + +gdjs.evtsExt__Flash__IsTinted.func = function(runtimeScene, Object, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": gdjs.objectsListsToArray(Object) +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Flash"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Flash"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + +gdjs.evtsExt__Flash__IsTinted.GDObjectObjects1.length = 0; +gdjs.evtsExt__Flash__IsTinted.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Flash__IsTinted.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Flash__IsTinted.GDObjectObjects1.length = 0; +gdjs.evtsExt__Flash__IsTinted.GDObjectObjects2.length = 0; + + +return "" + eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__Flash__IsTinted.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__flash__togglecolortint-func.js b/gdjs-evtsext__flash__togglecolortint-func.js new file mode 100644 index 0000000000000000000000000000000000000000..86e696a041765195c8646a964771e07a24c7cb07 --- /dev/null +++ b/gdjs-evtsext__flash__togglecolortint-func.js @@ -0,0 +1,169 @@ + +if (typeof gdjs.evtsExt__Flash__ToggleColorTint !== "undefined") { + gdjs.evtsExt__Flash__ToggleColorTint.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Flash__ToggleColorTint = {}; +gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects1= []; +gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2= []; +gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects3= []; + + +gdjs.evtsExt__Flash__ToggleColorTint.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +};gdjs.evtsExt__Flash__ToggleColorTint.mapOfGDgdjs_9546evtsExt_9595_9595Flash_9595_9595ToggleColorTint_9546GDObjectObjects2Objects = Hashtable.newFrom({"Object": gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2}); +gdjs.evtsExt__Flash__ToggleColorTint.mapOfGDgdjs_9546evtsExt_9595_9595Flash_9595_9595ToggleColorTint_9546GDObjectObjects1Objects = Hashtable.newFrom({"Object": gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects1}); +gdjs.evtsExt__Flash__ToggleColorTint.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2); +{for(var i = 0, len = gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2[i].setVariableBoolean(gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2[i].getVariables().get("__Flash_ColorTintToggled"), false); +} +}} + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtsExt__Flash__ColorTint.func(runtimeScene, gdjs.evtsExt__Flash__ToggleColorTint.mapOfGDgdjs_9546evtsExt_9595_9595Flash_9595_9595ToggleColorTint_9546GDObjectObjects2Objects, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)) == (gdjs.RuntimeObject.getVariableString(((gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2.length === 0 ) ? gdjs.VariablesContainer.badVariablesContainer : gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2[0].getVariables()).get("__FlashColor_StartingTint"))); +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2 */ +{for(var i = 0, len = gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2[i].setColor((typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("ColorTint") : "")); +} +}{for(var i = 0, len = gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2[i].setVariableBoolean(gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects2[i].getVariables().get("__Flash_ColorTintToggled"), true); +} +}} + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Flash__ToggleColorTint.GDObjectObjects1.length;i + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Flash__ToggleEffect = {}; +gdjs.evtsExt__Flash__ToggleEffect.GDObjectObjects1= []; +gdjs.evtsExt__Flash__ToggleEffect.GDObjectObjects2= []; + + +gdjs.evtsExt__Flash__ToggleEffect.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Flash__ToggleEffect.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Flash__ToggleEffect.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Flash__ToggleEffect.GDObjectObjects1[i].setVariableBoolean(gdjs.evtsExt__Flash__ToggleEffect.GDObjectObjects1[i].getVariables().get("__Flash_EffectToggled"), false); +} +}} + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Flash__ToggleEffect.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Flash__ToggleEffect.GDObjectObjects1.length;i + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Flash__ToggleVisibility = {}; +gdjs.evtsExt__Flash__ToggleVisibility.GDObjectObjects1= []; +gdjs.evtsExt__Flash__ToggleVisibility.GDObjectObjects2= []; + + +gdjs.evtsExt__Flash__ToggleVisibility.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Flash__ToggleVisibility.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Flash__ToggleVisibility.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Flash__ToggleVisibility.GDObjectObjects1[i].setVariableBoolean(gdjs.evtsExt__Flash__ToggleVisibility.GDObjectObjects1[i].getVariables().get("__Flash_VisibilityToggled"), false); +} +}} + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Flash__ToggleVisibility.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Flash__ToggleVisibility.GDObjectObjects1.length;i + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__A_Advanced_Vibration_Controller = {}; + + +gdjs.evtsExt__Gamepads__A_Advanced_Vibration_Controller.userFunc0xf51580 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +//Vibration work only on game in browser. +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("Player_ID") - 1; +const duration = eventsFunctionContext.getArgument("Duration") || 1; +const strongRumbleMagnitude = eventsFunctionContext.getArgument("StrongMagnitude"); +const weakRumbleMagnitude = eventsFunctionContext.getArgument("WeakMagnitude"); + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in action: "Advanced gamepad vibration", is not valid number, must be between 0 and 4.'); + return; +} +if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) { + console.error('Parameter weakRumble identifier in action: "Advanced gamepad vibration", is not valid number, must be between 0 and 1.'); + return; +} +if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) { + console.error('Parameter strongRumble identifier in action: "Advanced gamepad vibration", is not valid number, must be between 0 and 1.'); + return; +} + +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + +if (gamepad && gamepad.vibrationActuator) { + gamepad.vibrationActuator.playEffect("dual-rumble", { + startDelay: 0, + duration: duration * 1000, + weakMagnitude: weakRumbleMagnitude, + strongMagnitude: strongRumbleMagnitude + }); +} + +gdjs._extensionController.players[playerId].rumble.duration = duration; +gdjs._extensionController.players[playerId].rumble.elapsedTime = 0; +gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude; +gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude; +}; +gdjs.evtsExt__Gamepads__A_Advanced_Vibration_Controller.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__A_Advanced_Vibration_Controller.userFunc0xf51580(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__A_Advanced_Vibration_Controller.func = function(runtimeScene, Player_ID, Duration, StrongMagnitude, WeakMagnitude, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Player_ID") return Player_ID; +if (argName === "Duration") return Duration; +if (argName === "StrongMagnitude") return StrongMagnitude; +if (argName === "WeakMagnitude") return WeakMagnitude; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__A_Advanced_Vibration_Controller.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__Gamepads__A_Advanced_Vibration_Controller.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__a_change_vibration_magnitude-func.js b/gdjs-evtsext__gamepads__a_change_vibration_magnitude-func.js new file mode 100644 index 0000000000000000000000000000000000000000..3a51e8e41fca129d280ab73f3316ce447628b8f6 --- /dev/null +++ b/gdjs-evtsext__gamepads__a_change_vibration_magnitude-func.js @@ -0,0 +1,132 @@ + +if (typeof gdjs.evtsExt__Gamepads__A_Change_Vibration_Magnitude !== "undefined") { + gdjs.evtsExt__Gamepads__A_Change_Vibration_Magnitude.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__A_Change_Vibration_Magnitude = {}; + + +gdjs.evtsExt__Gamepads__A_Change_Vibration_Magnitude.userFunc0xf51580 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +//Vibration work only on game in browser. +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("Player_ID") - 1; +const elapsedTime = gdjs._extensionController.players[playerId].rumble.elapsedTime || 0; +const originalDuration = gdjs._extensionController.players[playerId].rumble.duration || 1; +const strongRumbleMagnitude = eventsFunctionContext.getArgument("StrongMagnitude"); +const weakRumbleMagnitude = eventsFunctionContext.getArgument("WeakMagnitude"); + + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in action: "Change gamepad active vibration", is not valid number, must be between 0 and 4.'); + return; +} +if (weakRumbleMagnitude < 0 || weakRumbleMagnitude > 1) { + console.error('Parameter weakRumble identifier in action: "Change gamepad active vibration", is not valid number, must be between 0 and 1.'); + return; +} +if (strongRumbleMagnitude < 0 || strongRumbleMagnitude > 1) { + console.error('Parameter strongRumble identifier in action: "Change gamepad active vibration", is not valid number, must be between 0 and 1.'); + return; +} + +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug the controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + +if (originalDuration - elapsedTime <= 0) return; + +if (gamepad && gamepad.vibrationActuator) { + gamepad.vibrationActuator.playEffect("dual-rumble", { + startDelay: 0, + duration: 1000 * (originalDuration - elapsedTime), + weakMagnitude: weakRumbleMagnitude, + strongMagnitude: strongRumbleMagnitude + }); +} + +gdjs._extensionController.players[playerId].rumble.weakMagnitude = weakRumbleMagnitude; +gdjs._extensionController.players[playerId].rumble.strongMagnitude = strongRumbleMagnitude; +}; +gdjs.evtsExt__Gamepads__A_Change_Vibration_Magnitude.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__A_Change_Vibration_Magnitude.userFunc0xf51580(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__A_Change_Vibration_Magnitude.func = function(runtimeScene, Player_ID, StrongMagnitude, WeakMagnitude, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Player_ID") return Player_ID; +if (argName === "StrongMagnitude") return StrongMagnitude; +if (argName === "WeakMagnitude") return WeakMagnitude; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__A_Change_Vibration_Magnitude.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__Gamepads__A_Change_Vibration_Magnitude.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__a_set_deadzone-func.js b/gdjs-evtsext__gamepads__a_set_deadzone-func.js new file mode 100644 index 0000000000000000000000000000000000000000..57f580234b316e773adc62820db0504847037db9 --- /dev/null +++ b/gdjs-evtsext__gamepads__a_set_deadzone-func.js @@ -0,0 +1,101 @@ + +if (typeof gdjs.evtsExt__Gamepads__A_Set_deadzone !== "undefined") { + gdjs.evtsExt__Gamepads__A_Set_deadzone.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__A_Set_deadzone = {}; + + +gdjs.evtsExt__Gamepads__A_Set_deadzone.userFunc0xef9db8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +//Get function parameter +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; +const newDeadzone = eventsFunctionContext.getArgument("deadzone"); + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in action: "Set gamepad deadzone for sticks", is not valid, must be between 0 and 4.'); + return; +} + +// clamp the newDeadzone in range [0, 1]. +// https://github.com/4ian/GDevelop-extensions/pull/33#issuecomment-618224857 +gdjs._extensionController.players[playerId].deadzone = gdjs.evtTools.common.clamp(newDeadzone, 0, 1); + +}; +gdjs.evtsExt__Gamepads__A_Set_deadzone.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__A_Set_deadzone.userFunc0xef9db8(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__A_Set_deadzone.func = function(runtimeScene, player_ID, deadzone, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; +if (argName === "deadzone") return deadzone; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__A_Set_deadzone.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__Gamepads__A_Set_deadzone.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__a_vibrate_controller-func.js b/gdjs-evtsext__gamepads__a_vibrate_controller-func.js new file mode 100644 index 0000000000000000000000000000000000000000..64266ce7d5229a8a8b7fc53791f547099e4f6d92 --- /dev/null +++ b/gdjs-evtsext__gamepads__a_vibrate_controller-func.js @@ -0,0 +1,114 @@ + +if (typeof gdjs.evtsExt__Gamepads__A_Vibrate_controller !== "undefined") { + gdjs.evtsExt__Gamepads__A_Vibrate_controller.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__A_Vibrate_controller = {}; + + +gdjs.evtsExt__Gamepads__A_Vibrate_controller.userFunc0xd8a7b8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +//Vibration work only on game in browser. +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("Player_ID") - 1; +const duration = eventsFunctionContext.getArgument("Duration") || 1; + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in action: "Gamepad connected", is not valid number, must be between 0 and 4.'); + return; +} + +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + +if (gamepad && gamepad.vibrationActuator) { + gamepad.vibrationActuator.playEffect("dual-rumble", { + startDelay: 0, + duration: duration * 1000, + weakMagnitude: 1.0, + strongMagnitude: 1.0 + }); +} +}; +gdjs.evtsExt__Gamepads__A_Vibrate_controller.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__A_Vibrate_controller.userFunc0xd8a7b8(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__A_Vibrate_controller.func = function(runtimeScene, Player_ID, Duration, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Player_ID") return Player_ID; +if (argName === "Duration") return Duration; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__A_Vibrate_controller.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__Gamepads__A_Vibrate_controller.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__axisvalue-func.js b/gdjs-evtsext__gamepads__axisvalue-func.js new file mode 100644 index 0000000000000000000000000000000000000000..1cba459658e7bc4ca17ec09af81128b77b1e6ba8 --- /dev/null +++ b/gdjs-evtsext__gamepads__axisvalue-func.js @@ -0,0 +1,198 @@ + +if (typeof gdjs.evtsExt__Gamepads__AxisValue !== "undefined") { + gdjs.evtsExt__Gamepads__AxisValue.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__AxisValue = {}; + + +gdjs.evtsExt__Gamepads__AxisValue.userFunc0xd1c978 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; +const stick = eventsFunctionContext.getArgument("stick").toUpperCase(); +const direction = eventsFunctionContext.getArgument("direction").toUpperCase(); + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier is not valid in expression: "Value of a gamepad axis"'); + return; +} +if (stick != "LEFT" && stick != "RIGHT") { + console.error('Parameter stick is not valid in expression: "Value of a gamepad axis"'); + return; +} +if (direction != "UP" && direction != "DOWN" && direction != "LEFT" && direction != "RIGHT" && direction != "HORIZONTAL" && direction != "VERTICAL") { + console.error('Parameter direction is not valid in expression: "Value of a gamepad axis"'); + return; +} +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + +let parameterError = false; +switch (stick) { + case 'LEFT': + switch (direction) { + case 'LEFT': + if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId) < 0) { + eventsFunctionContext.returnValue = -gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId); + } + break; + + case 'RIGHT': + if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId) > 0) { + eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId); + } + break; + + case 'UP': + if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId) < 0) { + eventsFunctionContext.returnValue = -gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId); + } + break; + + case 'DOWN': + if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) { + eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId); + } + break; + + case "HORIZONTAL": + eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId); + break; + + case "VERTICAL": + eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId); + break; + + default: + break; + } + break; + + case 'RIGHT': + switch (direction) { + case 'LEFT': + if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId) < 0) { + eventsFunctionContext.returnValue = -gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId); + } + break; + + case 'RIGHT': + if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId) > 0) { + eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId); + } + break; + + case 'UP': + if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId) < 0) { + eventsFunctionContext.returnValue = -gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId); + } + break; + + case 'DOWN': + if (gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) { + eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId); + } + break; + + case "HORIZONTAL": + eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId); + break; + + case "VERTICAL": + eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId); + break; + + default: + break; + } + break; + + default: + break; +} + +}; +gdjs.evtsExt__Gamepads__AxisValue.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__AxisValue.userFunc0xd1c978(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__AxisValue.func = function(runtimeScene, player_ID, stick, direction, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; +if (argName === "stick") return stick; +if (argName === "direction") return direction; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__AxisValue.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Gamepads__AxisValue.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__c_any_button_pressed-func.js b/gdjs-evtsext__gamepads__c_any_button_pressed-func.js new file mode 100644 index 0000000000000000000000000000000000000000..40c5a29b8b0ac65d40f8dc6de77e1b239c2b12b1 --- /dev/null +++ b/gdjs-evtsext__gamepads__c_any_button_pressed-func.js @@ -0,0 +1,128 @@ + +if (typeof gdjs.evtsExt__Gamepads__C_Any_Button_pressed !== "undefined") { + gdjs.evtsExt__Gamepads__C_Any_Button_pressed.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__C_Any_Button_pressed = {}; + + +gdjs.evtsExt__Gamepads__C_Any_Button_pressed.userFunc0xf40ba0 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameter +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in condition: "Any gamepad button pressed", is not valid number, must be between 0 and 4.'); + return; +} +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + +let buttonId; +for (let i = 0; i < gamepad.buttons.length; i++) { //For each buttons + if (gamepad.buttons[i].pressed) { //One of them is pressed + buttonId = i; //Save the button pressed + break; + } +} + +if (buttonId === undefined) { + // No buttons are pressed. + eventsFunctionContext.returnValue = false; + return; +} + +if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) { + console.error('Buttons on the gamepad are not accessible in condition: "Any gamepad button pressed"'); + eventsFunctionContext.returnValue = false; + return; +} + +//When a button is pressed, save the button in lastButtonUsed for each players +if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId; +eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed; + + + +}; +gdjs.evtsExt__Gamepads__C_Any_Button_pressed.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__C_Any_Button_pressed.userFunc0xf40ba0(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__C_Any_Button_pressed.func = function(runtimeScene, player_ID, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__C_Any_Button_pressed.eventsList0(runtimeScene, eventsFunctionContext); + + +return !!eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__Gamepads__C_Any_Button_pressed.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__c_any_button_released-func.js b/gdjs-evtsext__gamepads__c_any_button_released-func.js new file mode 100644 index 0000000000000000000000000000000000000000..769eb77c6a25115d064d7a46d1f7f586bc29dbce --- /dev/null +++ b/gdjs-evtsext__gamepads__c_any_button_released-func.js @@ -0,0 +1,145 @@ + +if (typeof gdjs.evtsExt__Gamepads__C_any_button_released !== "undefined") { + gdjs.evtsExt__Gamepads__C_any_button_released.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__C_any_button_released = {}; + + +gdjs.evtsExt__Gamepads__C_any_button_released.userFunc0xd8a7b8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in condition: "Any gamepad button released", is not valid number, must be between 0 and 4.'); + return; +} + +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + +for (let buttonId = 0; buttonId < gamepad.buttons.length; buttonId++) { //For each buttons on current frame. + + if (buttonId === undefined) { + eventsFunctionContext.returnValue = false; + return; + } + + //Get previous value or define value by default for the current button + gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false }; + + //Get state of the button at previous frame + const previousStateButtonIsPressed = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed; + + //Get the state of the button on the current frame. + const currentFrameStateButtonIsPressed = gamepad.buttons[buttonId].pressed; + + //When previousStateButtonIsPressed is true and actual button state is not pressed + //Player have release the button + if (previousStateButtonIsPressed === true && currentFrameStateButtonIsPressed === false) { + gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true; + eventsFunctionContext.returnValue = true; + //break; + return; + } else { + //The player didn't released the button yet, the previous frame state is still true + gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false; + eventsFunctionContext.returnValue = false; + } + + if (currentFrameStateButtonIsPressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId; +} + +}; +gdjs.evtsExt__Gamepads__C_any_button_released.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +} + +} + + +{ + + +gdjs.evtsExt__Gamepads__C_any_button_released.userFunc0xd8a7b8(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__C_any_button_released.func = function(runtimeScene, player_ID, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__C_any_button_released.eventsList0(runtimeScene, eventsFunctionContext); + + +return !!eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__Gamepads__C_any_button_released.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__c_axis_pushed-func.js b/gdjs-evtsext__gamepads__c_axis_pushed-func.js new file mode 100644 index 0000000000000000000000000000000000000000..276634b464b1fcf2a205829adf3a88a830192d1d --- /dev/null +++ b/gdjs-evtsext__gamepads__c_axis_pushed-func.js @@ -0,0 +1,225 @@ + +if (typeof gdjs.evtsExt__Gamepads__C_Axis_pushed !== "undefined") { + gdjs.evtsExt__Gamepads__C_Axis_pushed.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__C_Axis_pushed = {}; + + +gdjs.evtsExt__Gamepads__C_Axis_pushed.userFunc0xefb118 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; +const stick = eventsFunctionContext.getArgument("stick").toUpperCase(); +const direction = eventsFunctionContext.getArgument("direction").toUpperCase(); + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in condition: "Gamepad stick pushed (axis)", is not valid number, must be between 0 and 4.'); + return; +} +if (stick != "LEFT" && stick != "RIGHT") { + console.error('Parameter stick in condition: "Gamepad stick pushed (axis)", is not valid, must be LEFT or RIGHT'); + return; +} +if (direction != "UP" && direction != "DOWN" && direction != "LEFT" && direction != "RIGHT" && direction != "ANY") { + console.error('Parameter deadzone in condition: "Gamepad stick pushed (axis)", is not valid, must be UP, DOWN, LEFT or RIGHT'); + return; +} + +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable. +if (gamepad == null) { + eventsFunctionContext.returnValue = false; + return; +} + + +//Define in onFirstSceneLoaded function +const getNormalizedAxisValue = gdjs._extensionController.getNormalizedAxisValue; + +switch (stick) { + case 'LEFT': + switch (direction) { + case 'LEFT': + if (getNormalizedAxisValue(gamepad.axes[0], playerId) < 0) { + eventsFunctionContext.returnValue = true; + return; + } + break; + + case 'RIGHT': + if (getNormalizedAxisValue(gamepad.axes[0], playerId) > 0) { + eventsFunctionContext.returnValue = true; + return; + } + break; + + case 'UP': + if (getNormalizedAxisValue(gamepad.axes[1], playerId) < 0) { + eventsFunctionContext.returnValue = true; + return; + } + break; + + case 'DOWN': + if (getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) { + eventsFunctionContext.returnValue = true; + return; + } + break; + + case 'ANY': + if ( getNormalizedAxisValue(gamepad.axes[0], playerId) < 0 + || getNormalizedAxisValue(gamepad.axes[0], playerId) > 0 + || getNormalizedAxisValue(gamepad.axes[1], playerId) < 0 + || getNormalizedAxisValue(gamepad.axes[1], playerId) > 0) { + eventsFunctionContext.returnValue = true; + return; + } + break; + + default: + console.error('The value Direction on stick Left on the condition: "Gamepad stick pushed (axis)" is not valid.'); + eventsFunctionContext.returnValue = false; + break; + } + break; + + case 'RIGHT': + switch (direction) { + case 'LEFT': + if (getNormalizedAxisValue(gamepad.axes[2], playerId) < 0) { + eventsFunctionContext.returnValue = true; + return; + } + break; + + case 'RIGHT': + if (getNormalizedAxisValue(gamepad.axes[2], playerId) > 0) { + eventsFunctionContext.returnValue = true; + return; + } + break; + + case 'UP': + if (getNormalizedAxisValue(gamepad.axes[3], playerId) < 0) { + eventsFunctionContext.returnValue = true; + return; + } + break; + + case 'DOWN': + if (getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) { + eventsFunctionContext.returnValue = true; + return; + } + break; + + case 'ANY': + if ( getNormalizedAxisValue(gamepad.axes[2], playerId) < 0 + || getNormalizedAxisValue(gamepad.axes[2], playerId) > 0 + || getNormalizedAxisValue(gamepad.axes[3], playerId) < 0 + || getNormalizedAxisValue(gamepad.axes[3], playerId) > 0) { + eventsFunctionContext.returnValue = true; + return; + } + break; + + default: + console.error('The value Direction on stick Right on the condition: "Gamepad stick pushed (axis)" is not valid.'); + eventsFunctionContext.returnValue = false; + break; + } + break; + + default: + console.error('The value Stick on the condition: "Gamepad stick pushed (axis)" is not valid.'); + eventsFunctionContext.returnValue = false; + break; +} + +eventsFunctionContext.returnValue = false; + +}; +gdjs.evtsExt__Gamepads__C_Axis_pushed.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__C_Axis_pushed.userFunc0xefb118(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__C_Axis_pushed.func = function(runtimeScene, player_ID, stick, direction, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; +if (argName === "stick") return stick; +if (argName === "direction") return direction; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__C_Axis_pushed.eventsList0(runtimeScene, eventsFunctionContext); + + +return !!eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__Gamepads__C_Axis_pushed.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__c_button_pressed-func.js b/gdjs-evtsext__gamepads__c_button_pressed-func.js new file mode 100644 index 0000000000000000000000000000000000000000..7627df1334e7cb47807226e67aab9d761f8c7b66 --- /dev/null +++ b/gdjs-evtsext__gamepads__c_button_pressed-func.js @@ -0,0 +1,210 @@ + +if (typeof gdjs.evtsExt__Gamepads__C_Button_pressed !== "undefined") { + gdjs.evtsExt__Gamepads__C_Button_pressed.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__C_Button_pressed = {}; + + +gdjs.evtsExt__Gamepads__C_Button_pressed.userFunc0xc89010 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; +const button = eventsFunctionContext.getArgument("button").toUpperCase(); + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in condition: "Gamepad button pressed", is not valid number, must be between 0 and 4.'); + return; +} +if (button === "") { + console.error('Parameter button is not valid in condition: "Gamepad button pressed"'); + eventsFunctionContext.returnValue = false; + return; +} + +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + +let buttonId; + +switch (button) { + case 'A': + case 'CROSS': + buttonId = 0; + break; + case 'B': + case 'CIRCLE': + buttonId = 1; + break; + case 'X': + case 'SQUARE': + buttonId = 2; + break; + case 'Y': + case 'TRIANGLE': + buttonId = 3; + break; + case 'LB': + case 'L1': + buttonId = 4; + break; + case 'RB': + case 'R1': + buttonId = 5; + break; + case 'LT': + case 'L2': + buttonId = 6; + break; + case 'RT': + case 'R2': + buttonId = 7; + break; + + case 'UP': + buttonId = 12; + break; + case 'DOWN': + buttonId = 13; + break; + case 'LEFT': + buttonId = 14; + break; + case 'RIGHT': + buttonId = 15; + break; + + case 'BACK': + case 'SHARE': + buttonId = 8; + break; + case 'START': + case 'OPTIONS': + buttonId = 9; + break; + + case 'CLICK_STICK_LEFT': + buttonId = 10; + break; + case 'CLICK_STICK_RIGHT': + buttonId = 11; + break; + + //PS4 + case 'PS_BUTTON': + buttonId = 16; + break; + case 'CLICK_TOUCHPAD': + buttonId = 17; + break; + + default: + console.error('The button: ' + button + ' in condition: "Gamepad button pressed" is not valid.'); + eventsFunctionContext.returnValue = false; + break; +} + + + +if (buttonId === undefined) { + console.error('There is no buttons valid in condition: "Gamepad button pressed"'); + eventsFunctionContext.returnValue = false; + return; +} + +if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) { + console.error('Buttons on the gamepad are not accessible in condition: "Gamepad button pressed"'); + eventsFunctionContext.returnValue = false; + return; +} + +//When a button is pressed, save the button in lastButtonUsed for each players +if (gamepad.buttons[buttonId].pressed) gdjs._extensionController.players[playerId].lastButtonUsed = buttonId; +eventsFunctionContext.returnValue = gamepad.buttons[buttonId].pressed; + + + + +}; +gdjs.evtsExt__Gamepads__C_Button_pressed.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__C_Button_pressed.userFunc0xc89010(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__C_Button_pressed.func = function(runtimeScene, player_ID, button, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; +if (argName === "button") return button; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__C_Button_pressed.eventsList0(runtimeScene, eventsFunctionContext); + + +return !!eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__Gamepads__C_Button_pressed.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__c_button_released-func.js b/gdjs-evtsext__gamepads__c_button_released-func.js new file mode 100644 index 0000000000000000000000000000000000000000..f300658f2ee61a871831497a4c61ba47e9433743 --- /dev/null +++ b/gdjs-evtsext__gamepads__c_button_released-func.js @@ -0,0 +1,218 @@ + +if (typeof gdjs.evtsExt__Gamepads__C_Button_released !== "undefined") { + gdjs.evtsExt__Gamepads__C_Button_released.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__C_Button_released = {}; + + +gdjs.evtsExt__Gamepads__C_Button_released.userFunc0xd827f8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; +const button = eventsFunctionContext.getArgument("button").toUpperCase(); + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in condition: "Gamepad button released", is not valid number, must be between 0 and 4.'); + return; +} +if (button === "") { + console.error('Parameter button is not valid in condition: "Gamepad button released"'); + return; +} + +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + +let buttonId; + +switch (button) { + case 'A': + case 'CROSS': + buttonId = 0; + break; + case 'B': + case 'CIRCLE': + buttonId = 1; + break; + case 'X': + case 'SQUARE': + buttonId = 2; + break; + case 'Y': + case 'TRIANGLE': + buttonId = 3; + break; + case 'LB': + case 'L1': + buttonId = 4; + break; + case 'RB': + case 'R1': + buttonId = 5; + break; + case 'LT': + case 'L2': + buttonId = 6; + break; + case 'RT': + case 'R2': + buttonId = 7; + break; + + case 'UP': + buttonId = 12; + break; + case 'DOWN': + buttonId = 13; + break; + case 'LEFT': + buttonId = 14; + break; + case 'RIGHT': + buttonId = 15; + break; + + case 'BACK': + case 'SHARE': + buttonId = 8; + break; + case 'START': + case 'OPTIONS': + buttonId = 9; + break; + + case 'CLICK_STICK_LEFT': + buttonId = 10; + break; + case 'CLICK_STICK_RIGHT': + buttonId = 11; + break; + + //PS4 + case 'PS_BUTTON': + buttonId = 16; + break; + case 'CLICK_TOUCHPAD': + buttonId = 17; + break; + + default: + console.error('The button: ' + button + ' in condition: "Gamepad button released" is not valid.'); + break; +} + +if (buttonId === undefined) { + console.error('There is no buttons valid in condition: "Gamepad button released"'); + eventsFunctionContext.returnValue = false; + return; +} + +if (gamepad.buttons == null || gamepad.buttons[buttonId] == null) { + console.error('Buttons on the gamepad are not accessible in condition: "Gamepad button released"'); + eventsFunctionContext.returnValue = false; + return; +} + +//Define default value on pressed button or use previous value +gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId] || { pressed: false }; + +//Get state of button at previous frame +const previousStateButton = gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed; + +//When previousStateButton is true and actual button state is not pressed +//Player have release the button +if (previousStateButton === true && gamepad.buttons[buttonId].pressed === false) { + // Save the last button used for the player + gdjs._extensionController.players[playerId].lastButtonUsed = buttonId; + gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = true; + eventsFunctionContext.returnValue = true; + +} else { + gdjs._extensionController.players[playerId].previousFrameStateButtons[buttonId].pressed = false; + eventsFunctionContext.returnValue = false; +} + +}; +gdjs.evtsExt__Gamepads__C_Button_released.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__C_Button_released.userFunc0xd827f8(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__C_Button_released.func = function(runtimeScene, player_ID, button, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; +if (argName === "button") return button; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__C_Button_released.eventsList0(runtimeScene, eventsFunctionContext); + + +return !!eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__Gamepads__C_Button_released.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__c_controller_type-func.js b/gdjs-evtsext__gamepads__c_controller_type-func.js new file mode 100644 index 0000000000000000000000000000000000000000..2bca2cd5f298368c14240eb50f4089d799ff20be --- /dev/null +++ b/gdjs-evtsext__gamepads__c_controller_type-func.js @@ -0,0 +1,115 @@ + +if (typeof gdjs.evtsExt__Gamepads__C_Controller_type !== "undefined") { + gdjs.evtsExt__Gamepads__C_Controller_type.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__C_Controller_type = {}; + + +gdjs.evtsExt__Gamepads__C_Controller_type.userFunc0xd8a7b8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; +const controllerType = eventsFunctionContext.getArgument("controller_type").toUpperCase(); + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in condition: "Gamepad type", is not valid number, must be between 0 and 4.'); + return; +} +if (controllerType === "") { + console.error('Parameter type in condition: "Gamepad type", is not a string.'); + return; +} + +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + + +if (controllerType == "XBOX") { + eventsFunctionContext.returnValue = gdjs._extensionController.isXbox(gamepad); +} else { + eventsFunctionContext.returnValue = gamepad ? gamepad.id.toUpperCase().indexOf(controllerType) !== -1 : false; +} +}; +gdjs.evtsExt__Gamepads__C_Controller_type.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__C_Controller_type.userFunc0xd8a7b8(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__C_Controller_type.func = function(runtimeScene, player_ID, controller_type, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; +if (argName === "controller_type") return controller_type; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__C_Controller_type.eventsList0(runtimeScene, eventsFunctionContext); + + +return !!eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__Gamepads__C_Controller_type.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__c_controller_x_is_connected-func.js b/gdjs-evtsext__gamepads__c_controller_x_is_connected-func.js new file mode 100644 index 0000000000000000000000000000000000000000..8f6fe24610ac507b150d96ff3918ae81c20c5382 --- /dev/null +++ b/gdjs-evtsext__gamepads__c_controller_x_is_connected-func.js @@ -0,0 +1,101 @@ + +if (typeof gdjs.evtsExt__Gamepads__C_Controller_X_is_connected !== "undefined") { + gdjs.evtsExt__Gamepads__C_Controller_X_is_connected.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__C_Controller_X_is_connected = {}; + + +gdjs.evtsExt__Gamepads__C_Controller_X_is_connected.userFunc0xd8a7b8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameter +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in condition: "Gamepad connected", is not valid number, must be between 0 and 4.'); + return; +} + +// If gamepad was disconnected it will be null (so this will return false) +// If gamepad was never connected it will be undefined (so this will return false) +eventsFunctionContext.returnValue = !!gamepads[playerId]; +}; +gdjs.evtsExt__Gamepads__C_Controller_X_is_connected.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__C_Controller_X_is_connected.userFunc0xd8a7b8(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__C_Controller_X_is_connected.func = function(runtimeScene, player_ID, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__C_Controller_X_is_connected.eventsList0(runtimeScene, eventsFunctionContext); + + +return !!eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__Gamepads__C_Controller_X_is_connected.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__connectedgamepadscount-func.js b/gdjs-evtsext__gamepads__connectedgamepadscount-func.js new file mode 100644 index 0000000000000000000000000000000000000000..ac3031e1ae40100f9c9e3e224729715d16bfb567 --- /dev/null +++ b/gdjs-evtsext__gamepads__connectedgamepadscount-func.js @@ -0,0 +1,102 @@ + +if (typeof gdjs.evtsExt__Gamepads__ConnectedGamepadsCount !== "undefined") { + gdjs.evtsExt__Gamepads__ConnectedGamepadsCount.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__ConnectedGamepadsCount = {}; + + +gdjs.evtsExt__Gamepads__ConnectedGamepadsCount.userFunc0xef9db8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +// Gamepads can be disconnected and become null, so we have to filter them. +eventsFunctionContext.returnValue = Object.keys(gamepads).filter(key => !!gamepads[key]).length; + +}; +gdjs.evtsExt__Gamepads__ConnectedGamepadsCount.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +} + +} + + +{ + + +gdjs.evtsExt__Gamepads__ConnectedGamepadsCount.userFunc0xef9db8(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__ConnectedGamepadsCount.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__ConnectedGamepadsCount.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Gamepads__ConnectedGamepadsCount.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__deadzone-func.js b/gdjs-evtsext__gamepads__deadzone-func.js new file mode 100644 index 0000000000000000000000000000000000000000..47f38bac692e3656138793386b9ba6b52098b6ab --- /dev/null +++ b/gdjs-evtsext__gamepads__deadzone-func.js @@ -0,0 +1,106 @@ + +if (typeof gdjs.evtsExt__Gamepads__Deadzone !== "undefined") { + gdjs.evtsExt__Gamepads__Deadzone.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__Deadzone = {}; + + +gdjs.evtsExt__Gamepads__Deadzone.userFunc0xf51580 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +//Get function parameter +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in expression: "Gamepad deadzone for sticks", is not valid number, must be between 0 and 4.'); + return; +} +///Return the deadzone value for a given player +eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].deadzone; +}; +gdjs.evtsExt__Gamepads__Deadzone.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +} + +} + + +{ + + +gdjs.evtsExt__Gamepads__Deadzone.userFunc0xf51580(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__Deadzone.func = function(runtimeScene, player_ID, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__Deadzone.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Gamepads__Deadzone.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__gamepadcount-func.js b/gdjs-evtsext__gamepads__gamepadcount-func.js new file mode 100644 index 0000000000000000000000000000000000000000..ce88f1937b49c5a8650f4655b0a2268d368c3c9d --- /dev/null +++ b/gdjs-evtsext__gamepads__gamepadcount-func.js @@ -0,0 +1,100 @@ + +if (typeof gdjs.evtsExt__Gamepads__GamepadCount !== "undefined") { + gdjs.evtsExt__Gamepads__GamepadCount.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__GamepadCount = {}; + + +gdjs.evtsExt__Gamepads__GamepadCount.userFunc0xf40ba0 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get the last activated controller +const controllerId = gdjs._extensionController.lastActiveController; + +// Check if controller is active +const gamepad = gamepads[controllerId]; +if (gamepad == null) { + eventsFunctionContext.returnValue = 0; +} else { + // Return active controller id + eventsFunctionContext.returnValue = controllerId + 1; +} + +}; +gdjs.evtsExt__Gamepads__GamepadCount.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__GamepadCount.userFunc0xf40ba0(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__GamepadCount.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__GamepadCount.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Gamepads__GamepadCount.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__gamepadtype-func.js b/gdjs-evtsext__gamepads__gamepadtype-func.js new file mode 100644 index 0000000000000000000000000000000000000000..9768a18d039e4d1a260f36eb596cd743bba03f5e --- /dev/null +++ b/gdjs-evtsext__gamepads__gamepadtype-func.js @@ -0,0 +1,105 @@ + +if (typeof gdjs.evtsExt__Gamepads__GamepadType !== "undefined") { + gdjs.evtsExt__Gamepads__GamepadType.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__GamepadType = {}; + + +gdjs.evtsExt__Gamepads__GamepadType.userFunc0xef9db8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameter +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in string expression: "Gamepad type", is not valid number, must be between 0 and 4'); + return; +} + +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + +eventsFunctionContext.returnValue = (gamepad && gamepad.id) ? gamepad.id : "No information for player " + (playerId + 1) + +}; +gdjs.evtsExt__Gamepads__GamepadType.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__GamepadType.userFunc0xef9db8(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__GamepadType.func = function(runtimeScene, player_ID, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__GamepadType.eventsList0(runtimeScene, eventsFunctionContext); + + +return "" + eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__Gamepads__GamepadType.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__lastbuttonid-func.js b/gdjs-evtsext__gamepads__lastbuttonid-func.js new file mode 100644 index 0000000000000000000000000000000000000000..8a6868bd5ec765f3ac7501266b2ab5ff4b97fb1c --- /dev/null +++ b/gdjs-evtsext__gamepads__lastbuttonid-func.js @@ -0,0 +1,98 @@ + +if (typeof gdjs.evtsExt__Gamepads__LastButtonID !== "undefined") { + gdjs.evtsExt__Gamepads__LastButtonID.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__LastButtonID = {}; + + +gdjs.evtsExt__Gamepads__LastButtonID.userFunc0x9cdcc0 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +//Get function parameter +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; + +//Player id is not valid +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in expression: "Last pressed button (id)", is not valid number, must be between 0 and 4.'); + return; +} + +//Return the last button used by the player +eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].lastButtonUsed; +}; +gdjs.evtsExt__Gamepads__LastButtonID.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__LastButtonID.userFunc0x9cdcc0(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__LastButtonID.func = function(runtimeScene, player_ID, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__LastButtonID.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Gamepads__LastButtonID.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__lastbuttonstring-func.js b/gdjs-evtsext__gamepads__lastbuttonstring-func.js new file mode 100644 index 0000000000000000000000000000000000000000..f28d845531e04c2c4955ef88bce33ad5749e935c --- /dev/null +++ b/gdjs-evtsext__gamepads__lastbuttonstring-func.js @@ -0,0 +1,117 @@ + +if (typeof gdjs.evtsExt__Gamepads__LastButtonString !== "undefined") { + gdjs.evtsExt__Gamepads__LastButtonString.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__LastButtonString = {}; + + +gdjs.evtsExt__Gamepads__LastButtonString.userFunc0xf40ba0 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; +const controllerType = eventsFunctionContext.getArgument("controller_type").toUpperCase(); + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in string expression: "Last pressed button (LastButtonString)", is not valid number, must be between 0 and 4.'); + return; +} +if (controllerType === "") { + console.error('Parameter controller type is not valid in string expression: "Last pressed button (LastButtonString)"'); + return; +} + +const gamepad = gamepads[playerId]; + +if (gamepad !== null) { //Gamepad exist + //Get last btn id + const lastButtonUsedID = gdjs._extensionController.players[playerId].lastButtonUsed; + + //Return last button as string + eventsFunctionContext.returnValue = gdjs._extensionController.getInputString(controllerType, lastButtonUsedID); + +} else { //Gamepad dosen't exist + console.error('Your controller is not supported or the gamepad wasn\'t detected in string expression: "Last pressed button (LastButtonString)"'); + eventsFunctionContext.returnValue = "Gamepad not connected"; +} +}; +gdjs.evtsExt__Gamepads__LastButtonString.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__LastButtonString.userFunc0xf40ba0(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__LastButtonString.func = function(runtimeScene, player_ID, controller_type, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; +if (argName === "controller_type") return controller_type; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__LastButtonString.eventsList0(runtimeScene, eventsFunctionContext); + + +return "" + eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__Gamepads__LastButtonString.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__onfirstsceneloaded-func.js b/gdjs-evtsext__gamepads__onfirstsceneloaded-func.js new file mode 100644 index 0000000000000000000000000000000000000000..95af003b9d5dd233b1b8e804a0ccb18ca4e0a43d --- /dev/null +++ b/gdjs-evtsext__gamepads__onfirstsceneloaded-func.js @@ -0,0 +1,215 @@ + +if (typeof gdjs.evtsExt__Gamepads__onFirstSceneLoaded !== "undefined") { + gdjs.evtsExt__Gamepads__onFirstSceneLoaded.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__onFirstSceneLoaded = {}; + + +gdjs.evtsExt__Gamepads__onFirstSceneLoaded.userFunc0xd8a7b8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +//Define an new private object javascript for the gamepad extension +gdjs._extensionController = { + players: { + 0: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} }, + 1: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} }, + 2: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} }, + 3: { mapping: 'DEFAULT', lastButtonUsed: -1, deadzone: 0.2, previousFrameStateButtons: {}, rumble: {} }, + }, + lastActiveController: -1, // Last active controller + controllerButtonNames: { //Map associating controller button ids to button names + "XBOX": { + 0: "A", + 1: "B", + 2: "X", + 3: "Y", + 4: "LB", + 5: "RB", + 6: "LT", + 7: "RT", + 8: "BACK", + 9: "START", + 10: "CLICK_STICK_LEFT", + 11: "CLICK_STICK_RIGHT", + 12: "UP", + 13: "DOWN", + 14: "LEFT", + 15: "RIGHT", + 16: "NONE", + 17: "NONE" + }, + "PS4": { + 0: "CROSS", + 1: "CIRCLE", + 2: "SQUARE", + 3: "TRIANGLE", + 4: "L1", + 5: "R1", + 6: "L2", + 7: "R2", + 8: "SHARE", + 9: "OPTIONS", + 10: "CLICK_STICK_LEFT", + 11: "CLICK_STICK_RIGHT", + 12: "UP", + 13: "DOWN", + 14: "LEFT", + 15: "RIGHT", + 16: "PS_BUTTON", + 17: "CLICK_TOUCHPAD" + } + } +}; + +gdjs._extensionController.getInputString = function (type, buttonId) { + const controllerButtonNames = gdjs._extensionController.controllerButtonNames; + if (controllerButtonNames[type] !== undefined) { + return controllerButtonNames[type][buttonId]; + } + + return "UNKNOWN_BUTTON"; +} + +gdjs._extensionController.axisToAngle = function (deltaX, deltaY) { + const rad = Math.atan2(deltaY, deltaX); + const deg = rad * (180 / Math.PI); + return deg; +} + +gdjs._extensionController.isXbox = function (gamepad) { + return (gamepad ? ( + gamepad.id.toUpperCase().indexOf("XBOX") !== -1 + // "XINPUT" cannot be used to check if it is a xbox controller is just a generic + // name reported in Firefox corresponding to the driver being used by the controller + // https://gamefaqs.gamespot.com/boards/916373-pc/73341312?page=1 + ) : false); +} + +//Returns the new value taking into account the dead zone for the player_ID given +gdjs._extensionController.getNormalizedAxisValue = function (v, player_ID) { + // gdjs._extensionController = gdjs._extensionController || { deadzone: 0.2 }; + + // Anything smaller than this is assumed to be 0,0 + const DEADZONE = gdjs._extensionController.players[player_ID].deadzone; + + if (Math.abs(v) < DEADZONE) { + // In the dead zone, set to 0 + v = 0; + + if (v == null) { + return 0; + } else { + return v; + } + + } else { + // We're outside the dead zone, but we'd like to smooth + // this value out so it still runs nicely between 0..1. + // That is, we don't want it to jump suddenly from 0 to + // DEADZONE. + + // Remap v from + // DEADZONE..1 to 0..(1-DEADZONE) + // or from + // -1..-DEADZONE to -(1-DEADZONE)..0 + + v = v - Math.sign(v) * DEADZONE; + + // Remap v from + // 0..(1-DEADZONE) to 0..1 + // or from + // -(1-DEADZONE)..0 to -1..0 + + return v / (1 - DEADZONE); + } +}; +}; +gdjs.evtsExt__Gamepads__onFirstSceneLoaded.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +} + +} + + +{ + + +gdjs.evtsExt__Gamepads__onFirstSceneLoaded.userFunc0xd8a7b8(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__onFirstSceneLoaded.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__onFirstSceneLoaded.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__Gamepads__onFirstSceneLoaded.registeredGdjsCallbacks = []; +gdjs.evtsExt__Gamepads__onFirstSceneLoaded.registeredGdjsCallbacks.push((runtimeScene) => { + gdjs.evtsExt__Gamepads__onFirstSceneLoaded.func(runtimeScene, runtimeScene); +}) +gdjs.registerFirstRuntimeSceneLoadedCallback(gdjs.evtsExt__Gamepads__onFirstSceneLoaded.registeredGdjsCallbacks[gdjs.evtsExt__Gamepads__onFirstSceneLoaded.registeredGdjsCallbacks.length - 1]); diff --git a/gdjs-evtsext__gamepads__onscenepostevents-func.js b/gdjs-evtsext__gamepads__onscenepostevents-func.js new file mode 100644 index 0000000000000000000000000000000000000000..aed0bc3eb095d83fc8399b023c6829176f183df2 --- /dev/null +++ b/gdjs-evtsext__gamepads__onscenepostevents-func.js @@ -0,0 +1,143 @@ + +if (typeof gdjs.evtsExt__Gamepads__onScenePostEvents !== "undefined") { + gdjs.evtsExt__Gamepads__onScenePostEvents.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__onScenePostEvents = {}; + + +gdjs.evtsExt__Gamepads__onScenePostEvents.userFunc0xd8a7b8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +//Each time a player press a button i save the last button pressed for the next frame +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameter +let countPlayers = Object.keys(gdjs._extensionController.players).length; + +//Repeat for each players +for (let i = 0; i < countPlayers; i++) { + let gamepad = gamepads[i]; // Get the gamepad of the player + + //We have to keep this condition because if the user hasn't plugged in his controller yet, we can't get the controller in the gamepad variable. + if (gamepad == null) { + continue; + } + + for (let b = 0; b < Object.keys(gamepad.buttons).length; b++) { //For each buttons + if (gamepad.buttons[b].pressed) { //One of them is pressed + gdjs._extensionController.players[i].lastButtonUsed = b; //Save the button pressed + + //Save the state of the button for the next frame. + gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: true }; + + // Update Last Active Controller + gdjs._extensionController.lastActiveController = i; + } else { + gdjs._extensionController.players[i].previousFrameStateButtons[b] = { pressed: false }; + } + } + + + gdjs._extensionController.players[i].rumble.elapsedTime += runtimeScene.getElapsedTime(runtimeScene) / 1000; + if ( + gdjs._extensionController.players[i].rumble.duration - gdjs._extensionController.players[i].rumble.elapsedTime <= 0 && + (gdjs._extensionController.players[i].rumble.weakMagnitude || gdjs._extensionController.players[i].rumble.strongMagnitude) + ) { + gdjs._extensionController.players[i].rumble.weakMagnitude = 0; + gdjs._extensionController.players[i].rumble.strongMagnitude = 0; + } + + +} + +}; +gdjs.evtsExt__Gamepads__onScenePostEvents.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +} + +} + + +{ + + +gdjs.evtsExt__Gamepads__onScenePostEvents.userFunc0xd8a7b8(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__onScenePostEvents.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__onScenePostEvents.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__Gamepads__onScenePostEvents.registeredGdjsCallbacks = []; +gdjs.evtsExt__Gamepads__onScenePostEvents.registeredGdjsCallbacks.push((runtimeScene) => { + gdjs.evtsExt__Gamepads__onScenePostEvents.func(runtimeScene, runtimeScene); +}) +gdjs.registerRuntimeScenePostEventsCallback(gdjs.evtsExt__Gamepads__onScenePostEvents.registeredGdjsCallbacks[gdjs.evtsExt__Gamepads__onScenePostEvents.registeredGdjsCallbacks.length - 1]); diff --git a/gdjs-evtsext__gamepads__stickangle-func.js b/gdjs-evtsext__gamepads__stickangle-func.js new file mode 100644 index 0000000000000000000000000000000000000000..ae0248546fd7a249347b9633f5d0dd8a20189048 --- /dev/null +++ b/gdjs-evtsext__gamepads__stickangle-func.js @@ -0,0 +1,122 @@ + +if (typeof gdjs.evtsExt__Gamepads__StickAngle !== "undefined") { + gdjs.evtsExt__Gamepads__StickAngle.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__StickAngle = {}; + + +gdjs.evtsExt__Gamepads__StickAngle.userFunc0xcbf570 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; +const stick = eventsFunctionContext.getArgument("stick").toUpperCase(); + + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier is not valid in expression: "Value of a stick rotation"'); + return; +} +if (stick !== "LEFT" && stick !== "RIGHT") { + console.error('Parameter stick is not valid in expression: "Value of a stick rotation"'); + return; +} +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + +switch (stick) { + case 'LEFT': + eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId)); + break; + + case 'RIGHT': + eventsFunctionContext.returnValue = gdjs._extensionController.axisToAngle(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId), gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId)); + break; + + default: + eventsFunctionContext.returnValue = -1; + break; +} +}; +gdjs.evtsExt__Gamepads__StickAngle.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__StickAngle.userFunc0xcbf570(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__StickAngle.func = function(runtimeScene, player_ID, stick, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; +if (argName === "stick") return stick; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__StickAngle.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Gamepads__StickAngle.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__stickforce-func.js b/gdjs-evtsext__gamepads__stickforce-func.js new file mode 100644 index 0000000000000000000000000000000000000000..ee600d6461e7f8cd03181c310a0a203d528c75c7 --- /dev/null +++ b/gdjs-evtsext__gamepads__stickforce-func.js @@ -0,0 +1,125 @@ + +if (typeof gdjs.evtsExt__Gamepads__StickForce !== "undefined") { + gdjs.evtsExt__Gamepads__StickForce.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__StickForce = {}; + + +gdjs.evtsExt__Gamepads__StickForce.userFunc0xd1c978 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; +const stick = eventsFunctionContext.getArgument("stick").toUpperCase(); + + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier is not valid in expression: "Value of a stick force"'); + return; +} + +if (stick !== "LEFT" && stick !== "RIGHT") { + console.error('Parameter stick is not valid in expression: "Value of a stick force"'); + return; +} + +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + + +switch (stick) { + case 'LEFT': + eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[0], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[1], playerId)), 0, 1); + break; + + case 'RIGHT': + eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[2], playerId)) + Math.abs(gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[3], playerId)), 0, 1); + break; + + default: + eventsFunctionContext.returnValue = -1; + break; +} +}; +gdjs.evtsExt__Gamepads__StickForce.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__StickForce.userFunc0xd1c978(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__StickForce.func = function(runtimeScene, player_ID, stick, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; +if (argName === "stick") return stick; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__StickForce.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Gamepads__StickForce.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__stickforcex-func.js b/gdjs-evtsext__gamepads__stickforcex-func.js new file mode 100644 index 0000000000000000000000000000000000000000..5e0b423403d6c456099fa59f8756ee12d3b9e347 --- /dev/null +++ b/gdjs-evtsext__gamepads__stickforcex-func.js @@ -0,0 +1,111 @@ + +if (typeof gdjs.evtsExt__Gamepads__StickForceX !== "undefined") { + gdjs.evtsExt__Gamepads__StickForceX.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__StickForceX = {}; + + +gdjs.evtsExt__Gamepads__StickForceX.userFunc0xcbf570 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("Gamepad") - 1; +const stick = eventsFunctionContext.getArgument("Stick").toLowerCase(); + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier is not valid in expression: "Value of a gamepad axis"'); + return; +} +if (stick != "left" && stick != "right") { + console.error('Parameter stick is not valid in expression: "Value of a gamepad axis"'); + return; +} +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + +const axisIndex = stick === 'right' ? 2 : 0; +eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId); + +}; +gdjs.evtsExt__Gamepads__StickForceX.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__StickForceX.userFunc0xcbf570(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__StickForceX.func = function(runtimeScene, Gamepad, Stick, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Gamepad") return Gamepad; +if (argName === "Stick") return Stick; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__StickForceX.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Gamepads__StickForceX.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__stickforcey-func.js b/gdjs-evtsext__gamepads__stickforcey-func.js new file mode 100644 index 0000000000000000000000000000000000000000..b4ffa50c84a2b95b5688552bfe01681392e1ea60 --- /dev/null +++ b/gdjs-evtsext__gamepads__stickforcey-func.js @@ -0,0 +1,111 @@ + +if (typeof gdjs.evtsExt__Gamepads__StickForceY !== "undefined") { + gdjs.evtsExt__Gamepads__StickForceY.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__StickForceY = {}; + + +gdjs.evtsExt__Gamepads__StickForceY.userFunc0xcbf570 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("Gamepad") - 1; +const stick = eventsFunctionContext.getArgument("Stick").toLowerCase(); + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier is not valid in expression: "Value of a gamepad axis"'); + return; +} +if (stick != "left" && stick != "right") { + console.error('Parameter stick is not valid in expression: "Value of a gamepad axis"'); + return; +} +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + +const axisIndex = stick === 'right' ? 3 : 1; +eventsFunctionContext.returnValue = gdjs._extensionController.getNormalizedAxisValue(gamepad.axes[axisIndex], playerId); + +}; +gdjs.evtsExt__Gamepads__StickForceY.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__StickForceY.userFunc0xcbf570(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__StickForceY.func = function(runtimeScene, Gamepad, Stick, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Gamepad") return Gamepad; +if (argName === "Stick") return Stick; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__StickForceY.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Gamepads__StickForceY.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__stickrotationvalue-func.js b/gdjs-evtsext__gamepads__stickrotationvalue-func.js new file mode 100644 index 0000000000000000000000000000000000000000..4e98dfb6914c5397dcfab1d9b3ba02b5d81ad182 --- /dev/null +++ b/gdjs-evtsext__gamepads__stickrotationvalue-func.js @@ -0,0 +1,87 @@ + +if (typeof gdjs.evtsExt__Gamepads__StickRotationValue !== "undefined") { + gdjs.evtsExt__Gamepads__StickRotationValue.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__StickRotationValue = {}; + + +gdjs.evtsExt__Gamepads__StickRotationValue.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = gdjs.evtsExt__Gamepads__StickAngle.func(runtimeScene, (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("player_ID")) || 0 : 0), (typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("stick") : ""), (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); }}} + +} + + +}; + +gdjs.evtsExt__Gamepads__StickRotationValue.func = function(runtimeScene, player_ID, stick, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; +if (argName === "stick") return stick; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__StickRotationValue.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Gamepads__StickRotationValue.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__strongvibrationmagnitude-func.js b/gdjs-evtsext__gamepads__strongvibrationmagnitude-func.js new file mode 100644 index 0000000000000000000000000000000000000000..7ec7115a09cac01df31c6c37f5ffd6b82b44aab7 --- /dev/null +++ b/gdjs-evtsext__gamepads__strongvibrationmagnitude-func.js @@ -0,0 +1,89 @@ + +if (typeof gdjs.evtsExt__Gamepads__StrongVibrationMagnitude !== "undefined") { + gdjs.evtsExt__Gamepads__StrongVibrationMagnitude.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__StrongVibrationMagnitude = {}; + + +gdjs.evtsExt__Gamepads__StrongVibrationMagnitude.userFunc0xd8a7b8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const playerId = eventsFunctionContext.getArgument("Player_ID") - 1; +eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.strongMagnitude; +}; +gdjs.evtsExt__Gamepads__StrongVibrationMagnitude.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__StrongVibrationMagnitude.userFunc0xd8a7b8(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__StrongVibrationMagnitude.func = function(runtimeScene, Player_ID, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Player_ID") return Player_ID; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__StrongVibrationMagnitude.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Gamepads__StrongVibrationMagnitude.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__topdowngamepadmapper.js b/gdjs-evtsext__gamepads__topdowngamepadmapper.js new file mode 100644 index 0000000000000000000000000000000000000000..e7895e244cd30793bc51f2f11e6130136bfdd496 --- /dev/null +++ b/gdjs-evtsext__gamepads__topdowngamepadmapper.js @@ -0,0 +1,700 @@ + +gdjs.evtsExt__Gamepads__TopDownGamepadMapper = gdjs.evtsExt__Gamepads__TopDownGamepadMapper || {}; + +/** + * Behavior generated from Top-down gamepad mapper + */ +gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper = class TopDownGamepadMapper extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.TopDownMovement = behaviorData.TopDownMovement !== undefined ? behaviorData.TopDownMovement : ""; + this._behaviorData.GamepadIdentifier = behaviorData.GamepadIdentifier !== undefined ? behaviorData.GamepadIdentifier : Number("1") || 0; + this._behaviorData.UseArrows = behaviorData.UseArrows !== undefined ? behaviorData.UseArrows : true; + this._behaviorData.UseLeftStick = behaviorData.UseLeftStick !== undefined ? behaviorData.UseLeftStick : true; + this._behaviorData.UseRightStick = behaviorData.UseRightStick !== undefined ? behaviorData.UseRightStick : false; + this._behaviorData.StickMode = behaviorData.StickMode !== undefined ? behaviorData.StickMode : "Analog"; + } + + // Hot-reload: + updateFromBehaviorData(oldBehaviorData, newBehaviorData) { + + if (oldBehaviorData.TopDownMovement !== newBehaviorData.TopDownMovement) + this._behaviorData.TopDownMovement = newBehaviorData.TopDownMovement; + if (oldBehaviorData.GamepadIdentifier !== newBehaviorData.GamepadIdentifier) + this._behaviorData.GamepadIdentifier = newBehaviorData.GamepadIdentifier; + if (oldBehaviorData.UseArrows !== newBehaviorData.UseArrows) + this._behaviorData.UseArrows = newBehaviorData.UseArrows; + if (oldBehaviorData.UseLeftStick !== newBehaviorData.UseLeftStick) + this._behaviorData.UseLeftStick = newBehaviorData.UseLeftStick; + if (oldBehaviorData.UseRightStick !== newBehaviorData.UseRightStick) + this._behaviorData.UseRightStick = newBehaviorData.UseRightStick; + if (oldBehaviorData.StickMode !== newBehaviorData.StickMode) + this._behaviorData.StickMode = newBehaviorData.StickMode; + + return true; + } + + // Network sync: + getNetworkSyncData() { + return { + ...super.getNetworkSyncData(), + props: { + + TopDownMovement: this._behaviorData.TopDownMovement, + GamepadIdentifier: this._behaviorData.GamepadIdentifier, + UseArrows: this._behaviorData.UseArrows, + UseLeftStick: this._behaviorData.UseLeftStick, + UseRightStick: this._behaviorData.UseRightStick, + StickMode: this._behaviorData.StickMode, + } + }; + } + updateFromNetworkSyncData(networkSyncData) { + super.updateFromNetworkSyncData(networkSyncData); + + if (networkSyncData.props.TopDownMovement !== undefined) + this._behaviorData.TopDownMovement = networkSyncData.props.TopDownMovement; + if (networkSyncData.props.GamepadIdentifier !== undefined) + this._behaviorData.GamepadIdentifier = networkSyncData.props.GamepadIdentifier; + if (networkSyncData.props.UseArrows !== undefined) + this._behaviorData.UseArrows = networkSyncData.props.UseArrows; + if (networkSyncData.props.UseLeftStick !== undefined) + this._behaviorData.UseLeftStick = networkSyncData.props.UseLeftStick; + if (networkSyncData.props.UseRightStick !== undefined) + this._behaviorData.UseRightStick = networkSyncData.props.UseRightStick; + if (networkSyncData.props.StickMode !== undefined) + this._behaviorData.StickMode = networkSyncData.props.StickMode; + } + + // Properties: + + _getTopDownMovement() { + return this._behaviorData.TopDownMovement !== undefined ? this._behaviorData.TopDownMovement : ""; + } + _setTopDownMovement(newValue) { + this._behaviorData.TopDownMovement = newValue; + } + _getGamepadIdentifier() { + return this._behaviorData.GamepadIdentifier !== undefined ? this._behaviorData.GamepadIdentifier : Number("1") || 0; + } + _setGamepadIdentifier(newValue) { + this._behaviorData.GamepadIdentifier = newValue; + } + _getUseArrows() { + return this._behaviorData.UseArrows !== undefined ? this._behaviorData.UseArrows : true; + } + _setUseArrows(newValue) { + this._behaviorData.UseArrows = newValue; + } + _toggleUseArrows() { + this._setUseArrows(!this._getUseArrows()); + } + _getUseLeftStick() { + return this._behaviorData.UseLeftStick !== undefined ? this._behaviorData.UseLeftStick : true; + } + _setUseLeftStick(newValue) { + this._behaviorData.UseLeftStick = newValue; + } + _toggleUseLeftStick() { + this._setUseLeftStick(!this._getUseLeftStick()); + } + _getUseRightStick() { + return this._behaviorData.UseRightStick !== undefined ? this._behaviorData.UseRightStick : false; + } + _setUseRightStick(newValue) { + this._behaviorData.UseRightStick = newValue; + } + _toggleUseRightStick() { + this._setUseRightStick(!this._getUseRightStick()); + } + _getStickMode() { + return this._behaviorData.StickMode !== undefined ? this._behaviorData.StickMode : "Analog"; + } + _setStickMode(newValue) { + this._behaviorData.StickMode = newValue; + } +} + +/** + * Shared data generated from Top-down gamepad mapper + */ +gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.SharedData = class TopDownGamepadMapperSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._Gamepads_TopDownGamepadMapperSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._Gamepads_TopDownGamepadMapperSharedData = new gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.SharedData( + initialData + ); + } + return instanceContainer._Gamepads_TopDownGamepadMapperSharedData; +} + +// Methods: +gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext = {}; +gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects1= []; +gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2= []; +gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3= []; +gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects4= []; + + +gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2, gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3); + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtsExt__Gamepads__C_Button_pressed.func(runtimeScene, (( gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3.length === 0 ) ? 0 :gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getGamepadIdentifier()), "Left", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3 */ +{for(var i = 0, len = gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3.length ;i < len;++i) { + gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3[i].getBehavior(eventsFunctionContext.getBehaviorName("TopDownMovement")).simulateLeftKey(); +} +}} + +} + + +{ + +gdjs.copyArray(gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2, gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3); + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtsExt__Gamepads__C_Button_pressed.func(runtimeScene, (( gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3.length === 0 ) ? 0 :gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getGamepadIdentifier()), "Right", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3 */ +{for(var i = 0, len = gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3.length ;i < len;++i) { + gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3[i].getBehavior(eventsFunctionContext.getBehaviorName("TopDownMovement")).simulateRightKey(); +} +}} + +} + + +{ + +gdjs.copyArray(gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2, gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3); + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtsExt__Gamepads__C_Button_pressed.func(runtimeScene, (( gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3.length === 0 ) ? 0 :gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getGamepadIdentifier()), "Up", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3 */ +{for(var i = 0, len = gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3.length ;i < len;++i) { + gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3[i].getBehavior(eventsFunctionContext.getBehaviorName("TopDownMovement")).simulateUpKey(); +} +}} + +} + + +{ + +/* Reuse gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2 */ + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtsExt__Gamepads__C_Button_pressed.func(runtimeScene, (( gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2.length === 0 ) ? 0 :gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getGamepadIdentifier()), "Down", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2 */ +{for(var i = 0, len = gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2[i].getBehavior(eventsFunctionContext.getBehaviorName("TopDownMovement")).simulateDownKey(); +} +}} + +} + + +};gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2, gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3); + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtsExt__Gamepads__C_Axis_pushed.func(runtimeScene, (( gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3.length === 0 ) ? 0 :gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getGamepadIdentifier()), "Left", "Left", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3 */ +{for(var i = 0, len = gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3.length ;i < len;++i) { + gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3[i].getBehavior(eventsFunctionContext.getBehaviorName("TopDownMovement")).simulateLeftKey(); +} +}} + +} + + +{ + +gdjs.copyArray(gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2, gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3); + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtsExt__Gamepads__C_Axis_pushed.func(runtimeScene, (( gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3.length === 0 ) ? 0 :gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getGamepadIdentifier()), "Left", "Right", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3 */ +{for(var i = 0, len = gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3.length ;i < len;++i) { + gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3[i].getBehavior(eventsFunctionContext.getBehaviorName("TopDownMovement")).simulateRightKey(); +} +}} + +} + + +{ + +gdjs.copyArray(gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2, gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3); + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtsExt__Gamepads__C_Axis_pushed.func(runtimeScene, (( gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3.length === 0 ) ? 0 :gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getGamepadIdentifier()), "Left", "Up", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3 */ +{for(var i = 0, len = gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3.length ;i < len;++i) { + gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3[i].getBehavior(eventsFunctionContext.getBehaviorName("TopDownMovement")).simulateUpKey(); +} +}} + +} + + +{ + +/* Reuse gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2 */ + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtsExt__Gamepads__C_Axis_pushed.func(runtimeScene, (( gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2.length === 0 ) ? 0 :gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getGamepadIdentifier()), "Left", "Down", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2 */ +{for(var i = 0, len = gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2[i].getBehavior(eventsFunctionContext.getBehaviorName("TopDownMovement")).simulateDownKey(); +} +}} + +} + + +};gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.eventsList2 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects2, gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3); + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Gamepads__TopDownGamepadMapper.TopDownGamepadMapper.prototype.doStepPreEventsContext.GDObjectObjects3.length;i + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__TriggerPressure = {}; + + +gdjs.evtsExt__Gamepads__TriggerPressure.userFunc0xd1c978 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +/** @type {Gamepad[]} */ +const gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []); + +//Get function parameters +const playerId = eventsFunctionContext.getArgument("player_ID") - 1; +const trigger = eventsFunctionContext.getArgument("trigger").toUpperCase(); + +if (playerId < 0 || playerId > 4) { + console.error('Parameter gamepad identifier in expression: "Pressure on a gamepad trigger", is not valid number, must be between 0 and 4.'); + return; +} +if (trigger != "LT" && trigger != "RT" && trigger != "L2" && trigger != "R2") { + console.error('Parameter trigger is not valid in expression: "Pressure on a gamepad trigger"'); + return; +} + +const gamepad = gamepads[playerId]; + +//we need keep this condition because when use have not yet plug her controller we can't get the controller in the gamepad variable. +if (gamepad == null) return; + +switch (trigger) { + case 'LT': + case 'L2': + eventsFunctionContext.returnValue = gamepad.buttons[6].value; + break; + + case 'RT': + case 'R2': + eventsFunctionContext.returnValue = gamepad.buttons[7].value; + break; + + default: + eventsFunctionContext.returnValue = -1; + break; +} +}; +gdjs.evtsExt__Gamepads__TriggerPressure.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__TriggerPressure.userFunc0xd1c978(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__TriggerPressure.func = function(runtimeScene, player_ID, trigger, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "player_ID") return player_ID; +if (argName === "trigger") return trigger; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__TriggerPressure.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Gamepads__TriggerPressure.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__gamepads__weakvibrationmagnitude-func.js b/gdjs-evtsext__gamepads__weakvibrationmagnitude-func.js new file mode 100644 index 0000000000000000000000000000000000000000..75d1754225acee61816719863ae403b97b72eb03 --- /dev/null +++ b/gdjs-evtsext__gamepads__weakvibrationmagnitude-func.js @@ -0,0 +1,89 @@ + +if (typeof gdjs.evtsExt__Gamepads__WeakVibrationMagnitude !== "undefined") { + gdjs.evtsExt__Gamepads__WeakVibrationMagnitude.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Gamepads__WeakVibrationMagnitude = {}; + + +gdjs.evtsExt__Gamepads__WeakVibrationMagnitude.userFunc0xd8a7b8 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const playerId = eventsFunctionContext.getArgument("Player_ID") - 1; +eventsFunctionContext.returnValue = gdjs._extensionController.players[playerId].rumble.weakMagnitude; +}; +gdjs.evtsExt__Gamepads__WeakVibrationMagnitude.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Gamepads__WeakVibrationMagnitude.userFunc0xd8a7b8(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Gamepads__WeakVibrationMagnitude.func = function(runtimeScene, Player_ID, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Gamepads"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Gamepads"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Player_ID") return Player_ID; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Gamepads__WeakVibrationMagnitude.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Gamepads__WeakVibrationMagnitude.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__particleemitter3d__definehelperclasses-func.js b/gdjs-evtsext__particleemitter3d__definehelperclasses-func.js new file mode 100644 index 0000000000000000000000000000000000000000..126ec49bec35a5929ff0952d578192923a998f79 --- /dev/null +++ b/gdjs-evtsext__particleemitter3d__definehelperclasses-func.js @@ -0,0 +1,6750 @@ + +if (typeof gdjs.evtsExt__ParticleEmitter3D__DefineHelperClasses !== "undefined") { + gdjs.evtsExt__ParticleEmitter3D__DefineHelperClasses.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ParticleEmitter3D__DefineHelperClasses = {}; + + +gdjs.evtsExt__ParticleEmitter3D__DefineHelperClasses.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +if (gdjs.__particleEmmiter3DExtension) { + return; +} + +class ParticleEmitter3DRenderer extends gdjs.CustomRuntimeObject3DRenderer { + constructor( + object, + instanceContainer, + parent + ) { + super(object, instanceContainer, parent); + } + + _updateThreeGroup() { + const threeObject3D = this.get3DRendererObject(); + + threeObject3D.rotation.set( + gdjs.toRad(this._object.getRotationX()), + gdjs.toRad(this._object.getRotationY()), + -gdjs.toRad(this._object.angle) + ); + + threeObject3D.position.set( + this._object.getX(), + -this._object.getY(), + this._object.getZ() + ); + + threeObject3D.scale.set( + this._object.isFlippedX() ? -1 : 1, + this._object.isFlippedY() ? -1 : 1, + this._object.isFlippedZ() ? -1 : 1 + ); + + threeObject3D.visible = !this._object.hidden; + + this._isContainerDirty = true; + } +} + +/** + * @param {string} colorString + * @param {THREE.Vector4} threeColor + */ +const setThreeColor = (colorString, threeColor = new THREE.Vector4()) => { + const integerColor = gdjs.rgbOrHexToRGBColor(colorString); + threeColor.x = integerColor[0] / 255; + threeColor.y = integerColor[1] / 255; + threeColor.z = integerColor[2] / 255; +}; + +/** + * @param {string} integerOpacity + * @param {THREE.Vector4} threeColor + */ +const setThreeOpacity = (integerOpacity, threeColor = new THREE.Vector4()) => { + threeColor.w = integerOpacity / 255; +}; + +class ParticleEmitterAdapter { + /** + * @param particleSystem {ParticleSystem} + * @param colorOverLife {ColorOverLife} + * @param sizeOverLife {SizeOverLife} + * @param applyForce {ApplyForce} + */ + constructor(particleSystem, colorOverLife, sizeOverLife, applyForce) { + this.particleSystem = particleSystem; + this.colorOverLife = colorOverLife; + this.sizeOverLife = sizeOverLife; + this.applyForce = applyForce; + } + + /** + * @param startColor {string} + */ + setStartColor(startColor) { + setThreeColor(startColor, this.colorOverLife.color.color.keys[0][0]); + } + + /** + * @param endColor {string} + */ + setEndColor(endColor) { + setThreeColor(endColor, this.colorOverLife.color.color.keys[1][0]); + } + + /** + * @param startOpacity {number} + */ + setStartOpacity(startOpacity) { + this.colorOverLife.color.alpha.keys[0][0] = startOpacity / 255; + } + + /** + * @param endOpacity {number} + */ + setEndOpacity(endOpacity) { + this.colorOverLife.color.alpha.keys[1][0] = endOpacity / 255; + } + + /** + * @param flow {number} + */ + setFlow(flow) { + this.particleSystem.emissionOverTime.value = flow; + } + + /** + * @param startMinSize {number} + */ + setStartMinSize(startMinSize) { + this.particleSystem.startSize.a = startMinSize; + } + + /** + * @param startMaxSize {number} + */ + setStartMaxSize(startMaxSize) { + this.particleSystem.startSize.b = startMaxSize; + } + + /** + * @param endScale {number} + */ + setEndScale(endScale) { + /** @type Bezier */ + const bezier = this.sizeOverLife.size.functions[0][0]; + bezier.p[0] = 1; + bezier.p[1] = gdjs.evtTools.common.lerp(1, endScale, 1 / 3); + bezier.p[2] = gdjs.evtTools.common.lerp(1, endScale, 2 / 3); + bezier.p[3] = endScale; + } + + /** + * @param startSpeedMin {number} + */ + setStartSpeedMin(startSpeedMin) { + this.particleSystem.startSpeed.a = startSpeedMin; + } + + /** + * @param startSpeedMax {number} + */ + setStartSpeedMax(startSpeedMax) { + this.particleSystem.startSpeed.b = startSpeedMax; + } + + /** + * @param lifespanMin {number} + */ + setLifespanMin(lifespanMin) { + this.particleSystem.startLife.a = lifespanMin; + } + + /** + * @param lifespanMax {number} + */ + setLifespanMax(lifespanMax) { + this.particleSystem.startLife.b = lifespanMax; + } + + /** + * @param duration {number} + */ + setDuration(duration) { + this.particleSystem.duration = duration || Number.POSITIVE_INFINITY; + } + + /** + * @param areParticlesRelative {boolean} + */ + setParticlesRelative(areParticlesRelative) { + this.particleSystem.worldSpace = !areParticlesRelative; + } + + /** + * @param sprayConeAngle {number} + */ + setSprayConeAngle(sprayConeAngle) { + if (0 < sprayConeAngle && sprayConeAngle <= 180) { + if (!this.particleSystem.emitterShape.angle) { + this.particleSystem.emitterShape = new ConeEmitter({ radius: 0.1, angle: Math.PI / 8 }); + } + this.particleSystem.emitterShape.angle = sprayConeAngle * Math.PI / 180; + } + else { + if (this.particleSystem.emitterShape.angle) { + this.particleSystem.emitterShape = new PointEmitter(); + } + } + } + + /** + * @param blending {string} + */ + setBlending(blendingString) { + const blending = + blendingString === "Additive" ? THREE.AdditiveBlending : + blendingString === "Normal" ? THREE.NormalBlending : + blendingString === "Subtractive" ? THREE.SubtractiveBlending : + blendingString === "Multiply" ? THREE.MultiplyBlending : + blendingString === "None" ? THREE.NoBlending : + THREE.AdditiveBlending; + // TODO This doesn't work. + this.particleSystem.blending = blending; + } + + /** + * @param gravity {number} + */ + setGravity(gravity) { + this.applyForce.magnitude.value = gravity; + } + + /** + * @param gravityTop {string} + */ + setGravityTop(gravityTop) { + // TODO Make gravity absolute even when "relative" is enabled. + switch (gravityTop) { + case "Z+": + this.applyForce.direction.set(0, 0, -1); + break; + + case "Y-": + this.applyForce.direction.set(0, 1, 0); + break; + } + } +} + + + +/** + * three.quarks v0.11.2 build Mon Jan 22 2024 + * https://github.com/Alchemist0823/three.quarks#readme + * Copyright 2024 Alchemist0823 , MIT + */ + +class ParticleEmitter extends THREE.Object3D { + constructor(system) { + super(); + this.type = 'ParticleEmitter'; + this.system = system; + } + clone() { + const system = this.system.clone(); + system.emitter.copy(this, true); + return system.emitter; + } + dispose() { } + extractFromCache(cache) { + const values = []; + for (const key in cache) { + const data = cache[key]; + delete data.metadata; + values.push(data); + } + return values; + } + toJSON(meta, options = {}) { + const isRootObject = meta === undefined || typeof meta === 'string'; + const output = {}; + if (isRootObject) { + meta = { + geometries: {}, + materials: {}, + textures: {}, + images: {}, + shapes: {}, + skeletons: {}, + animations: {}, + nodes: {}, + }; + output.metadata = { + version: 4.5, + type: 'Object', + generator: 'Object3D.toJSON', + }; + } + const object = {}; + object.uuid = this.uuid; + object.type = this.type; + if (this.name !== '') + object.name = this.name; + if (this.castShadow === true) + object.castShadow = true; + if (this.receiveShadow === true) + object.receiveShadow = true; + if (this.visible === false) + object.visible = false; + if (this.frustumCulled === false) + object.frustumCulled = false; + if (this.renderOrder !== 0) + object.renderOrder = this.renderOrder; + if (JSON.stringify(this.userData) !== '{}') + object.userData = this.userData; + object.layers = this.layers.mask; + object.matrix = this.matrix.toArray(); + if (this.matrixAutoUpdate === false) + object.matrixAutoUpdate = false; + if (this.system !== null) + object.ps = this.system.toJSON(meta, options); + if (this.children.length > 0) { + object.children = []; + for (let i = 0; i < this.children.length; i++) { + if (this.children[i].type !== 'ParticleSystemPreview') { + object.children.push(this.children[i].toJSON(meta).object); + } + } + } + if (isRootObject) { + const geometries = this.extractFromCache(meta.geometries); + const materials = this.extractFromCache(meta.materials); + const textures = this.extractFromCache(meta.textures); + const images = this.extractFromCache(meta.images); + if (geometries.length > 0) + output.geometries = geometries; + if (materials.length > 0) + output.materials = materials; + if (textures.length > 0) + output.textures = textures; + if (images.length > 0) + output.images = images; + } + output.object = object; + return output; + } +} + +class LinkedListNode { + constructor(data) { + this.data = data; + this.next = null; + this.prev = null; + } + hasPrev() { + return this.prev !== null; + } + hasNext() { + return this.next !== null; + } +} +class LinkedList { + constructor() { + this.length = 0; + this.head = this.tail = null; + } + isEmpty() { + return this.head === null; + } + clear() { + this.length = 0; + this.head = this.tail = null; + } + front() { + if (this.head === null) + return null; + return this.head.data; + } + back() { + if (this.tail === null) + return null; + return this.tail.data; + } + dequeue() { + if (this.head) { + const value = this.head.data; + this.head = this.head.next; + if (!this.head) { + this.tail = null; + } + else { + this.head.prev = null; + } + this.length--; + return value; + } + return undefined; + } + pop() { + if (this.tail) { + const value = this.tail.data; + this.tail = this.tail.prev; + if (!this.tail) { + this.head = null; + } + else { + this.tail.next = null; + } + this.length--; + return value; + } + return undefined; + } + queue(data) { + const node = new LinkedListNode(data); + if (!this.tail) { + this.tail = node; + } + if (this.head) { + this.head.prev = node; + node.next = this.head; + } + this.head = node; + this.length++; + } + push(data) { + const node = new LinkedListNode(data); + if (!this.head) { + this.head = node; + } + if (this.tail) { + this.tail.next = node; + node.prev = this.tail; + } + this.tail = node; + this.length++; + } + insertBefore(node, data) { + const newNode = new LinkedListNode(data); + newNode.next = node; + newNode.prev = node.prev; + if (newNode.prev !== null) { + newNode.prev.next = newNode; + } + newNode.next.prev = newNode; + if (node == this.head) { + this.head = newNode; + } + this.length++; + } + remove(data) { + if (this.head === null || this.tail === null) { + return; + } + let tempNode = this.head; + if (data === this.head.data) { + this.head = this.head.next; + } + if (data === this.tail.data) { + this.tail = this.tail.prev; + } + while (tempNode.next !== null && tempNode.data !== data) { + tempNode = tempNode.next; + } + if (tempNode.data === data) { + if (tempNode.prev !== null) + tempNode.prev.next = tempNode.next; + if (tempNode.next !== null) + tempNode.next.prev = tempNode.prev; + this.length--; + } + } + *values() { + let current = this.head; + while (current !== null) { + yield current.data; + current = current.next; + } + } +} + +class NodeParticle { + constructor() { + this.position = new THREE.Vector3(); + this.velocity = new THREE.Vector3(); + this.age = 0; + this.life = 1; + this.size = 1; + this.rotation = 0; + this.color = new THREE.Vector4(1, 1, 1, 1); + this.uvTile = 0; + } + get died() { + return this.age >= this.life; + } + reset() { + this.position.set(0, 0, 0); + this.velocity.set(0, 0, 0); + this.age = 0; + this.life = 1; + this.size = 1; + this.rotation = 0; + this.color.set(1, 1, 1, 1); + this.uvTile = 0; + } +} +class SpriteParticle { + constructor() { + this.startSpeed = 0; + this.startColor = new THREE.Vector4(); + this.startSize = 1; + this.position = new THREE.Vector3(); + this.velocity = new THREE.Vector3(); + this.age = 0; + this.life = 1; + this.size = 1; + this.speedModifier = 1; + this.rotation = 0; + this.color = new THREE.Vector4(); + this.uvTile = 0; + } + get died() { + return this.age >= this.life; + } +} +class RecordState { + constructor(position, size, color) { + this.position = position; + this.size = size; + this.color = color; + } +} +class TrailParticle { + constructor() { + this.startSpeed = 0; + this.startColor = new THREE.Vector4(); + this.startSize = 1; + this.position = new THREE.Vector3(); + this.velocity = new THREE.Vector3(); + this.age = 0; + this.life = 1; + this.size = 1; + this.length = 100; + this.speedModifier = 1; + this.color = new THREE.Vector4(); + this.previous = new LinkedList(); + this.uvTile = 0; + } + update() { + if (this.age <= this.life) { + this.previous.push(new RecordState(this.position.clone(), this.size, this.color.clone())); + } + else { + if (this.previous.length > 0) { + this.previous.dequeue(); + } + } + while (this.previous.length > this.length) { + this.previous.dequeue(); + } + } + get died() { + return this.age >= this.life; + } + reset() { + this.previous.clear(); + } +} + +class Bezier { + constructor(p1, p2, p3, p4) { + this.p = [p1, p2, p3, p4]; + } + genValue(t) { + const t2 = t * t; + const t3 = t * t * t; + const mt = 1 - t; + const mt2 = mt * mt; + const mt3 = mt2 * mt; + return this.p[0] * mt3 + this.p[1] * mt2 * t * 3 + this.p[2] * mt * t2 * 3 + this.p[3] * t3; + } + derivativeCoefficients(points) { + const dpoints = []; + for (let p = points, c = p.length - 1; c > 0; c--) { + const list = []; + for (let j = 0; j < c; j++) { + const dpt = c * (p[j + 1] - p[j]); + list.push(dpt); + } + dpoints.push(list); + p = list; + } + return dpoints; + } + getSlope(t) { + const p = this.derivativeCoefficients(this.p)[0]; + const mt = 1 - t; + const a = mt * mt; + const b = mt * t * 2; + const c = t * t; + return a * p[0] + b * p[1] + c * p[2]; + } + controlCurve(d0, d1) { + this.p[1] = d0 / 3 + this.p[0]; + this.p[2] = this.p[3] - d1 / 3; + } + hull(t) { + let p = this.p; + let _p = [], pt, idx = 0, i = 0, l = 0; + const q = []; + q[idx++] = p[0]; + q[idx++] = p[1]; + q[idx++] = p[2]; + q[idx++] = p[3]; + while (p.length > 1) { + _p = []; + for (i = 0, l = p.length - 1; i < l; i++) { + pt = t * p[i] + (1 - t) * p[i + 1]; + q[idx++] = pt; + _p.push(pt); + } + p = _p; + } + return q; + } + split(t) { + const q = this.hull(t); + const result = { + left: new Bezier(q[0], q[4], q[7], q[9]), + right: new Bezier(q[9], q[8], q[6], q[3]), + span: q + }; + return result; + } + clone() { + return new Bezier(this.p[0], this.p[1], this.p[2], this.p[3]); + } + toJSON() { + return { + p0: this.p[0], + p1: this.p[1], + p2: this.p[2], + p3: this.p[3], + }; + } + static fromJSON(json) { + return new Bezier(json.p0, json.p1, json.p2, json.p3); + } +} + +const ColorToJSON = (color) => { + return { r: color.x, g: color.y, b: color.z, a: color.w }; +}; +const JSONToColor = (json) => { + return new THREE.Vector4(json.r, json.g, json.b, json.a); +}; +const JSONToValue = (json, type) => { + switch (type) { + case 'Vector3': + return new THREE.Vector3(json.x, json.y, json.z); + case 'Vector4': + return new THREE.Vector4(json.x, json.y, json.z, json.w); + case 'Color': + return new THREE.Vector3(json.r, json.g, json.b); + case 'Number': + return json; + default: + return json; + } +}; +const ValueToJSON = (value, type) => { + switch (type) { + case 'Vector3': + return { x: value.x, y: value.y, z: value.z }; + case 'Vector4': + return { x: value.x, y: value.y, z: value.z, w: value.w }; + case 'Color': + return { r: value.x, g: value.y, b: value.z }; + case 'Number': + return value; + default: + return value; + } +}; + +class RandomColor { + constructor(a, b) { + this.a = a; + this.b = b; + this.type = "value"; + } + genColor(color) { + const rand = Math.random(); + return color.copy(this.a).lerp(this.b, rand); + } + toJSON() { + return { + type: "RandomColor", + a: ColorToJSON(this.a), + b: ColorToJSON(this.b), + }; + } + static fromJSON(json) { + return new RandomColor(JSONToColor(json.a), JSONToColor(json.b)); + } + clone() { + return new RandomColor(this.a.clone(), this.b.clone()); + } +} + +class ColorRange { + constructor(a, b) { + this.a = a; + this.b = b; + this.type = 'value'; + } + genColor(color, t) { + return color.copy(this.a).lerp(this.b, Math.random()); + } + toJSON() { + return { + type: 'ColorRange', + a: ColorToJSON(this.a), + b: ColorToJSON(this.b), + }; + } + static fromJSON(json) { + return new ColorRange(JSONToColor(json.a), JSONToColor(json.b)); + } + clone() { + return new ColorRange(this.a.clone(), this.b.clone()); + } +} + +class ContinuousLinearFunction { + constructor(keys, subType) { + this.subType = subType; + this.type = 'function'; + this.keys = keys; + } + findKey(t) { + let mid = 0; + let left = 0, right = this.keys.length - 1; + while (left + 1 < right) { + mid = Math.floor((left + right) / 2); + if (t < this.getStartX(mid)) + right = mid - 1; + else if (t > this.getEndX(mid)) + left = mid + 1; + else + return mid; + } + for (let i = left; i <= right; i++) { + if (t >= this.getStartX(i) && t <= this.getEndX(i)) + return i; + } + return -1; + } + getStartX(index) { + return this.keys[index][1]; + } + getEndX(index) { + if (index + 1 < this.keys.length) + return this.keys[index + 1][1]; + return 1; + } + genValue(value, t) { + const index = this.findKey(t); + if (this.subType === 'Number') { + if (index === -1) { + return this.keys[0][0]; + } + else if (index + 1 >= this.keys.length) { + return this.keys[this.keys.length - 1][0]; + } + return ((this.keys[index + 1][0] - this.keys[index][0]) * + ((t - this.getStartX(index)) / (this.getEndX(index) - this.getStartX(index))) + + this.keys[index][0]); + } + else { + if (index === -1) { + return value.copy(this.keys[0][0]); + } + if (index + 1 >= this.keys.length) { + return value.copy(this.keys[this.keys.length - 1][0]); + } + return value + .copy(this.keys[index][0]) + .lerp(this.keys[index + 1][0], (t - this.getStartX(index)) / (this.getEndX(index) - this.getStartX(index))); + } + } + toJSON() { + this.keys[0][0].constructor.name; + return { + type: 'CLinearFunction', + subType: this.subType, + keys: this.keys.map(([color, pos]) => ({ value: ValueToJSON(color, this.subType), pos: pos })), + }; + } + static fromJSON(json) { + return new ContinuousLinearFunction(json.keys.map((pair) => [JSONToValue(pair.value, json.subType), pair.pos]), json.subType); + } + clone() { + if (this.subType === 'Number') { + return new ContinuousLinearFunction(this.keys.map(([value, pos]) => [value, pos]), this.subType); + } + else { + return new ContinuousLinearFunction(this.keys.map(([value, pos]) => [value.clone(), pos]), this.subType); + } + } +} + +const tempVec3 = new THREE.Vector3(); +class Gradient { + constructor(color = [ + [new THREE.Vector3(0, 0, 0), 0], + [new THREE.Vector3(1, 1, 1), 0], + ], alpha = [ + [1, 0], + [1, 1], + ]) { + this.type = 'function'; + this.color = new ContinuousLinearFunction(color, 'Color'); + this.alpha = new ContinuousLinearFunction(alpha, 'Number'); + } + genColor(color, t) { + this.color.genValue(tempVec3, t); + return color.set(tempVec3.x, tempVec3.y, tempVec3.z, this.alpha.genValue(1, t)); + } + toJSON() { + return { + type: 'Gradient', + color: this.color.toJSON(), + alpha: this.alpha.toJSON(), + }; + } + static fromJSON(json) { + if (json.functions) { + const keys = json.functions.map((func) => [ColorRange.fromJSON(func.function).a, func.start]); + if (json.functions.length > 0) { + keys.push([ColorRange.fromJSON(json.functions[json.functions.length - 1].function).b, 1]); + } + return new Gradient(keys.map((key) => [new THREE.Vector3(key[0].x, key[0].y, key[0].z), key[1]]), keys.map((key) => [key[0].w, key[1]])); + } + else { + const gradient = new Gradient(); + gradient.alpha = ContinuousLinearFunction.fromJSON(json.alpha); + gradient.color = ContinuousLinearFunction.fromJSON(json.color); + return gradient; + } + } + clone() { + const gradient = new Gradient(); + gradient.alpha = this.alpha.clone(); + gradient.color = this.color.clone(); + return gradient; + } +} + +const tempColor = new THREE.Vector4(); +class RandomColorBetweenGradient { + constructor(gradient1, gradient2) { + this.type = 'memorizedFunction'; + this.gradient1 = gradient1; + this.gradient2 = gradient2; + } + startGen(memory) { + memory.rand = Math.random(); + } + genColor(color, t, memory) { + this.gradient1.genColor(color, t); + this.gradient2.genColor(tempColor, t); + if (memory && memory.rand) { + color.lerp(tempColor, memory.rand); + } + else { + color.lerp(tempColor, Math.random()); + } + return color; + } + toJSON() { + return { + type: 'RandomColorBetweenGradient', + gradient1: this.gradient1.toJSON(), + gradient2: this.gradient2.toJSON(), + }; + } + static fromJSON(json) { + return new RandomColorBetweenGradient(Gradient.fromJSON(json.gradient1), Gradient.fromJSON(json.gradient2)); + } + clone() { + return new RandomColorBetweenGradient(this.gradient1.clone(), this.gradient2.clone()); + } +} + +class ConstantColor { + constructor(color) { + this.color = color; + this.type = 'value'; + } + genColor(color) { + return color.copy(this.color); + } + toJSON() { + return { + type: 'ConstantColor', + color: ColorToJSON(this.color), + }; + } + static fromJSON(json) { + return new ConstantColor(JSONToColor(json.color)); + } + clone() { + return new ConstantColor(this.color.clone()); + } +} +function ColorGeneratorFromJSON(json) { + switch (json.type) { + case 'ConstantColor': + return ConstantColor.fromJSON(json); + case 'ColorRange': + return ColorRange.fromJSON(json); + case 'RandomColor': + return RandomColor.fromJSON(json); + case 'Gradient': + return Gradient.fromJSON(json); + case 'RandomColorBetweenGradient': + return RandomColorBetweenGradient.fromJSON(json); + default: + return new ConstantColor(new THREE.Vector4(1, 1, 1, 1)); + } +} + +class ConstantValue { + constructor(value) { + this.value = value; + this.type = 'value'; + } + genValue() { + return this.value; + } + toJSON() { + return { + type: "ConstantValue", + value: this.value + }; + } + static fromJSON(json) { + return new ConstantValue(json.value); + } + clone() { + return new ConstantValue(this.value); + } +} + +class IntervalValue { + constructor(a, b) { + this.a = a; + this.b = b; + this.type = 'value'; + } + genValue() { + return THREE.MathUtils.lerp(this.a, this.b, Math.random()); + } + toJSON() { + return { + type: 'IntervalValue', + a: this.a, + b: this.b, + }; + } + static fromJSON(json) { + return new IntervalValue(json.a, json.b); + } + clone() { + return new IntervalValue(this.a, this.b); + } +} + +class PiecewiseFunction { + constructor() { + this.functions = new Array(); + } + findFunction(t) { + let mid = 0; + let left = 0, right = this.functions.length - 1; + while (left + 1 < right) { + mid = Math.floor((left + right) / 2); + if (t < this.getStartX(mid)) + right = mid - 1; + else if (t > this.getEndX(mid)) + left = mid + 1; + else + return mid; + } + for (let i = left; i <= right; i++) { + if (t >= this.functions[i][1] && t <= this.getEndX(i)) + return i; + } + return -1; + } + getStartX(index) { + return this.functions[index][1]; + } + setStartX(index, x) { + if (index > 0) + this.functions[index][1] = x; + } + getEndX(index) { + if (index + 1 < this.functions.length) + return this.functions[index + 1][1]; + return 1; + } + setEndX(index, x) { + if (index + 1 < this.functions.length) + this.functions[index + 1][1] = x; + } + insertFunction(t, func) { + const index = this.findFunction(t); + this.functions.splice(index + 1, 0, [func, t]); + } + removeFunction(index) { + return this.functions.splice(index, 1)[0][0]; + } + getFunction(index) { + return this.functions[index][0]; + } + setFunction(index, func) { + this.functions[index][0] = func; + } + get numOfFunctions() { + return this.functions.length; + } +} + +class PiecewiseBezier extends PiecewiseFunction { + constructor(curves = [[new Bezier(0, 1.0 / 3, 1.0 / 3 * 2, 1), 0]]) { + super(); + this.type = "function"; + this.functions = curves; + } + genValue(t = 0) { + const index = this.findFunction(t); + if (index === -1) { + return 0; + } + return this.functions[index][0].genValue((t - this.getStartX(index)) / (this.getEndX(index) - this.getStartX(index))); + } + toSVG(length, segments) { + if (segments < 1) + return ""; + let result = ["M", 0, this.functions[0][0].p[0]].join(" "); + for (let i = 1.0 / segments; i <= 1; i += 1.0 / segments) { + result = [result, "L", i * length, this.genValue(i)].join(" "); + } + return result; + } + toJSON() { + return { + type: "PiecewiseBezier", + functions: this.functions.map(([bezier, start]) => ({ function: bezier.toJSON(), start: start })), + }; + } + static fromJSON(json) { + return new PiecewiseBezier(json.functions.map((piecewiseFunction) => ([Bezier.fromJSON(piecewiseFunction.function), piecewiseFunction.start]))); + } + clone() { + return new PiecewiseBezier(this.functions.map(([bezier, start]) => ([bezier.clone(), start]))); + } +} + +function ValueGeneratorFromJSON(json) { + switch (json.type) { + case 'ConstantValue': + return ConstantValue.fromJSON(json); + case 'IntervalValue': + return IntervalValue.fromJSON(json); + case 'PiecewiseBezier': + return PiecewiseBezier.fromJSON(json); + default: + return new ConstantValue(0); + } +} + +class RandomQuatGenerator { + constructor() { + this.type = "rotation"; + } + genValue(quat, t) { + let x, y, z, u, v, w; + do { + x = Math.random() * 2 - 1; + y = Math.random() * 2 - 1; + z = x * x + y * y; + } while (z > 1); + do { + u = Math.random() * 2 - 1; + v = Math.random() * 2 - 1; + w = u * u + v * v; + } while (w > 1); + const s = Math.sqrt((1 - z) / w); + quat.set(x, y, s * u, s * v); + return quat; + } + toJSON() { + return { + type: "RandomQuat" + }; + } + static fromJSON(json) { + return new RandomQuatGenerator(); + } + clone() { + return new RandomQuatGenerator(); + } +} + +class AxisAngleGenerator { + constructor(axis, angle) { + this.axis = axis; + this.angle = angle; + this.type = 'rotation'; + } + genValue(quat, t) { + return quat.setFromAxisAngle(this.axis, this.angle.genValue(t)); + } + toJSON() { + return { + type: 'AxisAngle', + axis: { x: this.axis.x, y: this.axis.y, z: this.axis.z }, + angle: this.angle.toJSON(), + }; + } + static fromJSON(json) { + return new AxisAngleGenerator(new THREE.Vector3(json.axis.x, json.axis.y, json.axis.z), ValueGeneratorFromJSON(json.angle)); + } + clone() { + return new AxisAngleGenerator(this.axis.clone(), this.angle.clone()); + } +} + +class EulerGenerator { + constructor(angleX, angleY, angleZ, eulerOrder) { + this.angleX = angleX; + this.angleY = angleY; + this.angleZ = angleZ; + this.type = 'rotation'; + this.eular = new THREE.Euler(0, 0, 0, eulerOrder); + } + genValue(quat, t) { + this.eular.set(this.angleX.genValue(t), this.angleY.genValue(t), this.angleZ.genValue(t)); + return quat.setFromEuler(this.eular); + } + toJSON() { + return { + type: 'Euler', + angleX: this.angleX.toJSON(), + angleY: this.angleY.toJSON(), + angleZ: this.angleZ.toJSON(), + eulerOrder: this.eular.order, + }; + } + static fromJSON(json) { + return new EulerGenerator(ValueGeneratorFromJSON(json.angleX), ValueGeneratorFromJSON(json.angleY), ValueGeneratorFromJSON(json.angleZ), json.eulerOrder); + } + clone() { + return new EulerGenerator(this.angleX, this.angleY, this.angleZ, this.eular.order); + } +} + +function RotationGeneratorFromJSON(json) { + switch (json.type) { + case 'AxisAngle': + return AxisAngleGenerator.fromJSON(json); + case 'Euler': + return EulerGenerator.fromJSON(json); + case 'RandomQuat': + return RandomQuatGenerator.fromJSON(json); + default: + return new RandomQuatGenerator(); + } +} + +function GeneratorFromJSON(json) { + switch (json.type) { + case 'ConstantValue': + case 'IntervalValue': + case 'PiecewiseBezier': + return ValueGeneratorFromJSON(json); + case 'AxisAngle': + case 'RandomQuat': + case 'Euler': + return RotationGeneratorFromJSON(json); + default: + return new ConstantValue(0); + } +} + +class ColorOverLife { + constructor(color) { + this.color = color; + this.type = 'ColorOverLife'; + } + initialize(particle) { + if (this.color.type === 'memorizedFunction') { + particle.colorOverLifeMemory = {}; + this.color.startGen(particle.colorOverLifeMemory); + } + } + update(particle, delta) { + if (this.color.type === 'memorizedFunction') { + this.color.genColor(particle.color, particle.age / particle.life, particle.colorOverLifeMemory); + } + else { + this.color.genColor(particle.color, particle.age / particle.life); + } + particle.color.x *= particle.startColor.x; + particle.color.y *= particle.startColor.y; + particle.color.z *= particle.startColor.z; + particle.color.w *= particle.startColor.w; + } + frameUpdate(delta) { } + toJSON() { + return { + type: this.type, + color: this.color.toJSON(), + }; + } + static fromJSON(json) { + return new ColorOverLife(ColorGeneratorFromJSON(json.color)); + } + clone() { + return new ColorOverLife(this.color.clone()); + } + reset() { } +} + +class RotationOverLife { + constructor(angularVelocity) { + this.angularVelocity = angularVelocity; + this.type = 'RotationOverLife'; + this.dynamic = !(angularVelocity instanceof ConstantValue || angularVelocity instanceof IntervalValue); + } + initialize(particle) { + this.dynamic = !(this.angularVelocity instanceof ConstantValue || this.angularVelocity instanceof IntervalValue); + if (!this.dynamic && typeof particle.rotation === 'number') { + particle.angularVelocity = this.angularVelocity.genValue(); + } + } + update(particle, delta) { + if (!this.dynamic) { + if (typeof particle.rotation === 'number') { + particle.rotation += delta * particle.angularVelocity; + } + } + else { + if (typeof particle.rotation === 'number') { + particle.rotation += + delta * this.angularVelocity.genValue(particle.age / particle.life); + } + } + } + toJSON() { + return { + type: this.type, + angularVelocity: this.angularVelocity.toJSON(), + }; + } + static fromJSON(json) { + return new RotationOverLife(ValueGeneratorFromJSON(json.angularVelocity)); + } + frameUpdate(delta) { } + clone() { + return new RotationOverLife(this.angularVelocity.clone()); + } + reset() { } +} + +const IdentityQuaternion = new THREE.Quaternion(); +class Rotation3DOverLife { + constructor(angularVelocity) { + this.angularVelocity = angularVelocity; + this.type = 'Rotation3DOverLife'; + this.tempQuat = new THREE.Quaternion(); + this.dynamic = !(angularVelocity instanceof RandomQuatGenerator); + } + initialize(particle) { + this.dynamic = !(this.angularVelocity instanceof RandomQuatGenerator); + if (particle.rotation instanceof THREE.Quaternion) { + particle.angularVelocity = new THREE.Quaternion(); + this.angularVelocity.genValue(particle.angularVelocity); + } + } + update(particle, delta) { + if (particle.rotation instanceof THREE.Quaternion) { + if (!this.dynamic) { + this.tempQuat.slerpQuaternions(IdentityQuaternion, particle.angularVelocity, delta); + particle.rotation.multiply(this.tempQuat); + } + else { + this.angularVelocity.genValue(this.tempQuat, particle.age / particle.life); + this.tempQuat.slerpQuaternions(IdentityQuaternion, this.tempQuat, delta); + particle.rotation.multiply(this.tempQuat); + } + } + } + toJSON() { + return { + type: this.type, + angularVelocity: this.angularVelocity.toJSON(), + }; + } + static fromJSON(json) { + return new Rotation3DOverLife(RotationGeneratorFromJSON(json.angularVelocity)); + } + frameUpdate(delta) { } + clone() { + return new Rotation3DOverLife(this.angularVelocity.clone()); + } + reset() { } +} + +class ForceOverLife { + initialize(particle) { } + constructor(x, y, z) { + this.x = x; + this.y = y; + this.z = z; + this.type = 'ForceOverLife'; + this._temp = new THREE.Vector3(); + } + update(particle, delta) { + this._temp.set(this.x.genValue(particle.age / particle.life), this.y.genValue(particle.age / particle.life), this.z.genValue(particle.age / particle.life)); + particle.velocity.addScaledVector(this._temp, delta); + } + toJSON() { + return { + type: this.type, + x: this.x.toJSON(), + y: this.y.toJSON(), + z: this.z.toJSON(), + }; + } + static fromJSON(json) { + return new ForceOverLife(ValueGeneratorFromJSON(json.x), ValueGeneratorFromJSON(json.y), ValueGeneratorFromJSON(json.z)); + } + frameUpdate(delta) { } + clone() { + return new ForceOverLife(this.x.clone(), this.y.clone(), this.z.clone()); + } + reset() { } +} + +class SizeOverLife { + initialize(particle) { + } + constructor(size) { + this.size = size; + this.type = 'SizeOverLife'; + } + update(particle) { + particle.size = particle.startSize * this.size.genValue(particle.age / particle.life); + } + toJSON() { + return { + type: this.type, + size: this.size.toJSON(), + }; + } + static fromJSON(json) { + return new SizeOverLife(ValueGeneratorFromJSON(json.size)); + } + frameUpdate(delta) { + } + clone() { + return new SizeOverLife(this.size.clone()); + } + reset() { + } +} + +class SpeedOverLife { + initialize(particle) { + } + constructor(speed) { + this.speed = speed; + this.type = 'SpeedOverLife'; + } + update(particle) { + particle.speedModifier = this.speed.genValue(particle.age / particle.life); + } + toJSON() { + return { + type: this.type, + speed: this.speed.toJSON(), + }; + } + static fromJSON(json) { + return new SpeedOverLife(ValueGeneratorFromJSON(json.speed)); + } + frameUpdate(delta) { + } + clone() { + return new SpeedOverLife(this.speed.clone()); + } + reset() { + } +} + +class FrameOverLife { + constructor(frame) { + this.frame = frame; + this.type = 'FrameOverLife'; + } + initialize(particle) { + if (!(this.frame instanceof PiecewiseBezier)) { + particle.uvTile = Math.floor(this.frame.genValue(0) + 0.001); + } + } + update(particle, delta) { + if (this.frame instanceof PiecewiseBezier) { + particle.uvTile = Math.floor(this.frame.genValue(particle.age / particle.life) + 0.001); + } + } + frameUpdate(delta) { } + toJSON() { + return { + type: this.type, + frame: this.frame.toJSON(), + }; + } + static fromJSON(json) { + return new FrameOverLife(ValueGeneratorFromJSON(json.frame)); + } + clone() { + return new FrameOverLife(this.frame.clone()); + } + reset() { } +} + +new THREE.Vector3(0, 0, 1); +class OrbitOverLife { + constructor(orbitSpeed, axis = new THREE.Vector3(0, 1, 0)) { + this.orbitSpeed = orbitSpeed; + this.axis = axis; + this.type = 'OrbitOverLife'; + this.temp = new THREE.Vector3(); + this.rotation = new THREE.Quaternion(); + this.line = new THREE.Line3(); + } + initialize(particle) { + } + update(particle, delta) { + this.line.set(new THREE.Vector3(0, 0, 0), this.axis); + this.line.closestPointToPoint(particle.position, false, this.temp); + this.rotation.setFromAxisAngle(this.axis, this.orbitSpeed.genValue(particle.age / particle.life) * delta); + particle.position.sub(this.temp); + particle.position.applyQuaternion(this.rotation); + particle.position.add(this.temp); + } + frameUpdate(delta) { + } + toJSON() { + return { + type: this.type, + orbitSpeed: this.orbitSpeed.toJSON(), + axis: [this.axis.x, this.axis.y, this.axis.z], + }; + } + static fromJSON(json) { + return new OrbitOverLife(ValueGeneratorFromJSON(json.orbitSpeed), json.axis ? new THREE.Vector3(json.axis[0], json.axis[1], json.axis[2]) : undefined); + } + clone() { + return new OrbitOverLife(this.orbitSpeed.clone()); + } + reset() { + } +} + +class WidthOverLength { + initialize(particle) { + } + constructor(width) { + this.width = width; + this.type = 'WidthOverLength'; + } + update(particle) { + if (particle instanceof TrailParticle) { + const iter = particle.previous.values(); + for (let i = 0; i < particle.previous.length; i++) { + const cur = iter.next(); + cur.value.size = this.width.genValue((particle.previous.length - i) / particle.length); + } + } + } + frameUpdate(delta) { + } + toJSON() { + return { + type: this.type, + width: this.width.toJSON(), + }; + } + static fromJSON(json) { + return new WidthOverLength(ValueGeneratorFromJSON(json.width)); + } + clone() { + return new WidthOverLength(this.width.clone()); + } + reset() { + } +} + +class ApplyForce { + constructor(direction, magnitude) { + this.direction = direction; + this.magnitude = magnitude; + this.type = 'ApplyForce'; + this.magnitudeValue = this.magnitude.genValue(); + } + initialize(particle) { + } + update(particle, delta) { + particle.velocity.addScaledVector(this.direction, this.magnitudeValue * delta); + } + frameUpdate(delta) { + this.magnitudeValue = this.magnitude.genValue(); + } + toJSON() { + return { + type: this.type, + direction: [this.direction.x, this.direction.y, this.direction.z], + magnitude: this.magnitude.toJSON(), + }; + } + static fromJSON(json) { + var _a; + return new ApplyForce(new THREE.Vector3(json.direction[0], json.direction[1], json.direction[2]), ValueGeneratorFromJSON((_a = json.magnitude) !== null && _a !== void 0 ? _a : json.force)); + } + clone() { + return new ApplyForce(this.direction.clone(), this.magnitude.clone()); + } + reset() { + } +} + +class GravityForce { + constructor(center, magnitude) { + this.center = center; + this.magnitude = magnitude; + this.type = 'GravityForce'; + this.temp = new THREE.Vector3(); + } + initialize(particle) { + } + update(particle, delta) { + this.temp.copy(this.center).sub(particle.position).normalize(); + particle.velocity.addScaledVector(this.temp, this.magnitude / particle.position.distanceToSquared(this.center) * delta); + } + frameUpdate(delta) { + } + toJSON() { + return { + type: this.type, + center: [this.center.x, this.center.y, this.center.z], + magnitude: this.magnitude, + }; + } + static fromJSON(json) { + return new GravityForce(new THREE.Vector3(json.center[0], json.center[1], json.center[2]), json.magnitude); + } + clone() { + return new GravityForce(this.center.clone(), this.magnitude); + } + reset() { + } +} + +new THREE.Vector3(0, 0, 1); +class ChangeEmitDirection { + constructor(angle) { + this.angle = angle; + this.type = 'ChangeEmitDirection'; + this._temp = new THREE.Vector3(); + this._q = new THREE.Quaternion(); + } + initialize(particle) { + const len = particle.velocity.length(); + if (len == 0) + return; + particle.velocity.normalize(); + if (particle.velocity.x === 0 && particle.velocity.y === 0) { + this._temp.set(0, particle.velocity.z, 0); + } + else { + this._temp.set(-particle.velocity.y, particle.velocity.x, 0); + } + this._q.setFromAxisAngle(this._temp.normalize(), this.angle.genValue()); + this._temp.copy(particle.velocity); + particle.velocity.applyQuaternion(this._q); + this._q.setFromAxisAngle(this._temp, Math.random() * Math.PI * 2); + particle.velocity.applyQuaternion(this._q); + particle.velocity.setLength(len); + } + update(particle, delta) { + } + frameUpdate(delta) { + } + toJSON() { + return { + type: this.type, + angle: this.angle.toJSON(), + }; + } + static fromJSON(json) { + return new ChangeEmitDirection(ValueGeneratorFromJSON(json.angle)); + } + clone() { + return new ChangeEmitDirection(this.angle); + } + reset() { + } +} + +const VECTOR_ONE = new THREE.Vector3(1, 1, 1); +const VECTOR_Z = new THREE.Vector3(0, 0, 1); +let SubParticleEmitMode = void 0; +(function (SubParticleEmitMode) { + SubParticleEmitMode[SubParticleEmitMode["Death"] = 0] = "Death"; + SubParticleEmitMode[SubParticleEmitMode["Birth"] = 1] = "Birth"; + SubParticleEmitMode[SubParticleEmitMode["Frame"] = 2] = "Frame"; +})(SubParticleEmitMode || (SubParticleEmitMode = {})); +class EmitSubParticleSystem { + constructor(particleSystem, useVelocityAsBasis, subParticleSystem, mode = SubParticleEmitMode.Frame, emitProbability = 1) { + this.particleSystem = particleSystem; + this.useVelocityAsBasis = useVelocityAsBasis; + this.subParticleSystem = subParticleSystem; + this.mode = mode; + this.emitProbability = emitProbability; + this.type = 'EmitSubParticleSystem'; + this.q_ = new THREE.Quaternion(); + this.v_ = new THREE.Vector3(); + this.v2_ = new THREE.Vector3(); + this.subEmissions = new Array(); + if (this.subParticleSystem && this.subParticleSystem.system) { + this.subParticleSystem.system.onlyUsedByOther = true; + } + } + initialize(particle) { + } + update(particle, delta) { + if (this.mode === SubParticleEmitMode.Frame) { + this.emit(particle, delta); + } + else if (this.mode === SubParticleEmitMode.Birth && particle.age === 0) { + this.emit(particle, delta); + } + else if (this.mode === SubParticleEmitMode.Death && particle.age + delta >= particle.life) { + this.emit(particle, delta); + } + } + emit(particle, delta) { + if (!this.subParticleSystem) + return; + if (Math.random() > this.emitProbability) { + return; + } + const m = new THREE.Matrix4(); + this.setMatrixFromParticle(m, particle); + this.subEmissions.push({ + burstIndex: 0, + burstWaveIndex: 0, + time: 0, + waitEmiting: 0, + matrix: m, + travelDistance: 0, + particle: particle, + }); + } + frameUpdate(delta) { + if (!this.subParticleSystem) + return; + for (let i = 0; i < this.subEmissions.length; i++) { + if (this.subEmissions[i].time >= this.subParticleSystem.system.duration) { + this.subEmissions[i] = this.subEmissions[this.subEmissions.length - 1]; + this.subEmissions.length = this.subEmissions.length - 1; + i--; + } + else { + let subEmissionState = this.subEmissions[i]; + if (subEmissionState.particle && subEmissionState.particle.age < subEmissionState.particle.life) { + this.setMatrixFromParticle(subEmissionState.matrix, subEmissionState.particle); + } + else { + subEmissionState.particle = undefined; + } + this.subParticleSystem.system.emit(delta, subEmissionState, subEmissionState.matrix); + } + } + } + toJSON() { + return { + type: this.type, + subParticleSystem: this.subParticleSystem ? this.subParticleSystem.uuid : '', + useVelocityAsBasis: this.useVelocityAsBasis, + mode: this.mode, + emitProbability: this.emitProbability, + }; + } + static fromJSON(json, particleSystem) { + return new EmitSubParticleSystem(particleSystem, json.useVelocityAsBasis, json.subParticleSystem, json.mode, json.emitProbability); + } + clone() { + return new EmitSubParticleSystem(this.particleSystem, this.useVelocityAsBasis, this.subParticleSystem, this.mode, this.emitProbability); + } + reset() { } + setMatrixFromParticle(m, particle) { + let rotation; + if (particle.rotation === undefined || this.useVelocityAsBasis) { + if (particle.velocity.x === 0 && + particle.velocity.y === 0 && + (particle.velocity.z === 1 || particle.velocity.z === 0)) { + m.set(1, 0, 0, particle.position.x, 0, 1, 0, particle.position.y, 0, 0, 1, particle.position.z, 0, 0, 0, 1); + } + else { + this.v_.copy(VECTOR_Z).cross(particle.velocity); + this.v2_.copy(particle.velocity).cross(this.v_); + const len = this.v_.length(); + const len2 = this.v2_.length(); + m.set(this.v_.x / len, this.v2_.x / len2, particle.velocity.x, particle.position.x, this.v_.y / len, this.v2_.y / len2, particle.velocity.y, particle.position.y, this.v_.z / len, this.v2_.z / len2, particle.velocity.z, particle.position.z, 0, 0, 0, 1); + } + } + else { + if (particle.rotation instanceof THREE.Quaternion) { + rotation = particle.rotation; + } + else { + this.q_.setFromAxisAngle(VECTOR_Z, particle.rotation); + rotation = this.q_; + } + m.compose(particle.position, rotation, VECTOR_ONE); + } + if (!this.particleSystem.worldSpace) { + m.multiplyMatrices(this.particleSystem.emitter.matrixWorld, m); + } + } +} + +const F2 = 0.5 * (Math.sqrt(3.0) - 1.0); +const G2 = (3.0 - Math.sqrt(3.0)) / 6.0; +const F3 = 1.0 / 3.0; +const G3 = 1.0 / 6.0; +const F4 = (Math.sqrt(5.0) - 1.0) / 4.0; +const G4 = (5.0 - Math.sqrt(5.0)) / 20.0; +const grad3 = new Float32Array([1, 1, 0, + -1, 1, 0, + 1, -1, 0, + -1, -1, 0, + 1, 0, 1, + -1, 0, 1, + 1, 0, -1, + -1, 0, -1, + 0, 1, 1, + 0, -1, 1, + 0, 1, -1, + 0, -1, -1]); +const grad4 = new Float32Array([0, 1, 1, 1, 0, 1, 1, -1, 0, 1, -1, 1, 0, 1, -1, -1, + 0, -1, 1, 1, 0, -1, 1, -1, 0, -1, -1, 1, 0, -1, -1, -1, + 1, 0, 1, 1, 1, 0, 1, -1, 1, 0, -1, 1, 1, 0, -1, -1, + -1, 0, 1, 1, -1, 0, 1, -1, -1, 0, -1, 1, -1, 0, -1, -1, + 1, 1, 0, 1, 1, 1, 0, -1, 1, -1, 0, 1, 1, -1, 0, -1, + -1, 1, 0, 1, -1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, -1, + 1, 1, 1, 0, 1, 1, -1, 0, 1, -1, 1, 0, 1, -1, -1, 0, + -1, 1, 1, 0, -1, 1, -1, 0, -1, -1, 1, 0, -1, -1, -1, 0]); +class SimplexNoise { + constructor(randomOrSeed = Math.random) { + const random = typeof randomOrSeed == 'function' ? randomOrSeed : alea(randomOrSeed); + this.p = buildPermutationTable(random); + this.perm = new Uint8Array(512); + this.permMod12 = new Uint8Array(512); + for (let i = 0; i < 512; i++) { + this.perm[i] = this.p[i & 255]; + this.permMod12[i] = this.perm[i] % 12; + } + } + noise2D(x, y) { + const permMod12 = this.permMod12; + const perm = this.perm; + let n0 = 0; + let n1 = 0; + let n2 = 0; + const s = (x + y) * F2; + const i = Math.floor(x + s); + const j = Math.floor(y + s); + const t = (i + j) * G2; + const X0 = i - t; + const Y0 = j - t; + const x0 = x - X0; + const y0 = y - Y0; + let i1, j1; + if (x0 > y0) { + i1 = 1; + j1 = 0; + } + else { + i1 = 0; + j1 = 1; + } + const x1 = x0 - i1 + G2; + const y1 = y0 - j1 + G2; + const x2 = x0 - 1.0 + 2.0 * G2; + const y2 = y0 - 1.0 + 2.0 * G2; + const ii = i & 255; + const jj = j & 255; + let t0 = 0.5 - x0 * x0 - y0 * y0; + if (t0 >= 0) { + const gi0 = permMod12[ii + perm[jj]] * 3; + t0 *= t0; + n0 = t0 * t0 * (grad3[gi0] * x0 + grad3[gi0 + 1] * y0); + } + let t1 = 0.5 - x1 * x1 - y1 * y1; + if (t1 >= 0) { + const gi1 = permMod12[ii + i1 + perm[jj + j1]] * 3; + t1 *= t1; + n1 = t1 * t1 * (grad3[gi1] * x1 + grad3[gi1 + 1] * y1); + } + let t2 = 0.5 - x2 * x2 - y2 * y2; + if (t2 >= 0) { + const gi2 = permMod12[ii + 1 + perm[jj + 1]] * 3; + t2 *= t2; + n2 = t2 * t2 * (grad3[gi2] * x2 + grad3[gi2 + 1] * y2); + } + return 70.0 * (n0 + n1 + n2); + } + noise3D(x, y, z) { + const permMod12 = this.permMod12; + const perm = this.perm; + let n0, n1, n2, n3; + const s = (x + y + z) * F3; + const i = Math.floor(x + s); + const j = Math.floor(y + s); + const k = Math.floor(z + s); + const t = (i + j + k) * G3; + const X0 = i - t; + const Y0 = j - t; + const Z0 = k - t; + const x0 = x - X0; + const y0 = y - Y0; + const z0 = z - Z0; + let i1, j1, k1; + let i2, j2, k2; + if (x0 >= y0) { + if (y0 >= z0) { + i1 = 1; + j1 = 0; + k1 = 0; + i2 = 1; + j2 = 1; + k2 = 0; + } + else if (x0 >= z0) { + i1 = 1; + j1 = 0; + k1 = 0; + i2 = 1; + j2 = 0; + k2 = 1; + } + else { + i1 = 0; + j1 = 0; + k1 = 1; + i2 = 1; + j2 = 0; + k2 = 1; + } + } + else { + if (y0 < z0) { + i1 = 0; + j1 = 0; + k1 = 1; + i2 = 0; + j2 = 1; + k2 = 1; + } + else if (x0 < z0) { + i1 = 0; + j1 = 1; + k1 = 0; + i2 = 0; + j2 = 1; + k2 = 1; + } + else { + i1 = 0; + j1 = 1; + k1 = 0; + i2 = 1; + j2 = 1; + k2 = 0; + } + } + const x1 = x0 - i1 + G3; + const y1 = y0 - j1 + G3; + const z1 = z0 - k1 + G3; + const x2 = x0 - i2 + 2.0 * G3; + const y2 = y0 - j2 + 2.0 * G3; + const z2 = z0 - k2 + 2.0 * G3; + const x3 = x0 - 1.0 + 3.0 * G3; + const y3 = y0 - 1.0 + 3.0 * G3; + const z3 = z0 - 1.0 + 3.0 * G3; + const ii = i & 255; + const jj = j & 255; + const kk = k & 255; + let t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0; + if (t0 < 0) + n0 = 0.0; + else { + const gi0 = permMod12[ii + perm[jj + perm[kk]]] * 3; + t0 *= t0; + n0 = t0 * t0 * (grad3[gi0] * x0 + grad3[gi0 + 1] * y0 + grad3[gi0 + 2] * z0); + } + let t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1; + if (t1 < 0) + n1 = 0.0; + else { + const gi1 = permMod12[ii + i1 + perm[jj + j1 + perm[kk + k1]]] * 3; + t1 *= t1; + n1 = t1 * t1 * (grad3[gi1] * x1 + grad3[gi1 + 1] * y1 + grad3[gi1 + 2] * z1); + } + let t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2; + if (t2 < 0) + n2 = 0.0; + else { + const gi2 = permMod12[ii + i2 + perm[jj + j2 + perm[kk + k2]]] * 3; + t2 *= t2; + n2 = t2 * t2 * (grad3[gi2] * x2 + grad3[gi2 + 1] * y2 + grad3[gi2 + 2] * z2); + } + let t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3; + if (t3 < 0) + n3 = 0.0; + else { + const gi3 = permMod12[ii + 1 + perm[jj + 1 + perm[kk + 1]]] * 3; + t3 *= t3; + n3 = t3 * t3 * (grad3[gi3] * x3 + grad3[gi3 + 1] * y3 + grad3[gi3 + 2] * z3); + } + return 32.0 * (n0 + n1 + n2 + n3); + } + noise4D(x, y, z, w) { + const perm = this.perm; + let n0, n1, n2, n3, n4; + const s = (x + y + z + w) * F4; + const i = Math.floor(x + s); + const j = Math.floor(y + s); + const k = Math.floor(z + s); + const l = Math.floor(w + s); + const t = (i + j + k + l) * G4; + const X0 = i - t; + const Y0 = j - t; + const Z0 = k - t; + const W0 = l - t; + const x0 = x - X0; + const y0 = y - Y0; + const z0 = z - Z0; + const w0 = w - W0; + let rankx = 0; + let ranky = 0; + let rankz = 0; + let rankw = 0; + if (x0 > y0) + rankx++; + else + ranky++; + if (x0 > z0) + rankx++; + else + rankz++; + if (x0 > w0) + rankx++; + else + rankw++; + if (y0 > z0) + ranky++; + else + rankz++; + if (y0 > w0) + ranky++; + else + rankw++; + if (z0 > w0) + rankz++; + else + rankw++; + const i1 = rankx >= 3 ? 1 : 0; + const j1 = ranky >= 3 ? 1 : 0; + const k1 = rankz >= 3 ? 1 : 0; + const l1 = rankw >= 3 ? 1 : 0; + const i2 = rankx >= 2 ? 1 : 0; + const j2 = ranky >= 2 ? 1 : 0; + const k2 = rankz >= 2 ? 1 : 0; + const l2 = rankw >= 2 ? 1 : 0; + const i3 = rankx >= 1 ? 1 : 0; + const j3 = ranky >= 1 ? 1 : 0; + const k3 = rankz >= 1 ? 1 : 0; + const l3 = rankw >= 1 ? 1 : 0; + const x1 = x0 - i1 + G4; + const y1 = y0 - j1 + G4; + const z1 = z0 - k1 + G4; + const w1 = w0 - l1 + G4; + const x2 = x0 - i2 + 2.0 * G4; + const y2 = y0 - j2 + 2.0 * G4; + const z2 = z0 - k2 + 2.0 * G4; + const w2 = w0 - l2 + 2.0 * G4; + const x3 = x0 - i3 + 3.0 * G4; + const y3 = y0 - j3 + 3.0 * G4; + const z3 = z0 - k3 + 3.0 * G4; + const w3 = w0 - l3 + 3.0 * G4; + const x4 = x0 - 1.0 + 4.0 * G4; + const y4 = y0 - 1.0 + 4.0 * G4; + const z4 = z0 - 1.0 + 4.0 * G4; + const w4 = w0 - 1.0 + 4.0 * G4; + const ii = i & 255; + const jj = j & 255; + const kk = k & 255; + const ll = l & 255; + let t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0; + if (t0 < 0) + n0 = 0.0; + else { + const gi0 = (perm[ii + perm[jj + perm[kk + perm[ll]]]] % 32) * 4; + t0 *= t0; + n0 = t0 * t0 * (grad4[gi0] * x0 + grad4[gi0 + 1] * y0 + grad4[gi0 + 2] * z0 + grad4[gi0 + 3] * w0); + } + let t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1; + if (t1 < 0) + n1 = 0.0; + else { + const gi1 = (perm[ii + i1 + perm[jj + j1 + perm[kk + k1 + perm[ll + l1]]]] % 32) * 4; + t1 *= t1; + n1 = t1 * t1 * (grad4[gi1] * x1 + grad4[gi1 + 1] * y1 + grad4[gi1 + 2] * z1 + grad4[gi1 + 3] * w1); + } + let t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2; + if (t2 < 0) + n2 = 0.0; + else { + const gi2 = (perm[ii + i2 + perm[jj + j2 + perm[kk + k2 + perm[ll + l2]]]] % 32) * 4; + t2 *= t2; + n2 = t2 * t2 * (grad4[gi2] * x2 + grad4[gi2 + 1] * y2 + grad4[gi2 + 2] * z2 + grad4[gi2 + 3] * w2); + } + let t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3; + if (t3 < 0) + n3 = 0.0; + else { + const gi3 = (perm[ii + i3 + perm[jj + j3 + perm[kk + k3 + perm[ll + l3]]]] % 32) * 4; + t3 *= t3; + n3 = t3 * t3 * (grad4[gi3] * x3 + grad4[gi3 + 1] * y3 + grad4[gi3 + 2] * z3 + grad4[gi3 + 3] * w3); + } + let t4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4; + if (t4 < 0) + n4 = 0.0; + else { + const gi4 = (perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] % 32) * 4; + t4 *= t4; + n4 = t4 * t4 * (grad4[gi4] * x4 + grad4[gi4 + 1] * y4 + grad4[gi4 + 2] * z4 + grad4[gi4 + 3] * w4); + } + return 27.0 * (n0 + n1 + n2 + n3 + n4); + } +} +function buildPermutationTable(random) { + const p = new Uint8Array(256); + for (let i = 0; i < 256; i++) { + p[i] = i; + } + for (let i = 0; i < 255; i++) { + const r = i + ~~(random() * (256 - i)); + const aux = p[i]; + p[i] = p[r]; + p[r] = aux; + } + return p; +} +function alea(seed) { + let s0 = 0; + let s1 = 0; + let s2 = 0; + let c = 1; + const mash = masher(); + s0 = mash(' '); + s1 = mash(' '); + s2 = mash(' '); + s0 -= mash(seed); + if (s0 < 0) { + s0 += 1; + } + s1 -= mash(seed); + if (s1 < 0) { + s1 += 1; + } + s2 -= mash(seed); + if (s2 < 0) { + s2 += 1; + } + return function () { + const t = 2091639 * s0 + c * 2.3283064365386963e-10; + s0 = s1; + s1 = s2; + return s2 = t - (c = t | 0); + }; +} +function masher() { + let n = 0xefc8249d; + return function (data) { + data = data.toString(); + for (let i = 0; i < data.length; i++) { + n += data.charCodeAt(i); + let h = 0.02519603282416938 * n; + n = h >>> 0; + h -= n; + h *= n; + n = h >>> 0; + h -= n; + n += h * 0x100000000; + } + return (n >>> 0) * 2.3283064365386963e-10; + }; +} + +class TurbulenceField { + constructor(scale, octaves, velocityMultiplier, timeScale) { + this.scale = scale; + this.octaves = octaves; + this.velocityMultiplier = velocityMultiplier; + this.timeScale = timeScale; + this.type = 'TurbulenceField'; + this.generator = new SimplexNoise(); + this.timeOffset = new THREE.Vector3(); + this.temp = new THREE.Vector3(); + this.temp2 = new THREE.Vector3(); + this.timeOffset.x = Math.random() / this.scale.x * this.timeScale.x; + this.timeOffset.y = Math.random() / this.scale.y * this.timeScale.y; + this.timeOffset.z = Math.random() / this.scale.z * this.timeScale.z; + } + initialize(particle) { + } + update(particle, delta) { + const x = particle.position.x / this.scale.x; + const y = particle.position.y / this.scale.y; + const z = particle.position.z / this.scale.z; + this.temp.set(0, 0, 0); + let lvl = 1; + for (let i = 0; i < this.octaves; i++) { + this.temp2.set(this.generator.noise4D(x * lvl, y * lvl, z * lvl, this.timeOffset.x * lvl) / lvl, this.generator.noise4D(x * lvl, y * lvl, z * lvl, this.timeOffset.y * lvl) / lvl, this.generator.noise4D(x * lvl, y * lvl, z * lvl, this.timeOffset.z * lvl) / lvl); + this.temp.add(this.temp2); + lvl *= 2; + } + this.temp.multiply(this.velocityMultiplier); + particle.velocity.addScaledVector(this.temp, delta); + } + toJSON() { + return { + type: this.type, + scale: [this.scale.x, this.scale.y, this.scale.z], + octaves: this.octaves, + velocityMultiplier: [this.velocityMultiplier.x, this.velocityMultiplier.y, this.velocityMultiplier.z], + timeScale: [this.timeScale.x, this.timeScale.y, this.timeScale.z], + }; + } + frameUpdate(delta) { + this.timeOffset.x += delta * this.timeScale.x; + this.timeOffset.y += delta * this.timeScale.y; + this.timeOffset.z += delta * this.timeScale.z; + } + static fromJSON(json) { + return new TurbulenceField(new THREE.Vector3(json.scale[0], json.scale[1], json.scale[2]), json.octaves, new THREE.Vector3(json.velocityMultiplier[0], json.velocityMultiplier[1], json.velocityMultiplier[2]), new THREE.Vector3(json.timeScale[0], json.timeScale[1], json.timeScale[2])); + } + clone() { + return new TurbulenceField(this.scale.clone(), this.octaves, this.velocityMultiplier.clone(), this.timeScale.clone()); + } + reset() { + } +} + +function randomInt(a, b) { + return Math.floor(Math.random() * (b - a)) + a; +} + +const generators = []; +const tempV$2 = new THREE.Vector3(); +const tempQ$2 = new THREE.Quaternion(); +class Noise { + constructor(frequency, power, positionAmount = new ConstantValue(1), rotationAmount = new ConstantValue(0)) { + this.frequency = frequency; + this.power = power; + this.positionAmount = positionAmount; + this.rotationAmount = rotationAmount; + this.type = 'Noise'; + this.duration = 0; + if (generators.length === 0) { + for (let i = 0; i < 100; i++) { + generators.push(new SimplexNoise()); + } + } + } + initialize(particle) { + particle.lastPosNoise = new THREE.Vector3(); + if (typeof particle.rotation === 'number') { + particle.lastRotNoise = 0; + } + else { + particle.lastRotNoise = new THREE.Quaternion(); + } + particle.generatorIndex = [randomInt(0, 100), randomInt(0, 100), randomInt(0, 100), randomInt(0, 100)]; + } + update(particle, _) { + let frequency = this.frequency.genValue(particle.age / particle.life); + let power = this.power.genValue(particle.age / particle.life); + let positionAmount = this.positionAmount.genValue(particle.age / particle.life); + let rotationAmount = this.rotationAmount.genValue(particle.age / particle.life); + if (positionAmount > 0 && particle.lastPosNoise !== undefined) { + particle.position.sub(particle.lastPosNoise); + tempV$2.set(generators[particle.generatorIndex[0]].noise2D(0, particle.age * frequency) * + power * + positionAmount, generators[particle.generatorIndex[1]].noise2D(0, particle.age * frequency) * + power * + positionAmount, generators[particle.generatorIndex[2]].noise2D(0, particle.age * frequency) * + power * + positionAmount); + particle.position.add(tempV$2); + particle.lastPosNoise.copy(tempV$2); + } + if (rotationAmount > 0 && particle.lastRotNoise !== undefined) { + if (typeof particle.rotation === 'number') { + particle.rotation -= particle.lastRotNoise; + particle.rotation += + generators[particle.generatorIndex[3]].noise2D(0, particle.age * frequency) * + Math.PI * + power * + rotationAmount; + } + else { + particle.lastRotNoise.invert(); + particle.rotation.multiply(particle.lastRotNoise); + tempQ$2 + .set(generators[particle.generatorIndex[0]].noise2D(0, particle.age * frequency) * + power * + rotationAmount, generators[particle.generatorIndex[1]].noise2D(0, particle.age * frequency) * + power * + rotationAmount, generators[particle.generatorIndex[2]].noise2D(0, particle.age * frequency) * + power * + rotationAmount, generators[particle.generatorIndex[3]].noise2D(0, particle.age * frequency) * + power * + rotationAmount) + .normalize(); + particle.rotation.multiply(tempQ$2); + particle.lastRotNoise.copy(tempQ$2); + } + } + } + toJSON() { + return { + type: this.type, + frequency: this.frequency.toJSON(), + power: this.power.toJSON(), + positionAmount: this.positionAmount.toJSON(), + rotationAmount: this.rotationAmount.toJSON(), + }; + } + frameUpdate(delta) { + this.duration += delta; + } + static fromJSON(json) { + return new Noise(ValueGeneratorFromJSON(json.frequency), ValueGeneratorFromJSON(json.power), ValueGeneratorFromJSON(json.positionAmount), ValueGeneratorFromJSON(json.rotationAmount)); + } + clone() { + return new Noise(this.frequency.clone(), this.power.clone(), this.positionAmount.clone(), this.rotationAmount.clone()); + } + reset() { } +} + +class TextureSequencer { + constructor(scaleX = 0, scaleY = 0, position = new THREE.Vector3()) { + this.scaleX = scaleX; + this.scaleY = scaleY; + this.position = position; + this.locations = []; + } + transform(position, index) { + position.x = this.locations[index % this.locations.length].x * this.scaleX + this.position.x; + position.y = this.locations[index % this.locations.length].y * this.scaleY + this.position.y; + position.z = this.position.z; + } + static fromJSON(json) { + const textureSequencer = new TextureSequencer(json.scaleX, json.scaleY, new THREE.Vector3(json.position[0], json.position[1], json.position[2])); + textureSequencer.locations = json.locations.map((loc) => new THREE.Vector2(loc.x, loc.y)); + return textureSequencer; + } + clone() { + const textureSequencer = new TextureSequencer(this.scaleX, this.scaleY, this.position.clone()); + textureSequencer.locations = this.locations.map(loc => loc.clone()); + return textureSequencer; + } + toJSON() { + return { + scaleX: this.scaleX, + scaleY: this.scaleY, + position: this.position, + locations: this.locations.map(loc => ({ + x: loc.x, + y: loc.y, + })) + }; + } + fromImage(img, threshold) { + const canvas = document.createElement("canvas"); + canvas.width = img.width; + canvas.height = img.height; + const ctx = canvas.getContext("2d"); + if (!ctx) { + return; + } + ctx.drawImage(img, 0, 0); + const data = ctx.getImageData(0, 0, canvas.width, canvas.height, { colorSpace: "srgb" }); + canvas.remove(); + this.locations.length = 0; + for (let i = 0; i < data.height; i++) { + for (let j = 0; j < data.width; j++) { + if (data.data[(i * data.width + j) * 4 + 3] > threshold) { + this.locations.push(new THREE.Vector2(j, data.height - i)); + } + } + } + } +} + +function SequencerFromJSON(json) { + switch (json.type) { + case 'TextureSequencer': + return TextureSequencer.fromJSON(json); + default: + return new TextureSequencer(); + } +} + +class ApplySequences { + constructor(delayBetweenParticles) { + this.type = 'ApplySequences'; + this.sequencers = []; + this.time = 0; + this.index = 0; + this.pCount = 0; + this.tempV = new THREE.Vector3(); + this.delay = delayBetweenParticles; + } + initialize(particle) { + particle.id = this.pCount; + particle.dst = new THREE.Vector3(); + particle.begin = new THREE.Vector3(); + particle.inMotion = false; + this.pCount++; + } + reset() { + this.time = 0; + this.index = 0; + this.pCount = 0; + } + update(particle, delta) { + const sequencer = this.sequencers[this.index]; + const delay = particle.id * this.delay; + if (this.time >= sequencer[0].a + delay && this.time <= sequencer[0].b + delay) { + if (!particle.inMotion) { + particle.inMotion = true; + particle.begin.copy(particle.position); + sequencer[1].transform(particle.dst, particle.id); + } + particle.position.lerpVectors(particle.begin, particle.dst, ApplySequences.BEZIER.genValue((this.time - sequencer[0].a - delay) / (sequencer[0].b - sequencer[0].a))); + } + else if (this.time > sequencer[0].b + delay) { + particle.inMotion = false; + } + } + frameUpdate(delta) { + while (this.index + 1 < this.sequencers.length && this.time >= this.sequencers[this.index + 1][0].a) { + this.index++; + } + this.time += delta; + } + appendSequencer(range, sequencer) { + this.sequencers.push([range, sequencer]); + } + toJSON() { + return { + type: this.type, + delay: this.delay, + sequencers: this.sequencers.map(([range, sequencer]) => ({ + range: range.toJSON(), + sequencer: sequencer.toJSON(), + })), + }; + } + static fromJSON(json) { + const seq = new ApplySequences(json.delay); + json.sequencers.forEach((sequencerJson) => { + seq.sequencers.push([ValueGeneratorFromJSON(sequencerJson.range), SequencerFromJSON(sequencerJson.sequencer)]); + }); + return seq; + } + clone() { + const applySequences = new ApplySequences(this.delay); + applySequences.sequencers = this.sequencers.map(seq => [seq[0].clone(), seq[1].clone()]); + return applySequences; + } +} +ApplySequences.BEZIER = new Bezier(0, 0, 1, 1); + +let physicsResolver; +function setPhysicsResolver(resolver) { + physicsResolver = resolver; +} +function getPhysicsResolver() { + return physicsResolver; +} +class ApplyCollision { + constructor(resolver, bounce) { + this.resolver = resolver; + this.bounce = bounce; + this.type = 'ApplyCollision'; + this.tempV = new THREE.Vector3(); + } + initialize(particle) { + } + update(particle, delta) { + if (this.resolver.resolve(particle.position, this.tempV)) { + particle.velocity.reflect(this.tempV).multiplyScalar(this.bounce); + } + } + frameUpdate(delta) { + } + toJSON() { + return { + type: this.type, + bounce: this.bounce, + }; + } + static fromJSON(json) { + return new ApplyCollision(getPhysicsResolver(), json.bounce); + } + clone() { + return new ApplyCollision(this.resolver, this.bounce); + } + reset() { + } +} + +class ColorBySpeed { + constructor(color, speedRange) { + this.color = color; + this.speedRange = speedRange; + this.type = 'ColorBySpeed'; + } + initialize(particle) { + if (this.color.type === 'memorizedFunction') { + particle.colorOverLifeMemory = {}; + this.color.startGen(particle.colorOverLifeMemory); + } + } + update(particle, delta) { + const t = (particle.startSpeed - this.speedRange.a) / (this.speedRange.b - this.speedRange.a); + if (this.color.type === 'memorizedFunction') { + this.color.genColor(particle.color, t, particle.colorOverLifeMemory); + } + else { + this.color.genColor(particle.color, t); + } + particle.color.x *= particle.startColor.x; + particle.color.y *= particle.startColor.y; + particle.color.z *= particle.startColor.z; + particle.color.w *= particle.startColor.w; + } + frameUpdate(delta) { } + toJSON() { + return { + type: this.type, + color: this.color.toJSON(), + speedRange: this.speedRange.toJSON(), + }; + } + static fromJSON(json) { + return new ColorBySpeed(ColorGeneratorFromJSON(json.color), IntervalValue.fromJSON(json.speedRange)); + } + clone() { + return new ColorBySpeed(this.color.clone(), this.speedRange.clone()); + } + reset() { } +} + +class SizeBySpeed { + initialize(particle) { } + constructor(size, speedRange) { + this.size = size; + this.speedRange = speedRange; + this.type = 'SizeBySpeed'; + } + update(particle) { + const t = (particle.startSpeed - this.speedRange.a) / (this.speedRange.b - this.speedRange.a); + particle.size = particle.startSize * this.size.genValue(t); + } + toJSON() { + return { + type: this.type, + size: this.size.toJSON(), + speedRange: this.speedRange.toJSON(), + }; + } + static fromJSON(json) { + return new SizeBySpeed(ValueGeneratorFromJSON(json.size), IntervalValue.fromJSON(json.speedRange)); + } + frameUpdate(delta) { } + clone() { + return new SizeBySpeed(this.size.clone(), this.speedRange.clone()); + } + reset() { } +} + +class RotationBySpeed { + constructor(angularVelocity, speedRange) { + this.angularVelocity = angularVelocity; + this.speedRange = speedRange; + this.type = 'RotationBySpeed'; + this.tempQuat = new THREE.Quaternion(); + } + initialize(particle) { } + update(particle, delta) { + const t = (particle.startSpeed - this.speedRange.a) / (this.speedRange.b - this.speedRange.a); + particle.rotation += delta * this.angularVelocity.genValue(t); + } + toJSON() { + return { + type: this.type, + angularVelocity: this.angularVelocity.toJSON(), + speedRange: this.speedRange.toJSON(), + }; + } + static fromJSON(json) { + return new RotationBySpeed(ValueGeneratorFromJSON(json.angularVelocity), IntervalValue.fromJSON(json.speedRange)); + } + frameUpdate(delta) { } + clone() { + return new RotationBySpeed(this.angularVelocity.clone(), this.speedRange.clone()); + } + reset() { } +} + +class LimitSpeedOverLife { + initialize(particle) { } + constructor(speed, dampen) { + this.speed = speed; + this.dampen = dampen; + this.type = 'LimitSpeedOverLife'; + } + update(particle, delta) { + let speed = particle.velocity.length(); + let limit = this.speed.genValue(particle.age / particle.life); + if (speed > limit) { + const percent = (speed - limit) / speed; + particle.velocity.multiplyScalar(1 - percent * this.dampen * delta * 20); + } + } + toJSON() { + return { + type: this.type, + speed: this.speed.toJSON(), + dampen: this.dampen, + }; + } + static fromJSON(json) { + return new LimitSpeedOverLife(ValueGeneratorFromJSON(json.speed), json.dampen); + } + frameUpdate(delta) { } + clone() { + return new LimitSpeedOverLife(this.speed.clone(), this.dampen); + } + reset() { } +} + +const BehaviorTypes = { + ApplyForce: { + type: 'ApplyForce', + constructor: ApplyForce, + params: [ + ['direction', 'vec3'], + ['magnitude', 'value'], + ], + loadJSON: ApplyForce.fromJSON, + }, + Noise: { + type: 'Noise', + constructor: Noise, + params: [ + ['frequency', 'value'], + ['power', 'value'], + ['positionAmount', 'value'], + ['rotationAmount', 'value'], + ], + loadJSON: Noise.fromJSON, + }, + TurbulenceField: { + type: 'TurbulenceField', + constructor: TurbulenceField, + params: [ + ['scale', 'vec3'], + ['octaves', 'number'], + ['velocityMultiplier', 'vec3'], + ['timeScale', 'vec3'], + ], + loadJSON: TurbulenceField.fromJSON, + }, + GravityForce: { + type: 'GravityForce', + constructor: GravityForce, + params: [ + ['center', 'vec3'], + ['magnitude', 'number'], + ], + loadJSON: GravityForce.fromJSON, + }, + ColorOverLife: { + type: 'ColorOverLife', + constructor: ColorOverLife, + params: [['color', 'colorFunc']], + loadJSON: ColorOverLife.fromJSON, + }, + RotationOverLife: { + type: 'RotationOverLife', + constructor: RotationOverLife, + params: [['angularVelocity', 'valueFunc']], + loadJSON: RotationOverLife.fromJSON, + }, + Rotation3DOverLife: { + type: 'Rotation3DOverLife', + constructor: Rotation3DOverLife, + params: [['angularVelocity', 'rotationFunc']], + loadJSON: Rotation3DOverLife.fromJSON, + }, + SizeOverLife: { + type: 'SizeOverLife', + constructor: SizeOverLife, + params: [['size', 'valueFunc']], + loadJSON: SizeOverLife.fromJSON, + }, + ColorBySpeed: { + type: 'ColorBySpeed', + constructor: ColorBySpeed, + params: [ + ['color', 'colorFunc'], + ['speedRange', 'range'], + ], + loadJSON: ColorBySpeed.fromJSON, + }, + RotationBySpeed: { + type: 'RotationBySpeed', + constructor: RotationBySpeed, + params: [ + ['angularVelocity', 'valueFunc'], + ['speedRange', 'range'], + ], + loadJSON: RotationBySpeed.fromJSON, + }, + SizeBySpeed: { + type: 'SizeBySpeed', + constructor: SizeBySpeed, + params: [ + ['size', 'valueFunc'], + ['speedRange', 'range'], + ], + loadJSON: SizeBySpeed.fromJSON, + }, + SpeedOverLife: { + type: 'SpeedOverLife', + constructor: SpeedOverLife, + params: [['speed', 'valueFunc']], + loadJSON: SpeedOverLife.fromJSON, + }, + FrameOverLife: { + type: 'FrameOverLife', + constructor: FrameOverLife, + params: [['frame', 'valueFunc']], + loadJSON: FrameOverLife.fromJSON, + }, + ForceOverLife: { + type: 'ForceOverLife', + constructor: ForceOverLife, + params: [ + ['x', 'valueFunc'], + ['y', 'valueFunc'], + ['z', 'valueFunc'], + ], + loadJSON: ForceOverLife.fromJSON, + }, + OrbitOverLife: { + type: 'OrbitOverLife', + constructor: OrbitOverLife, + params: [ + ['orbitSpeed', 'valueFunc'], + ['axis', 'vec3'], + ], + loadJSON: OrbitOverLife.fromJSON, + }, + WidthOverLength: { + type: 'WidthOverLength', + constructor: WidthOverLength, + params: [['width', 'valueFunc']], + loadJSON: WidthOverLength.fromJSON, + }, + ChangeEmitDirection: { + type: 'ChangeEmitDirection', + constructor: ChangeEmitDirection, + params: [['angle', 'value']], + loadJSON: ChangeEmitDirection.fromJSON, + }, + EmitSubParticleSystem: { + type: 'EmitSubParticleSystem', + constructor: EmitSubParticleSystem, + params: [ + ['particleSystem', 'self'], + ['useVelocityAsBasis', 'boolean'], + ['subParticleSystem', 'particleSystem'], + ['mode', 'number'], + ['emitProbability', 'number'], + ], + loadJSON: EmitSubParticleSystem.fromJSON, + }, + LimitSpeedOverLife: { + type: 'LimitSpeedOverLife', + constructor: LimitSpeedOverLife, + params: [ + ['speed', 'valueFunc'], + ['dampen', 'number'], + ], + loadJSON: LimitSpeedOverLife.fromJSON, + }, +}; +function BehaviorFromJSON(json, particleSystem) { + return BehaviorTypes[json.type].loadJSON(json, particleSystem); +} + +let EmitterMode = void 0; +(function (EmitterMode) { + EmitterMode[EmitterMode["Random"] = 0] = "Random"; + EmitterMode[EmitterMode["Loop"] = 1] = "Loop"; + EmitterMode[EmitterMode["PingPong"] = 2] = "PingPong"; + EmitterMode[EmitterMode["Burst"] = 3] = "Burst"; +})(EmitterMode || (EmitterMode = {})); +function getValueFromEmitterMode(mode, currentValue, spread) { + let u; + if (EmitterMode.Random === mode) { + currentValue = Math.random(); + } + if (spread > 0) { + u = Math.floor(currentValue / spread) * spread; + } + else { + u = currentValue; + } + switch (mode) { + case EmitterMode.Loop: + u = u % 1; + break; + case EmitterMode.PingPong: + u = Math.abs((u % 2) - 1); + break; + } + return u; +} + +class ConeEmitter { + constructor(parameters = {}) { + var _a, _b, _c, _d, _e, _f, _g; + this.type = 'cone'; + this.currentValue = 0; + this.radius = (_a = parameters.radius) !== null && _a !== void 0 ? _a : 10; + this.arc = (_b = parameters.arc) !== null && _b !== void 0 ? _b : 2.0 * Math.PI; + this.thickness = (_c = parameters.thickness) !== null && _c !== void 0 ? _c : 1; + this.angle = (_d = parameters.angle) !== null && _d !== void 0 ? _d : Math.PI / 6; + this.mode = (_e = parameters.mode) !== null && _e !== void 0 ? _e : EmitterMode.Random; + this.spread = (_f = parameters.spread) !== null && _f !== void 0 ? _f : 0; + this.speed = (_g = parameters.speed) !== null && _g !== void 0 ? _g : new ConstantValue(1); + } + update(system, delta) { + if (EmitterMode.Random != this.mode) { + this.currentValue += this.speed.genValue(system.emissionState.time / system.duration) * delta; + } + } + initialize(p) { + const u = getValueFromEmitterMode(this.mode, this.currentValue, this.spread); + const rand = THREE.MathUtils.lerp(1 - this.thickness, 1, Math.random()); + const theta = u * this.arc; + const r = Math.sqrt(rand); + const sinTheta = Math.sin(theta); + const cosTheta = Math.cos(theta); + p.position.x = r * cosTheta; + p.position.y = r * sinTheta; + p.position.z = 0; + const angle = this.angle * r; + p.velocity.set(0, 0, Math.cos(angle)).addScaledVector(p.position, Math.sin(angle)).multiplyScalar(p.startSpeed); + p.position.multiplyScalar(this.radius); + } + toJSON() { + return { + type: 'cone', + radius: this.radius, + arc: this.arc, + thickness: this.thickness, + angle: this.angle, + mode: this.mode, + spread: this.spread, + speed: this.speed.toJSON(), + }; + } + static fromJSON(json) { + return new ConeEmitter({ + radius: json.radius, + arc: json.arc, + thickness: json.thickness, + angle: json.angle, + mode: json.mode, + speed: json.speed ? ValueGeneratorFromJSON(json.speed) : undefined, + spread: json.spread, + }); + } + clone() { + return new ConeEmitter({ + radius: this.radius, + arc: this.arc, + thickness: this.thickness, + angle: this.angle, + mode: this.mode, + speed: this.speed.clone(), + spread: this.spread, + }); + } +} + +class CircleEmitter { + constructor(parameters = {}) { + var _a, _b, _c, _d, _e, _f; + this.type = 'circle'; + this.currentValue = 0; + this.radius = (_a = parameters.radius) !== null && _a !== void 0 ? _a : 10; + this.arc = (_b = parameters.arc) !== null && _b !== void 0 ? _b : 2.0 * Math.PI; + this.thickness = (_c = parameters.thickness) !== null && _c !== void 0 ? _c : 1; + this.mode = (_d = parameters.mode) !== null && _d !== void 0 ? _d : EmitterMode.Random; + this.spread = (_e = parameters.spread) !== null && _e !== void 0 ? _e : 0; + this.speed = (_f = parameters.speed) !== null && _f !== void 0 ? _f : new ConstantValue(1); + } + update(system, delta) { + this.currentValue += this.speed.genValue(system.emissionState.time / system.duration) * delta; + } + initialize(p) { + const u = getValueFromEmitterMode(this.mode, this.currentValue, this.spread); + const r = THREE.MathUtils.lerp(1 - this.thickness, 1, Math.random()); + const theta = u * this.arc; + p.position.x = Math.cos(theta); + p.position.y = Math.sin(theta); + p.position.z = 0; + p.velocity.copy(p.position).multiplyScalar(p.startSpeed); + p.position.multiplyScalar(this.radius * r); + } + toJSON() { + return { + type: 'circle', + radius: this.radius, + arc: this.arc, + thickness: this.thickness, + mode: this.mode, + spread: this.spread, + speed: this.speed.toJSON(), + }; + } + static fromJSON(json) { + return new CircleEmitter({ + radius: json.radius, + arc: json.arc, + thickness: json.thickness, + mode: json.mode, + speed: json.speed ? ValueGeneratorFromJSON(json.speed) : undefined, + spread: json.spread, + }); + } + clone() { + return new CircleEmitter({ + radius: this.radius, + arc: this.arc, + thickness: this.thickness, + mode: this.mode, + speed: this.speed.clone(), + spread: this.spread, + }); + } +} + +class DonutEmitter { + constructor(parameters = {}) { + var _a, _b, _c, _d, _e, _f, _g; + this.type = 'donut'; + this.currentValue = 0; + this.radius = (_a = parameters.radius) !== null && _a !== void 0 ? _a : 10; + this.arc = (_b = parameters.arc) !== null && _b !== void 0 ? _b : 2.0 * Math.PI; + this.thickness = (_c = parameters.thickness) !== null && _c !== void 0 ? _c : 1; + this.donutRadius = (_d = parameters.donutRadius) !== null && _d !== void 0 ? _d : this.radius * 0.2; + this.mode = (_e = parameters.mode) !== null && _e !== void 0 ? _e : EmitterMode.Random; + this.spread = (_f = parameters.spread) !== null && _f !== void 0 ? _f : 0; + this.speed = (_g = parameters.speed) !== null && _g !== void 0 ? _g : new ConstantValue(1); + } + update(system, delta) { + if (EmitterMode.Random != this.mode) { + this.currentValue += this.speed.genValue(system.emissionState.time / system.duration) * delta; + } + } + initialize(p) { + const u = getValueFromEmitterMode(this.mode, this.currentValue, this.spread); + const v = Math.random(); + const rand = THREE.MathUtils.lerp(1 - this.thickness, 1, Math.random()); + const theta = u * this.arc; + const phi = v * Math.PI * 2; + const sinTheta = Math.sin(theta); + const cosTheta = Math.cos(theta); + p.position.x = this.radius * cosTheta; + p.position.y = this.radius * sinTheta; + p.position.z = 0; + p.velocity.z = this.donutRadius * rand * Math.sin(phi); + p.velocity.x = this.donutRadius * rand * Math.cos(phi) * cosTheta; + p.velocity.y = this.donutRadius * rand * Math.cos(phi) * sinTheta; + p.position.add(p.velocity); + p.velocity.normalize().multiplyScalar(p.startSpeed); + } + toJSON() { + return { + type: 'donut', + radius: this.radius, + arc: this.arc, + thickness: this.thickness, + donutRadius: this.donutRadius, + mode: this.mode, + spread: this.spread, + speed: this.speed.toJSON(), + }; + } + static fromJSON(json) { + return new DonutEmitter({ + radius: json.radius, + arc: json.arc, + thickness: json.thickness, + donutRadius: json.donutRadius, + mode: json.mode, + speed: json.speed ? ValueGeneratorFromJSON(json.speed) : undefined, + spread: json.spread, + }); + } + clone() { + return new DonutEmitter({ + radius: this.radius, + arc: this.arc, + thickness: this.thickness, + donutRadius: this.donutRadius, + mode: this.mode, + speed: this.speed.clone(), + spread: this.spread, + }); + } +} + +class PointEmitter { + constructor() { + this.type = 'point'; + } + update(system, delta) { } + initialize(p) { + const u = Math.random(); + const v = Math.random(); + const theta = u * Math.PI * 2; + const phi = Math.acos(2.0 * v - 1.0); + const r = Math.cbrt(Math.random()); + const sinTheta = Math.sin(theta); + const cosTheta = Math.cos(theta); + const sinPhi = Math.sin(phi); + const cosPhi = Math.cos(phi); + p.velocity.x = r * sinPhi * cosTheta; + p.velocity.y = r * sinPhi * sinTheta; + p.velocity.z = r * cosPhi; + p.velocity.multiplyScalar(p.startSpeed); + p.position.setScalar(0); + } + toJSON() { + return { + type: 'point', + }; + } + static fromJSON(json) { + return new PointEmitter(); + } + clone() { + return new PointEmitter(); + } +} + +class SphereEmitter { + constructor(parameters = {}) { + var _a, _b, _c, _d, _e, _f; + this.type = 'sphere'; + this.currentValue = 0; + this.radius = (_a = parameters.radius) !== null && _a !== void 0 ? _a : 10; + this.arc = (_b = parameters.arc) !== null && _b !== void 0 ? _b : 2.0 * Math.PI; + this.thickness = (_c = parameters.thickness) !== null && _c !== void 0 ? _c : 1; + this.mode = (_d = parameters.mode) !== null && _d !== void 0 ? _d : EmitterMode.Random; + this.spread = (_e = parameters.spread) !== null && _e !== void 0 ? _e : 0; + this.speed = (_f = parameters.speed) !== null && _f !== void 0 ? _f : new ConstantValue(1); + } + update(system, delta) { + if (EmitterMode.Random != this.mode) { + this.currentValue += this.speed.genValue(system.emissionState.time / system.duration) * delta; + } + } + initialize(p) { + const u = getValueFromEmitterMode(this.mode, this.currentValue, this.spread); + const v = Math.random(); + const rand = THREE.MathUtils.lerp(1 - this.thickness, 1, Math.random()); + const theta = u * this.arc; + const phi = Math.acos(2.0 * v - 1.0); + const sinTheta = Math.sin(theta); + const cosTheta = Math.cos(theta); + const sinPhi = Math.sin(phi); + const cosPhi = Math.cos(phi); + p.position.x = sinPhi * cosTheta; + p.position.y = sinPhi * sinTheta; + p.position.z = cosPhi; + p.velocity.copy(p.position).multiplyScalar(p.startSpeed); + p.position.multiplyScalar(this.radius * rand); + } + toJSON() { + return { + type: 'sphere', + radius: this.radius, + arc: this.arc, + thickness: this.thickness, + mode: this.mode, + spread: this.spread, + speed: this.speed.toJSON(), + }; + } + static fromJSON(json) { + return new SphereEmitter({ + radius: json.radius, + arc: json.arc, + thickness: json.thickness, + mode: json.mode, + speed: json.speed ? ValueGeneratorFromJSON(json.speed) : undefined, + spread: json.spread, + }); + } + clone() { + return new SphereEmitter({ + radius: this.radius, + arc: this.arc, + thickness: this.thickness, + mode: this.mode, + speed: this.speed.clone(), + spread: this.spread, + }); + } +} + +class HemisphereEmitter { + constructor(parameters = {}) { + var _a, _b, _c, _d, _e, _f; + this.type = 'sphere'; + this.currentValue = 0; + this.radius = (_a = parameters.radius) !== null && _a !== void 0 ? _a : 10; + this.arc = (_b = parameters.arc) !== null && _b !== void 0 ? _b : 2.0 * Math.PI; + this.thickness = (_c = parameters.thickness) !== null && _c !== void 0 ? _c : 1; + this.mode = (_d = parameters.mode) !== null && _d !== void 0 ? _d : EmitterMode.Random; + this.spread = (_e = parameters.spread) !== null && _e !== void 0 ? _e : 0; + this.speed = (_f = parameters.speed) !== null && _f !== void 0 ? _f : new ConstantValue(1); + } + update(system, delta) { + if (EmitterMode.Random != this.mode) { + this.currentValue += this.speed.genValue(system.emissionState.time / system.duration) * delta; + } + } + initialize(p) { + const u = getValueFromEmitterMode(this.mode, this.currentValue, this.spread); + const v = Math.random(); + const rand = THREE.MathUtils.lerp(1 - this.thickness, 1, Math.random()); + const theta = u * this.arc; + const phi = Math.acos(v); + const sinTheta = Math.sin(theta); + const cosTheta = Math.cos(theta); + const sinPhi = Math.sin(phi); + const cosPhi = Math.cos(phi); + p.position.x = sinPhi * cosTheta; + p.position.y = sinPhi * sinTheta; + p.position.z = cosPhi; + p.velocity.copy(p.position).multiplyScalar(p.startSpeed); + p.position.multiplyScalar(this.radius * rand); + } + toJSON() { + return { + type: 'hemisphere', + radius: this.radius, + arc: this.arc, + thickness: this.thickness, + mode: this.mode, + spread: this.spread, + speed: this.speed.toJSON(), + }; + } + static fromJSON(json) { + return new HemisphereEmitter({ + radius: json.radius, + arc: json.arc, + thickness: json.thickness, + mode: json.mode, + speed: json.speed ? ValueGeneratorFromJSON(json.speed) : undefined, + spread: json.spread, + }); + } + clone() { + return new HemisphereEmitter({ + radius: this.radius, + arc: this.arc, + thickness: this.thickness, + mode: this.mode, + speed: this.speed.clone(), + spread: this.spread, + }); + } +} + +class GridEmitter { + constructor(parameters = {}) { + var _a, _b, _c, _d; + this.type = 'grid'; + this.width = (_a = parameters.width) !== null && _a !== void 0 ? _a : 1; + this.height = (_b = parameters.height) !== null && _b !== void 0 ? _b : 1; + this.column = (_c = parameters.column) !== null && _c !== void 0 ? _c : 10; + this.row = (_d = parameters.row) !== null && _d !== void 0 ? _d : 10; + } + initialize(p) { + const r = Math.floor(Math.random() * this.row); + const c = Math.floor(Math.random() * this.column); + p.position.x = (c * this.width) / this.column - this.width / 2; + p.position.y = (r * this.height) / this.row - this.height / 2; + p.position.z = 0; + p.velocity.set(0, 0, p.startSpeed); + } + toJSON() { + return { + type: 'grid', + width: this.width, + height: this.height, + column: this.column, + row: this.row, + }; + } + static fromJSON(json) { + return new GridEmitter(json); + } + clone() { + return new GridEmitter({ + width: this.width, + height: this.height, + column: this.column, + row: this.row, + }); + } + update(system, delta) { } +} + +class MeshSurfaceEmitter { + get geometry() { + return this._geometry; + } + set geometry(geometry) { + this._geometry = geometry; + if (geometry === undefined) { + return; + } + if (typeof geometry === 'string') { + return; + } + const tri = new THREE.Triangle(); + this._triangleIndexToArea.length = 0; + let area = 0; + if (!geometry.getIndex()) { + return; + } + const array = geometry.getIndex().array; + const triCount = array.length / 3; + this._triangleIndexToArea.push(0); + for (let i = 0; i < triCount; i++) { + tri.setFromAttributeAndIndices(geometry.getAttribute('position'), array[i * 3], array[i * 3 + 1], array[i * 3 + 2]); + area += tri.getArea(); + this._triangleIndexToArea.push(area); + } + geometry.userData.triangleIndexToArea = this._triangleIndexToArea; + } + constructor(geometry) { + this.type = 'mesh_surface'; + this._triangleIndexToArea = []; + this._tempA = new THREE.Vector3(); + this._tempB = new THREE.Vector3(); + this._tempC = new THREE.Vector3(); + if (!geometry) { + return; + } + this.geometry = geometry; + } + initialize(p) { + const geometry = this._geometry; + if (!geometry || geometry.getIndex() === null) { + p.position.set(0, 0, 0); + p.velocity.set(0, 0, 1).multiplyScalar(p.startSpeed); + return; + } + const triCount = this._triangleIndexToArea.length - 1; + let left = 0, right = triCount; + const target = Math.random() * this._triangleIndexToArea[triCount]; + while (left + 1 < right) { + const mid = Math.floor((left + right) / 2); + if (target < this._triangleIndexToArea[mid]) { + right = mid; + } + else { + left = mid; + } + } + let u1 = Math.random(); + let u2 = Math.random(); + if (u1 + u2 > 1) { + u1 = 1 - u1; + u2 = 1 - u2; + } + const index1 = geometry.getIndex().array[left * 3]; + const index2 = geometry.getIndex().array[left * 3 + 1]; + const index3 = geometry.getIndex().array[left * 3 + 2]; + const positionBuffer = geometry.getAttribute('position'); + this._tempA.fromBufferAttribute(positionBuffer, index1); + this._tempB.fromBufferAttribute(positionBuffer, index2); + this._tempC.fromBufferAttribute(positionBuffer, index3); + this._tempB.sub(this._tempA); + this._tempC.sub(this._tempA); + this._tempA.addScaledVector(this._tempB, u1).addScaledVector(this._tempC, u2); + p.position.copy(this._tempA); + this._tempA.copy(this._tempB).cross(this._tempC).normalize(); + p.velocity.copy(this._tempA).normalize().multiplyScalar(p.startSpeed); + } + toJSON() { + return { + type: 'mesh_surface', + mesh: this._geometry ? this._geometry.uuid : '', + }; + } + static fromJSON(json, meta) { + return new MeshSurfaceEmitter(meta.geometries[json.geometry]); + } + clone() { + return new MeshSurfaceEmitter(this._geometry); + } + update(system, delta) { } +} + +const EmitterShapes = { + circle: { + type: 'circle', + params: [ + ['radius', 'number'], + ['arc', 'radian'], + ['thickness', 'number'], + ['mode', 'emitterMode'], + ['spread', 'number'], + ['speed', 'valueFunc'], + ], + constructor: CircleEmitter, + loadJSON: CircleEmitter.fromJSON, + }, + cone: { + type: 'cone', + params: [ + ['radius', 'number'], + ['arc', 'radian'], + ['thickness', 'number'], + ['angle', 'radian'], + ['mode', 'emitterMode'], + ['spread', 'number'], + ['speed', 'valueFunc'], + ], + constructor: ConeEmitter, + loadJSON: ConeEmitter.fromJSON, + }, + donut: { + type: 'donut', + params: [ + ['radius', 'number'], + ['arc', 'radian'], + ['thickness', 'number'], + ['donutRadius', 'number'], + ['mode', 'emitterMode'], + ['spread', 'number'], + ['speed', 'valueFunc'], + ], + constructor: DonutEmitter, + loadJSON: DonutEmitter.fromJSON, + }, + point: { type: 'point', params: [], constructor: PointEmitter, loadJSON: PointEmitter.fromJSON }, + sphere: { + type: 'sphere', + params: [ + ['radius', 'number'], + ['arc', 'radian'], + ['thickness', 'number'], + ['angle', 'radian'], + ['mode', 'emitterMode'], + ['spread', 'number'], + ['speed', 'valueFunc'], + ], + constructor: SphereEmitter, + loadJSON: SphereEmitter.fromJSON, + }, + hemisphere: { + type: 'hemisphere', + params: [ + ['radius', 'number'], + ['arc', 'radian'], + ['thickness', 'number'], + ['angle', 'radian'], + ['mode', 'emitterMode'], + ['spread', 'number'], + ['speed', 'valueFunc'], + ], + constructor: HemisphereEmitter, + loadJSON: HemisphereEmitter.fromJSON, + }, + grid: { + type: 'grid', + params: [ + ['width', 'number'], + ['height', 'number'], + ['rows', 'number'], + ['column', 'number'], + ], + constructor: GridEmitter, + loadJSON: GridEmitter.fromJSON, + }, + mesh_surface: { + type: 'mesh_surface', + params: [['geometry', 'geometry']], + constructor: MeshSurfaceEmitter, + loadJSON: MeshSurfaceEmitter.fromJSON, + }, +}; +function EmitterFromJSON(json, meta) { + return EmitterShapes[json.type].loadJSON(json, meta); +} + +let RenderMode = void 0; +(function (RenderMode) { + RenderMode[RenderMode["BillBoard"] = 0] = "BillBoard"; + RenderMode[RenderMode["StretchedBillBoard"] = 1] = "StretchedBillBoard"; + RenderMode[RenderMode["Mesh"] = 2] = "Mesh"; + RenderMode[RenderMode["Trail"] = 3] = "Trail"; + RenderMode[RenderMode["HorizontalBillBoard"] = 4] = "HorizontalBillBoard"; + RenderMode[RenderMode["VerticalBillBoard"] = 5] = "VerticalBillBoard"; +})(RenderMode || (RenderMode = {})); +class VFXBatch extends THREE.Mesh { + constructor(settings) { + super(); + this.type = 'VFXBatch'; + this.maxParticles = 1000; + this.systems = new Set(); + const layers = new THREE.Layers(); + layers.mask = settings.layers.mask; + const newMat = settings.material.clone(); + newMat.defines = {}; + Object.assign(newMat.defines, settings.material.defines); + this.settings = { + instancingGeometry: settings.instancingGeometry, + renderMode: settings.renderMode, + renderOrder: settings.renderOrder, + material: newMat, + uTileCount: settings.uTileCount, + vTileCount: settings.vTileCount, + layers: layers, + }; + this.frustumCulled = false; + this.renderOrder = this.settings.renderOrder; + } + addSystem(system) { + this.systems.add(system); + } + removeSystem(system) { + this.systems.delete(system); + } +} + +const UP = new THREE.Vector3(0, 0, 1); +const tempQ$1 = new THREE.Quaternion(); +const tempV$1 = new THREE.Vector3(); +const tempV2$1 = new THREE.Vector3(); +new THREE.Vector3(); +const PREWARM_FPS$1 = 60; +const DEFAULT_GEOMETRY$1 = new THREE.PlaneGeometry(1, 1, 1, 1); +class ParticleSystem { + set time(time) { + this.emissionState.time = time; + } + get time() { + return this.emissionState.time; + } + get layers() { + return this.rendererSettings.layers; + } + get texture() { + return this.rendererSettings.material.map; + } + set texture(texture) { + this.rendererSettings.material.map = texture; + this.neededToUpdateRender = true; + } + get material() { + return this.rendererSettings.material; + } + set material(material) { + this.rendererSettings.material = material; + this.neededToUpdateRender = true; + } + get uTileCount() { + return this.rendererSettings.uTileCount; + } + set uTileCount(u) { + this.rendererSettings.uTileCount = u; + this.neededToUpdateRender = true; + } + get vTileCount() { + return this.rendererSettings.vTileCount; + } + set vTileCount(v) { + this.rendererSettings.vTileCount = v; + this.neededToUpdateRender = true; + } + get instancingGeometry() { + return this.rendererSettings.instancingGeometry; + } + set instancingGeometry(geometry) { + this.restart(); + this.particles.length = 0; + this.rendererSettings.instancingGeometry = geometry; + this.neededToUpdateRender = true; + } + get renderMode() { + return this.rendererSettings.renderMode; + } + set renderMode(renderMode) { + if ((this.rendererSettings.renderMode != RenderMode.Trail && renderMode === RenderMode.Trail) || + (this.rendererSettings.renderMode == RenderMode.Trail && renderMode !== RenderMode.Trail)) { + this.restart(); + this.particles.length = 0; + } + if (this.rendererSettings.renderMode !== renderMode) { + switch (renderMode) { + case RenderMode.Trail: + this.rendererEmitterSettings = { + startLength: new ConstantValue(30), + followLocalOrigin: false, + }; + break; + case RenderMode.Mesh: + this.rendererEmitterSettings = { + geometry: new THREE.PlaneGeometry(1, 1), + }; + this.startRotation = new AxisAngleGenerator(new THREE.Vector3(0, 1, 0), new ConstantValue(0)); + break; + case RenderMode.StretchedBillBoard: + this.rendererEmitterSettings = { speedFactor: 0, lengthFactor: 2 }; + if (this.rendererSettings.renderMode === RenderMode.Mesh) { + this.startRotation = new ConstantValue(0); + } + break; + case RenderMode.BillBoard: + case RenderMode.VerticalBillBoard: + case RenderMode.HorizontalBillBoard: + this.rendererEmitterSettings = {}; + if (this.rendererSettings.renderMode === RenderMode.Mesh) { + this.startRotation = new ConstantValue(0); + } + break; + } + } + this.rendererSettings.renderMode = renderMode; + this.neededToUpdateRender = true; + } + get renderOrder() { + return this.rendererSettings.renderOrder; + } + set renderOrder(renderOrder) { + this.rendererSettings.renderOrder = renderOrder; + this.neededToUpdateRender = true; + } + get blending() { + return this.rendererSettings.material.blending; + } + set blending(blending) { + this.rendererSettings.material.blending = blending; + this.neededToUpdateRender = true; + } + constructor(parameters) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x; + this.temp = new THREE.Vector3(); + this.travelDistance = 0; + this.normalMatrix = new THREE.Matrix3(); + this.firstTimeUpdate = true; + this.autoDestroy = parameters.autoDestroy === undefined ? false : parameters.autoDestroy; + this.duration = (_a = parameters.duration) !== null && _a !== void 0 ? _a : 1; + this.looping = parameters.looping === undefined ? true : parameters.looping; + this.prewarm = parameters.prewarm === undefined ? false : parameters.prewarm; + this.startLife = (_b = parameters.startLife) !== null && _b !== void 0 ? _b : new ConstantValue(5); + this.startSpeed = (_c = parameters.startSpeed) !== null && _c !== void 0 ? _c : new ConstantValue(0); + this.startRotation = (_d = parameters.startRotation) !== null && _d !== void 0 ? _d : new ConstantValue(0); + this.startSize = (_e = parameters.startSize) !== null && _e !== void 0 ? _e : new ConstantValue(1); + this.startColor = (_f = parameters.startColor) !== null && _f !== void 0 ? _f : new ConstantColor(new THREE.Vector4(1, 1, 1, 1)); + this.emissionOverTime = (_g = parameters.emissionOverTime) !== null && _g !== void 0 ? _g : new ConstantValue(10); + this.emissionOverDistance = (_h = parameters.emissionOverDistance) !== null && _h !== void 0 ? _h : new ConstantValue(0); + this.emissionBursts = (_j = parameters.emissionBursts) !== null && _j !== void 0 ? _j : []; + this.onlyUsedByOther = (_k = parameters.onlyUsedByOther) !== null && _k !== void 0 ? _k : false; + this.emitterShape = (_l = parameters.shape) !== null && _l !== void 0 ? _l : new SphereEmitter(); + this.behaviors = (_m = parameters.behaviors) !== null && _m !== void 0 ? _m : new Array(); + this.worldSpace = (_o = parameters.worldSpace) !== null && _o !== void 0 ? _o : false; + this.rendererEmitterSettings = (_p = parameters.rendererEmitterSettings) !== null && _p !== void 0 ? _p : {}; + if (parameters.renderMode === RenderMode.StretchedBillBoard) { + const stretchedBillboardSettings = this.rendererEmitterSettings; + if (parameters.speedFactor !== undefined) { + stretchedBillboardSettings.speedFactor = parameters.speedFactor; + } + stretchedBillboardSettings.speedFactor = (_q = stretchedBillboardSettings.speedFactor) !== null && _q !== void 0 ? _q : 0; + stretchedBillboardSettings.lengthFactor = (_r = stretchedBillboardSettings.lengthFactor) !== null && _r !== void 0 ? _r : 0; + } + this.rendererSettings = { + instancingGeometry: (_s = parameters.instancingGeometry) !== null && _s !== void 0 ? _s : DEFAULT_GEOMETRY$1, + renderMode: (_t = parameters.renderMode) !== null && _t !== void 0 ? _t : RenderMode.BillBoard, + renderOrder: (_u = parameters.renderOrder) !== null && _u !== void 0 ? _u : 0, + material: parameters.material, + uTileCount: (_v = parameters.uTileCount) !== null && _v !== void 0 ? _v : 1, + vTileCount: (_w = parameters.vTileCount) !== null && _w !== void 0 ? _w : 1, + layers: (_x = parameters.layers) !== null && _x !== void 0 ? _x : new THREE.Layers(), + }; + this.neededToUpdateRender = true; + this.particles = new Array(); + this.startTileIndex = parameters.startTileIndex || new ConstantValue(0); + this.emitter = new ParticleEmitter(this); + this.paused = false; + this.particleNum = 0; + this.emissionState = { + burstIndex: 0, + burstWaveIndex: 0, + time: 0, + waitEmiting: 0, + travelDistance: 0, + }; + this.emitEnded = false; + this.markForDestroy = false; + this.prewarmed = false; + } + pause() { + this.paused = true; + } + play() { + this.paused = false; + } + spawn(count, emissionState, matrix) { + tempQ$1.setFromRotationMatrix(matrix); + const translation = tempV$1; + const quaternion = tempQ$1; + const scale = tempV2$1; + matrix.decompose(translation, quaternion, scale); + for (let i = 0; i < count; i++) { + this.particleNum++; + while (this.particles.length < this.particleNum) { + if (this.rendererSettings.renderMode === RenderMode.Trail) { + this.particles.push(new TrailParticle()); + } + else { + this.particles.push(new SpriteParticle()); + } + } + const particle = this.particles[this.particleNum - 1]; + particle.speedModifier = 1; + this.startColor.genColor(particle.startColor, this.emissionState.time, {}); + particle.color.copy(particle.startColor); + particle.startSpeed = this.startSpeed.genValue(emissionState.time / this.duration); + particle.life = this.startLife.genValue(emissionState.time / this.duration); + particle.age = 0; + particle.startSize = this.startSize.genValue(emissionState.time / this.duration); + particle.uvTile = Math.floor(this.startTileIndex.genValue() + 0.001); + particle.size = particle.startSize; + if (this.rendererSettings.renderMode === RenderMode.Mesh || + this.rendererSettings.renderMode === RenderMode.BillBoard || + this.rendererSettings.renderMode === RenderMode.VerticalBillBoard || + this.rendererSettings.renderMode === RenderMode.HorizontalBillBoard || + this.rendererSettings.renderMode === RenderMode.StretchedBillBoard) { + const sprite = particle; + if (this.rendererSettings.renderMode === RenderMode.Mesh) { + if (!(sprite.rotation instanceof THREE.Quaternion)) { + sprite.rotation = new THREE.Quaternion(); + } + if (this.startRotation.type === 'rotation') { + this.startRotation.genValue(sprite.rotation, emissionState.time / this.duration); + } + else { + sprite.rotation.setFromAxisAngle(UP, this.startRotation.genValue((emissionState.time / this.duration))); + } + } + else { + if (this.startRotation.type === 'rotation') { + sprite.rotation = 0; + } + else { + sprite.rotation = this.startRotation.genValue(emissionState.time / this.duration); + } + } + } + else if (this.rendererSettings.renderMode === RenderMode.Trail) { + const trail = particle; + trail.length = this.rendererEmitterSettings.startLength.genValue(emissionState.time / this.duration); + } + this.emitterShape.initialize(particle); + if (this.rendererSettings.renderMode === RenderMode.Trail && + this.rendererEmitterSettings.followLocalOrigin) { + const trail = particle; + trail.localPosition = new THREE.Vector3().copy(trail.position); + } + if (this.worldSpace) { + particle.position.applyMatrix4(matrix); + particle.startSize = + (particle.startSize * (Math.abs(scale.x) + Math.abs(scale.y) + Math.abs(scale.z))) / 3; + particle.size = particle.startSize; + particle.velocity.multiply(scale).applyMatrix3(this.normalMatrix); + if (particle.rotation && particle.rotation instanceof THREE.Quaternion) { + particle.rotation.multiplyQuaternions(tempQ$1, particle.rotation); + } + } + else { + if (this.onlyUsedByOther) { + particle.parentMatrix = matrix; + } + } + for (let j = 0; j < this.behaviors.length; j++) { + this.behaviors[j].initialize(particle); + } + } + } + endEmit() { + this.emitEnded = true; + if (this.autoDestroy) { + this.markForDestroy = true; + } + } + dispose() { + if (this._renderer) + this._renderer.deleteSystem(this); + this.emitter.dispose(); + if (this.emitter.parent) + this.emitter.parent.remove(this.emitter); + } + restart() { + this.paused = false; + this.particleNum = 0; + this.emissionState.burstIndex = 0; + this.emissionState.burstWaveIndex = 0; + this.emissionState.time = 0; + this.emissionState.waitEmiting = 0; + this.behaviors.forEach((behavior) => { + behavior.reset(); + }); + this.emitEnded = false; + this.markForDestroy = false; + this.prewarmed = false; + } + update(delta) { + if (this.paused) + return; + let currentParent = this.emitter; + while (currentParent.parent) { + currentParent = currentParent.parent; + } + if (currentParent.type !== 'Scene') { + this.dispose(); + return; + } + if (this.firstTimeUpdate) { + this.firstTimeUpdate = false; + this.emitter.updateWorldMatrix(true, false); + } + if (this.emitEnded && this.particleNum === 0) { + if (this.markForDestroy && this.emitter.parent) + this.dispose(); + return; + } + if (this.looping && this.prewarm && !this.prewarmed) { + this.prewarmed = true; + for (let i = 0; i < this.duration * PREWARM_FPS$1; i++) { + this.update(1.0 / PREWARM_FPS$1); + } + } + if (delta > 0.1) { + delta = 0.1; + } + if (this.neededToUpdateRender) { + if (this._renderer) + this._renderer.updateSystem(this); + this.neededToUpdateRender = false; + } + if (!this.onlyUsedByOther) { + this.emit(delta, this.emissionState, this.emitter.matrixWorld); + } + this.emitterShape.update(this, delta); + for (let j = 0; j < this.behaviors.length; j++) { + for (let i = 0; i < this.particleNum; i++) { + if (!this.particles[i].died) { + this.behaviors[j].update(this.particles[i], delta); + } + } + this.behaviors[j].frameUpdate(delta); + } + for (let i = 0; i < this.particleNum; i++) { + if (this.rendererEmitterSettings.followLocalOrigin && + this.particles[i].localPosition) { + this.particles[i].position.copy(this.particles[i].localPosition); + if (this.particles[i].parentMatrix) { + this.particles[i].position.applyMatrix4(this.particles[i].parentMatrix); + } + else { + this.particles[i].position.applyMatrix4(this.emitter.matrixWorld); + } + } + else { + this.particles[i].position.addScaledVector(this.particles[i].velocity, delta * this.particles[i].speedModifier); + } + this.particles[i].age += delta; + } + if (this.rendererSettings.renderMode === RenderMode.Trail) { + for (let i = 0; i < this.particleNum; i++) { + const particle = this.particles[i]; + particle.update(); + } + } + for (let i = 0; i < this.particleNum; i++) { + const particle = this.particles[i]; + if (particle.died && (!(particle instanceof TrailParticle) || particle.previous.length === 0)) { + this.particles[i] = this.particles[this.particleNum - 1]; + this.particles[this.particleNum - 1] = particle; + this.particleNum--; + i--; + } + } + } + emit(delta, emissionState, emitterMatrix) { + if (emissionState.time > this.duration) { + if (this.looping) { + emissionState.time -= this.duration; + emissionState.burstIndex = 0; + this.behaviors.forEach((behavior) => { + behavior.reset(); + }); + } + else { + if (!this.emitEnded && !this.onlyUsedByOther) { + this.endEmit(); + } + } + } + this.normalMatrix.getNormalMatrix(emitterMatrix); + const totalSpawn = Math.ceil(emissionState.waitEmiting); + this.spawn(totalSpawn, emissionState, emitterMatrix); + emissionState.waitEmiting -= totalSpawn; + while (emissionState.burstIndex < this.emissionBursts.length && + this.emissionBursts[emissionState.burstIndex].time <= emissionState.time) { + if (Math.random() < this.emissionBursts[emissionState.burstIndex].probability) { + const count = this.emissionBursts[emissionState.burstIndex].count.genValue(this.time); + this.spawn(count, emissionState, emitterMatrix); + } + emissionState.burstIndex++; + } + if (!this.emitEnded) { + emissionState.waitEmiting += delta * this.emissionOverTime.genValue(emissionState.time / this.duration); + if (emissionState.previousWorldPos != undefined) { + this.temp.set(emitterMatrix.elements[12], emitterMatrix.elements[13], emitterMatrix.elements[14]); + emissionState.travelDistance += emissionState.previousWorldPos.distanceTo(this.temp); + const emitPerMeter = this.emissionOverDistance.genValue(emissionState.time / this.duration); + if (emissionState.travelDistance * emitPerMeter > 0) { + const count = Math.floor(emissionState.travelDistance * emitPerMeter); + emissionState.travelDistance -= count / emitPerMeter; + emissionState.waitEmiting += count; + } + } + } + if (emissionState.previousWorldPos === undefined) + emissionState.previousWorldPos = new THREE.Vector3(); + emissionState.previousWorldPos.set(emitterMatrix.elements[12], emitterMatrix.elements[13], emitterMatrix.elements[14]); + emissionState.time += delta; + } + toJSON(meta, options = {}) { + const isRootObject = meta === undefined || typeof meta === 'string'; + if (isRootObject) { + meta = { + geometries: {}, + materials: {}, + textures: {}, + images: {}, + shapes: {}, + skeletons: {}, + animations: {}, + nodes: {}, + }; + } + meta.materials[this.rendererSettings.material.uuid] = this.rendererSettings.material.toJSON(meta); + if (options.useUrlForImage) { + if (this.texture.source !== undefined) { + const image = this.texture.source; + meta.images[image.uuid] = { + uuid: image.uuid, + url: this.texture.image.url, + }; + } + } + let rendererSettingsJSON; + if (this.renderMode === RenderMode.Trail) { + rendererSettingsJSON = { + startLength: this.rendererEmitterSettings.startLength.toJSON(), + followLocalOrigin: this.rendererEmitterSettings.followLocalOrigin, + }; + } + else if (this.renderMode === RenderMode.Mesh) { + rendererSettingsJSON = {}; + } + else if (this.renderMode === RenderMode.StretchedBillBoard) { + rendererSettingsJSON = { + speedFactor: this.rendererEmitterSettings.speedFactor, + lengthFactor: this.rendererEmitterSettings.lengthFactor, + }; + } + else { + rendererSettingsJSON = {}; + } + const geometry = this.rendererSettings.instancingGeometry; + if (meta.geometries && !meta.geometries[geometry.uuid]) { + meta.geometries[geometry.uuid] = geometry.toJSON(); + } + return { + version: '2.0', + autoDestroy: this.autoDestroy, + looping: this.looping, + prewarm: this.prewarm, + duration: this.duration, + shape: this.emitterShape.toJSON(), + startLife: this.startLife.toJSON(), + startSpeed: this.startSpeed.toJSON(), + startRotation: this.startRotation.toJSON(), + startSize: this.startSize.toJSON(), + startColor: this.startColor.toJSON(), + emissionOverTime: this.emissionOverTime.toJSON(), + emissionOverDistance: this.emissionOverDistance.toJSON(), + emissionBursts: this.emissionBursts.map((burst) => ({ + time: burst.time, + count: burst.count.toJSON(), + probability: burst.probability, + interval: burst.interval, + cycle: burst.cycle, + })), + onlyUsedByOther: this.onlyUsedByOther, + instancingGeometry: this.rendererSettings.instancingGeometry.uuid, + renderOrder: this.renderOrder, + renderMode: this.renderMode, + rendererEmitterSettings: rendererSettingsJSON, + material: this.rendererSettings.material.uuid, + layers: this.layers.mask, + startTileIndex: this.startTileIndex.toJSON(), + uTileCount: this.uTileCount, + vTileCount: this.vTileCount, + behaviors: this.behaviors.map((behavior) => behavior.toJSON()), + worldSpace: this.worldSpace, + }; + } + static fromJSON(json, meta, dependencies) { + var _a, _b; + const shape = EmitterFromJSON(json.shape, meta); + let rendererEmitterSettings; + if (json.renderMode === RenderMode.Trail) { + let trailSettings = json.rendererEmitterSettings; + rendererEmitterSettings = { + startLength: trailSettings.startLength != undefined + ? ValueGeneratorFromJSON(trailSettings.startLength) + : new ConstantValue(30), + followLocalOrigin: trailSettings.followLocalOrigin, + }; + } + else if (json.renderMode === RenderMode.Mesh) { + rendererEmitterSettings = {}; + } + else if (json.renderMode === RenderMode.StretchedBillBoard) { + rendererEmitterSettings = json.rendererEmitterSettings; + if (json.speedFactor != undefined) { + rendererEmitterSettings.speedFactor = json.speedFactor; + } + } + else { + rendererEmitterSettings = {}; + } + const layers = new THREE.Layers(); + if (json.layers) { + layers.mask = json.layers; + } + const ps = new ParticleSystem({ + autoDestroy: json.autoDestroy, + looping: json.looping, + prewarm: json.prewarm, + duration: json.duration, + shape: shape, + startLife: ValueGeneratorFromJSON(json.startLife), + startSpeed: ValueGeneratorFromJSON(json.startSpeed), + startRotation: GeneratorFromJSON(json.startRotation), + startSize: ValueGeneratorFromJSON(json.startSize), + startColor: ColorGeneratorFromJSON(json.startColor), + emissionOverTime: ValueGeneratorFromJSON(json.emissionOverTime), + emissionOverDistance: ValueGeneratorFromJSON(json.emissionOverDistance), + emissionBursts: (_a = json.emissionBursts) === null || _a === void 0 ? void 0 : _a.map((burst) => ({ + time: burst.time, + count: typeof burst.count === 'number' + ? new ConstantValue(burst.count) + : ValueGeneratorFromJSON(burst.count), + probability: burst.probability, + interval: burst.interval, + cycle: burst.cycle, + })), + onlyUsedByOther: json.onlyUsedByOther, + instancingGeometry: meta.geometries[json.instancingGeometry], + renderMode: json.renderMode, + rendererEmitterSettings: rendererEmitterSettings, + renderOrder: json.renderOrder, + layers: layers, + material: json.material + ? meta.materials[json.material] + : json.texture + ? new THREE.MeshBasicMaterial({ + map: meta.textures[json.texture], + transparent: (_b = json.transparent) !== null && _b !== void 0 ? _b : true, + blending: json.blending, + side: THREE.DoubleSide, + }) + : new THREE.MeshBasicMaterial({ + color: 0xffffff, + transparent: true, + blending: THREE.AdditiveBlending, + side: THREE.DoubleSide, + }), + startTileIndex: typeof json.startTileIndex === 'number' + ? new ConstantValue(json.startTileIndex) + : ValueGeneratorFromJSON(json.startTileIndex), + uTileCount: json.uTileCount, + vTileCount: json.vTileCount, + behaviors: [], + worldSpace: json.worldSpace, + }); + ps.behaviors = json.behaviors.map((behaviorJson) => { + const behavior = BehaviorFromJSON(behaviorJson, ps); + if (behavior.type === 'EmitSubParticleSystem') { + dependencies[behaviorJson.subParticleSystem] = behavior; + } + return behavior; + }); + return ps; + } + addBehavior(behavior) { + this.behaviors.push(behavior); + } + getRendererSettings() { + return this.rendererSettings; + } + clone() { + const newEmissionBursts = []; + for (const emissionBurst of this.emissionBursts) { + const newEmissionBurst = {}; + Object.assign(newEmissionBurst, emissionBurst); + newEmissionBursts.push(newEmissionBurst); + } + const newBehaviors = []; + for (const behavior of this.behaviors) { + newBehaviors.push(behavior.clone()); + } + let rendererEmitterSettings; + if (this.renderMode === RenderMode.Trail) { + rendererEmitterSettings = { + startLength: this.rendererEmitterSettings.startLength.clone(), + followLocalOrigin: this.rendererEmitterSettings.followLocalOrigin, + }; + } + else { + rendererEmitterSettings = {}; + } + const layers = new THREE.Layers(); + layers.mask = this.layers.mask; + return new ParticleSystem({ + autoDestroy: this.autoDestroy, + looping: this.looping, + duration: this.duration, + shape: this.emitterShape.clone(), + startLife: this.startLife.clone(), + startSpeed: this.startSpeed.clone(), + startRotation: this.startRotation.clone(), + startSize: this.startSize.clone(), + startColor: this.startColor.clone(), + emissionOverTime: this.emissionOverTime.clone(), + emissionOverDistance: this.emissionOverDistance.clone(), + emissionBursts: newEmissionBursts, + onlyUsedByOther: this.onlyUsedByOther, + instancingGeometry: this.rendererSettings.instancingGeometry, + renderMode: this.renderMode, + renderOrder: this.renderOrder, + rendererEmitterSettings: rendererEmitterSettings, + material: this.rendererSettings.material, + startTileIndex: this.startTileIndex, + uTileCount: this.uTileCount, + vTileCount: this.vTileCount, + behaviors: newBehaviors, + worldSpace: this.worldSpace, + layers: layers, + }); + } +} + +var particle_frag = ` + +#include +#include +#include +#include +#include +#include +#include + +void main() { + + #include + + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vColor; + + #include + + #ifdef USE_MAP + diffuseColor *= texture2D( map, vMapUv); + #endif + + #include + + outgoingLight = diffuseColor.rgb; + + #ifdef USE_COLOR_AS_ALPHA + gl_FragColor = vec4( outgoingLight, diffuseColor.r ); + #else + gl_FragColor = vec4( outgoingLight, diffuseColor.a ); + #endif + + + #include + +} +`; + +var particle_physics_frag = ` +#define STANDARD +#ifdef PHYSICAL +#define IOR +#define SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR +uniform float ior; +#endif +#ifdef SPECULAR +uniform float specularIntensity; +uniform vec3 specularColor; +#ifdef USE_SPECULARINTENSITYMAP +uniform sampler2D specularIntensityMap; +#endif +#ifdef USE_SPECULARCOLORMAP +uniform sampler2D specularColorMap; +#endif +#endif +#ifdef USE_CLEARCOAT +uniform float clearcoat; +uniform float clearcoatRoughness; +#endif +#ifdef USE_IRIDESCENCE +uniform float iridescence; +uniform float iridescenceIOR; +uniform float iridescenceThicknessMinimum; +uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN +uniform vec3 sheenColor; +uniform float sheenRoughness; +#ifdef USE_SHEENCOLORMAP +uniform sampler2D sheenColorMap; +#endif +#ifdef USE_SHEENROUGHNESSMAP +uniform sampler2D sheenRoughnessMap; +#endif +#endif + +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + // accumulation + #include + #include + #include + #include + // modulation + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + // Sheen energy compensation approximation calculation can be found at the end of + // https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`; + +var uv_vertex_tile = ` + + #ifdef UV_TILE + float col = mod(uvTile, tileCount.x); + float row = (tileCount.y - floor(uvTile / tileCount.x) - 1.0); + + mat3 tileTransform = mat3( + 1.0 / tileCount.x, 0.0, 0.0, + 0.0, 1.0 / tileCount.y, 0.0, + col / tileCount.x, row / tileCount.y, 1.0); + #else + mat3 tileTransform = mat3(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0); + #endif + +#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + +vUv = (tileTransform *vec3( uv, 1 )).xy; + +#endif +#ifdef USE_MAP + +vMapUv = ( tileTransform * (mapTransform * vec3( MAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_ALPHAMAP + +vAlphaMapUv = ( tileTransform * (alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_LIGHTMAP + +vLightMapUv = ( tileTransform * (lightMapTransform * vec3( LIGHTMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_AOMAP + +vAoMapUv = ( tileTransform * (aoMapTransform * vec3( AOMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_BUMPMAP + +vBumpMapUv = ( tileTransform * (bumpMapTransform * vec3( BUMPMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_NORMALMAP + +vNormalMapUv = ( tileTransform * (normalMapTransform * vec3( NORMALMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_DISPLACEMENTMAP + +vDisplacementMapUv = ( tileTransform * (displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_EMISSIVEMAP + +vEmissiveMapUv = ( tileTransform * (emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_METALNESSMAP + +vMetalnessMapUv = ( tileTransform * (metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_ROUGHNESSMAP + +vRoughnessMapUv = ( tileTransform * (roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_ANISOTROPYMAP + +vAnisotropyMapUv = ( tileTransform * (anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_CLEARCOATMAP + +vClearcoatMapUv = ( tileTransform * (clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + +vClearcoatNormalMapUv = ( tileTransform * (clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + +vClearcoatRoughnessMapUv = ( tileTransform * (clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_IRIDESCENCEMAP + +vIridescenceMapUv = ( tileTransform * (iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + +vIridescenceThicknessMapUv = ( tileTransform * (iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_SHEEN_COLORMAP + +vSheenColorMapUv = ( tileTransform * (sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + +vSheenRoughnessMapUv = ( tileTransform * (sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_SPECULARMAP + +vSpecularMapUv = ( tileTransform * (specularMapTransform * vec3( SPECULARMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_SPECULAR_COLORMAP + +vSpecularColorMapUv = ( tileTransform * (specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + +vSpecularIntensityMapUv = ( tileTransform * (specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_TRANSMISSIONMAP + +vTransmissionMapUv = ( tileTransform * transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) )).xy; + +#endif +#ifdef USE_THICKNESSMAP + +vThicknessMapUv = ( tileTransform * thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) )).xy; + +#endif +`; + +var particle_vert = ` +#include +#include +#include +#include +#include + +attribute vec3 offset; +attribute float rotation; +attribute float size; +attribute float uvTile; + +#ifdef UV_TILE +uniform vec2 tileCount; +#endif + +void main() { + + ${uv_vertex_tile} + + vec2 alignedPosition = ( position.xy ) * size; + + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; +#ifdef HORIZONTAL + vec4 mvPosition = modelMatrix * vec4( offset, 1.0 ); + mvPosition.x += rotatedPosition.x; + mvPosition.z -= rotatedPosition.y; + mvPosition = viewMatrix * mvPosition; +#elif defined(VERTICAL) + vec4 mvPosition = modelMatrix * vec4( offset, 1.0 ); + mvPosition.y += rotatedPosition.y; + mvPosition = viewMatrix * mvPosition; + mvPosition.x += rotatedPosition.x; +#else + vec4 mvPosition = modelViewMatrix * vec4( offset, 1.0 ); + mvPosition.xy += rotatedPosition; +#endif + + vColor = color; + + gl_Position = projectionMatrix * mvPosition; + + #include + #include + +} +`; + +var local_particle_vert = ` +#include +#include +#include +#include +#include + +attribute vec3 offset; +attribute vec4 rotation; +attribute float size; +// attribute vec4 color; +attribute float uvTile; + +#ifdef UV_TILE +uniform vec2 tileCount; +#endif + +void main() { + + ${uv_vertex_tile} + + float x2 = rotation.x + rotation.x, y2 = rotation.y + rotation.y, z2 = rotation.z + rotation.z; + float xx = rotation.x * x2, xy = rotation.x * y2, xz = rotation.x * z2; + float yy = rotation.y * y2, yz = rotation.y * z2, zz = rotation.z * z2; + float wx = rotation.w * x2, wy = rotation.w * y2, wz = rotation.w * z2; + float sx = size, sy = size, sz = size; + + mat4 matrix = mat4(( 1.0 - ( yy + zz ) ) * sx, ( xy + wz ) * sx, ( xz - wy ) * sx, 0.0, // 1. column + ( xy - wz ) * sy, ( 1.0 - ( xx + zz ) ) * sy, ( yz + wx ) * sy, 0.0, // 2. column + ( xz + wy ) * sz, ( yz - wx ) * sz, ( 1.0 - ( xx + yy ) ) * sz, 0.0, // 3. column + offset.x, offset.y, offset.z, 1.0); + + vec4 mvPosition = modelViewMatrix * (matrix * vec4( position, 1.0 )); + + vColor = color; + + gl_Position = projectionMatrix * mvPosition; + + #include + #include + +} +`; + +var local_particle_physics_vert = ` +#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include + +attribute vec3 offset; +attribute vec4 rotation; +attribute float size; +attribute float uvTile; + +#ifdef UV_TILE +uniform vec2 tileCount; +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void main() { + ${uv_vertex_tile} + + float x2 = rotation.x + rotation.x, y2 = rotation.y + rotation.y, z2 = rotation.z + rotation.z; + float xx = rotation.x * x2, xy = rotation.x * y2, xz = rotation.x * z2; + float yy = rotation.y * y2, yz = rotation.y * z2, zz = rotation.z * z2; + float wx = rotation.w * x2, wy = rotation.w * y2, wz = rotation.w * z2; + float sx = size, sy = size, sz = size; + + mat4 particleMatrix = mat4(( 1.0 - ( yy + zz ) ) * sx, ( xy + wz ) * sx, ( xz - wy ) * sx, 0.0, // 1. column + ( xy - wz ) * sy, ( 1.0 - ( xx + zz ) ) * sy, ( yz + wx ) * sy, 0.0, // 2. column + ( xz + wy ) * sz, ( yz - wx ) * sz, ( 1.0 - ( xx + yy ) ) * sz, 0.0, // 3. column + offset.x, offset.y, offset.z, 1.0); + + #include + #include + #include + #include + #include + #include + + // replace defaultnormal_vertex + vec3 transformedNormal = objectNormal; + mat3 m = mat3( particleMatrix ); + transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); + transformedNormal = m * transformedNormal; + transformedNormal = normalMatrix * transformedNormal; + #ifdef FLIP_SIDED + transformedNormal = - transformedNormal; + #endif + #ifdef USE_TANGENT + vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif + #endif + + #include + #include + #include + #include + #include + + // replace include + vec4 mvPosition = vec4( transformed, 1.0 ); + mvPosition = modelViewMatrix * (particleMatrix * mvPosition); + gl_Position = projectionMatrix * mvPosition; + + #include + #include + + vViewPosition = - mvPosition.xyz; + + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +} +`; + +var stretched_bb_particle_vert = ` +#include +#include +#include +#include +#include + +attribute vec3 offset; +attribute float rotation; +attribute float size; +attribute vec4 velocity; +attribute float uvTile; + +#ifdef UV_TILE +uniform vec2 tileCount; +#endif + +uniform float speedFactor; + +void main() { + + ${uv_vertex_tile} + + float lengthFactor = velocity.w; +#ifdef USE_SKEW + vec4 mvPosition = modelViewMatrix * vec4( offset, 1.0 ); + vec3 viewVelocity = normalMatrix * velocity.xyz; + + vec3 scaledPos = vec3(position.xy * size, position.z); + float vlength = length(viewVelocity); + vec3 projVelocity = dot(scaledPos, viewVelocity) * viewVelocity / vlength; + mvPosition.xyz += scaledPos + projVelocity * (speedFactor / size + lengthFactor / vlength); +#else + vec4 mvPosition = modelViewMatrix * vec4( offset, 1.0 ); + vec3 viewVelocity = normalMatrix * velocity.xyz; + float vlength = length(viewVelocity); + mvPosition.xyz += position.y * normalize(cross(mvPosition.xyz, viewVelocity)) * size; // switch the cross to match unity implementation + mvPosition.xyz -= (position.x + 0.5) * viewVelocity * (1.0 + lengthFactor / vlength) * size; // minus position.x to match unity implementation +#endif + vColor = color; + gl_Position = projectionMatrix * mvPosition; + #include + #include +} +`; + +function getMaterialUVChannelName(value) { + if (value === 0) + return 'uv'; + return `uv${value}`; +} + +new THREE.Vector3(0, 0, 1); +class SpriteBatch extends VFXBatch { + constructor(settings) { + super(settings); + this.vector_ = new THREE.Vector3(); + this.vector2_ = new THREE.Vector3(); + this.vector3_ = new THREE.Vector3(); + this.quaternion_ = new THREE.Quaternion(); + this.quaternion2_ = new THREE.Quaternion(); + this.quaternion3_ = new THREE.Quaternion(); + this.rotationMat_ = new THREE.Matrix3(); + this.rotationMat2_ = new THREE.Matrix3(); + this.maxParticles = 1000; + this.setupBuffers(); + this.rebuildMaterial(); + } + buildExpandableBuffers() { + this.offsetBuffer = new THREE.InstancedBufferAttribute(new Float32Array(this.maxParticles * 3), 3); + this.offsetBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setAttribute('offset', this.offsetBuffer); + this.colorBuffer = new THREE.InstancedBufferAttribute(new Float32Array(this.maxParticles * 4), 4); + this.colorBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setAttribute('color', this.colorBuffer); + if (this.settings.renderMode === RenderMode.Mesh) { + this.rotationBuffer = new THREE.InstancedBufferAttribute(new Float32Array(this.maxParticles * 4), 4); + this.rotationBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setAttribute('rotation', this.rotationBuffer); + } + else if (this.settings.renderMode === RenderMode.BillBoard || + this.settings.renderMode === RenderMode.HorizontalBillBoard || + this.settings.renderMode === RenderMode.VerticalBillBoard || + this.settings.renderMode === RenderMode.StretchedBillBoard) { + this.rotationBuffer = new THREE.InstancedBufferAttribute(new Float32Array(this.maxParticles), 1); + this.rotationBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setAttribute('rotation', this.rotationBuffer); + } + this.sizeBuffer = new THREE.InstancedBufferAttribute(new Float32Array(this.maxParticles), 1); + this.sizeBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setAttribute('size', this.sizeBuffer); + this.uvTileBuffer = new THREE.InstancedBufferAttribute(new Float32Array(this.maxParticles), 1); + this.uvTileBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setAttribute('uvTile', this.uvTileBuffer); + if (this.settings.renderMode === RenderMode.StretchedBillBoard) { + this.velocityBuffer = new THREE.InstancedBufferAttribute(new Float32Array(this.maxParticles * 4), 4); + this.velocityBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setAttribute('velocity', this.velocityBuffer); + } + } + setupBuffers() { + if (this.geometry) + this.geometry.dispose(); + this.geometry = new THREE.InstancedBufferGeometry(); + this.geometry.setIndex(this.settings.instancingGeometry.getIndex()); + if (this.settings.instancingGeometry.hasAttribute('normal')) { + this.geometry.setAttribute('normal', this.settings.instancingGeometry.getAttribute('normal')); + } + this.geometry.setAttribute('position', this.settings.instancingGeometry.getAttribute('position')); + this.geometry.setAttribute('uv', this.settings.instancingGeometry.getAttribute('uv')); + this.buildExpandableBuffers(); + } + expandBuffers(target) { + while (target >= this.maxParticles) { + this.maxParticles *= 2; + } + this.setupBuffers(); + } + rebuildMaterial() { + this.layers.mask = this.settings.layers.mask; + let uniforms; + const defines = {}; + if (this.settings.material.type === 'MeshStandardMaterial' || + this.settings.material.type === 'MeshPhysicalMaterial') { + const mat = this.settings.material; + uniforms = THREE.UniformsUtils.merge([ + THREE.UniformsLib.common, + THREE.UniformsLib.envmap, + THREE.UniformsLib.aomap, + THREE.UniformsLib.lightmap, + THREE.UniformsLib.emissivemap, + THREE.UniformsLib.bumpmap, + THREE.UniformsLib.normalmap, + THREE.UniformsLib.displacementmap, + THREE.UniformsLib.roughnessmap, + THREE.UniformsLib.metalnessmap, + THREE.UniformsLib.fog, + THREE.UniformsLib.lights, + { + emissive: { value: new THREE.Color(0x000000) }, + roughness: { value: 1.0 }, + metalness: { value: 0.0 }, + envMapIntensity: { value: 1 }, + }, + ]); + uniforms['diffuse'].value = mat.color; + uniforms['opacity'].value = mat.opacity; + uniforms['emissive'].value = mat.emissive; + uniforms['roughness'].value = mat.roughness; + uniforms['metalness'].value = mat.metalness; + if (mat.envMap) { + uniforms['envMap'].value = mat.envMap; + uniforms['envMapIntensity'].value = mat.envMapIntensity; + } + if (mat.normalMap) { + uniforms['normalMap'].value = mat.normalMap; + uniforms['normalScale'].value = mat.normalScale; + } + if (mat.roughnessMap) { + uniforms['roughnessMap'].value = mat.roughnessMap; + } + if (mat.metalnessMap) { + uniforms['metalnessMap'].value = mat.metalnessMap; + } + if (mat.map) { + uniforms['map'] = new THREE.Uniform(mat.map); + } + } + else { + uniforms = {}; + uniforms['map'] = new THREE.Uniform(this.settings.material.map); + } + if (this.settings.material.alphaTest) { + defines['USE_ALPHATEST'] = ''; + uniforms['alphaTest'] = new THREE.Uniform(this.settings.material.alphaTest); + } + defines['USE_UV'] = ''; + const uTileCount = this.settings.uTileCount; + const vTileCount = this.settings.vTileCount; + if (uTileCount > 1 || vTileCount > 1) { + defines['UV_TILE'] = ''; + uniforms['tileCount'] = new THREE.Uniform(new THREE.Vector2(uTileCount, vTileCount)); + } + if (this.settings.material.defines && + this.settings.material.defines['USE_COLOR_AS_ALPHA'] !== undefined) { + defines['USE_COLOR_AS_ALPHA'] = ''; + } + if (this.settings.material.normalMap) { + defines['USE_NORMALMAP'] = ''; + defines['NORMALMAP_UV'] = getMaterialUVChannelName(this.settings.material.normalMap.channel); + uniforms['normalMapTransform'] = new THREE.Uniform(new THREE.Matrix3().copy(this.settings.material.normalMap.matrix)); + } + if (this.settings.material.map) { + defines['USE_MAP'] = ''; + defines['MAP_UV'] = getMaterialUVChannelName(this.settings.material.map.channel); + uniforms['mapTransform'] = new THREE.Uniform(new THREE.Matrix3().copy(this.settings.material.map.matrix)); + } + defines['USE_COLOR_ALPHA'] = ''; + let needLights = false; + if (this.settings.renderMode === RenderMode.BillBoard || + this.settings.renderMode === RenderMode.VerticalBillBoard || + this.settings.renderMode === RenderMode.HorizontalBillBoard || + this.settings.renderMode === RenderMode.Mesh) { + let vertexShader; + let fragmentShader; + if (this.settings.renderMode === RenderMode.Mesh) { + if (this.settings.material.type === 'MeshStandardMaterial' || + this.settings.material.type === 'MeshPhysicalMaterial') { + defines['USE_COLOR'] = ''; + vertexShader = local_particle_physics_vert; + fragmentShader = particle_physics_frag; + needLights = true; + } + else { + vertexShader = local_particle_vert; + fragmentShader = particle_frag; + } + } + else { + vertexShader = particle_vert; + fragmentShader = particle_frag; + } + if (this.settings.renderMode === RenderMode.VerticalBillBoard) { + defines['VERTICAL'] = ''; + } + else if (this.settings.renderMode === RenderMode.HorizontalBillBoard) { + defines['HORIZONTAL'] = ''; + } + this.material = new THREE.ShaderMaterial({ + uniforms: uniforms, + defines: defines, + vertexShader: vertexShader, + fragmentShader: fragmentShader, + transparent: this.settings.material.transparent, + depthWrite: !this.settings.material.transparent, + blending: this.settings.material.blending, + side: this.settings.material.side, + alphaTest: this.settings.material.alphaTest, + lights: needLights, + }); + } + else if (this.settings.renderMode === RenderMode.StretchedBillBoard) { + uniforms['speedFactor'] = new THREE.Uniform(1.0); + this.material = new THREE.ShaderMaterial({ + uniforms: uniforms, + defines: defines, + vertexShader: stretched_bb_particle_vert, + fragmentShader: particle_frag, + transparent: this.settings.material.transparent, + depthWrite: !this.settings.material.transparent, + blending: this.settings.material.blending, + side: this.settings.material.side, + alphaTest: this.settings.material.alphaTest, + }); + } + else { + throw new Error('render mode unavailable'); + } + } + update() { + let index = 0; + let particleCount = 0; + this.systems.forEach((system) => { + particleCount += system.particleNum; + }); + if (particleCount > this.maxParticles) { + this.expandBuffers(particleCount); + } + this.systems.forEach((system) => { + const particles = system.particles; + const particleNum = system.particleNum; + const rotation = this.quaternion2_; + const translation = this.vector2_; + const scale = this.vector3_; + system.emitter.matrixWorld.decompose(translation, rotation, scale); + this.rotationMat_.setFromMatrix4(system.emitter.matrixWorld); + for (let j = 0; j < particleNum; j++ , index++) { + const particle = particles[j]; + if (this.settings.renderMode === RenderMode.Mesh) { + let q; + if (system.worldSpace) { + q = particle.rotation; + } + else { + let parentQ; + if (particle.parentMatrix) { + parentQ = this.quaternion3_.setFromRotationMatrix(particle.parentMatrix); + } + else { + parentQ = rotation; + } + q = this.quaternion_; + q.copy(particle.rotation).multiply(parentQ); + } + this.rotationBuffer.setXYZW(index, q.x, q.y, q.z, q.w); + } + else if (this.settings.renderMode === RenderMode.StretchedBillBoard || + this.settings.renderMode === RenderMode.VerticalBillBoard || + this.settings.renderMode === RenderMode.HorizontalBillBoard || + this.settings.renderMode === RenderMode.BillBoard) { + this.rotationBuffer.setX(index, particle.rotation); + } + let vec; + if (system.worldSpace) { + vec = particle.position; + } + else { + vec = this.vector_; + if (particle.parentMatrix) { + vec.copy(particle.position).applyMatrix4(particle.parentMatrix); + } + else { + vec.copy(particle.position).applyMatrix4(system.emitter.matrixWorld); + } + } + this.offsetBuffer.setXYZ(index, vec.x, vec.y, vec.z); + this.colorBuffer.setXYZW(index, particle.color.x, particle.color.y, particle.color.z, particle.color.w); + if (system.worldSpace) { + this.sizeBuffer.setX(index, particle.size); + } + else { + if (particle.parentMatrix) { + this.sizeBuffer.setX(index, particle.size); + } + else { + this.sizeBuffer.setX(index, (particle.size * (Math.abs(scale.x) + Math.abs(scale.y) + Math.abs(scale.z))) / 3); + } + } + this.uvTileBuffer.setX(index, particle.uvTile); + if (this.settings.renderMode === RenderMode.StretchedBillBoard && this.velocityBuffer) { + let speedFactor = system.rendererEmitterSettings.speedFactor; + if (speedFactor === 0) + speedFactor = 0.001; + const lengthFactor = system.rendererEmitterSettings.lengthFactor; + let vec; + if (system.worldSpace) { + vec = particle.velocity; + } + else { + vec = this.vector_; + if (particle.parentMatrix) { + this.rotationMat2_.setFromMatrix4(particle.parentMatrix); + vec.copy(particle.velocity).applyMatrix3(this.rotationMat2_); + } + else { + vec.copy(particle.velocity).applyMatrix3(this.rotationMat_); + } + } + this.velocityBuffer.setXYZW(index, vec.x * speedFactor, vec.y * speedFactor, vec.z * speedFactor, lengthFactor); + } + } + }); + this.geometry.instanceCount = index; + if (index > 0) { + this.offsetBuffer.updateRange.count = index * 3; + this.offsetBuffer.needsUpdate = true; + this.sizeBuffer.updateRange.count = index; + this.sizeBuffer.needsUpdate = true; + this.colorBuffer.updateRange.count = index * 4; + this.colorBuffer.needsUpdate = true; + this.uvTileBuffer.updateRange.count = index; + this.uvTileBuffer.needsUpdate = true; + if (this.settings.renderMode === RenderMode.StretchedBillBoard && this.velocityBuffer) { + this.velocityBuffer.updateRange.count = index * 4; + this.velocityBuffer.needsUpdate = true; + } + if (this.settings.renderMode === RenderMode.Mesh) { + this.rotationBuffer.updateRange.count = index * 4; + this.rotationBuffer.needsUpdate = true; + } + else if (this.settings.renderMode === RenderMode.StretchedBillBoard || + this.settings.renderMode === RenderMode.HorizontalBillBoard || + this.settings.renderMode === RenderMode.VerticalBillBoard || + this.settings.renderMode === RenderMode.BillBoard) { + this.rotationBuffer.updateRange.count = index; + this.rotationBuffer.needsUpdate = true; + } + } + } + dispose() { + this.geometry.dispose(); + } +} + +var trail_frag = ` + +#include +#include +#include +#include +#include +#include + +uniform sampler2D alphaMap; +uniform float useAlphaMap; +uniform float visibility; +uniform float alphaTest; +uniform vec2 repeat; + +varying vec4 vColor; + +void main() { + #include + #include + + vec4 c = vColor; + + #ifdef USE_MAP + #ifdef USE_COLOR_AS_ALPHA + vec4 tex = texture2D( map, vUv * repeat ); + c *= vec4(tex.rgb, tex.r); + #else + c *= texture2D( map, vUv * repeat ); + #endif + #endif + if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUv * repeat ).a; + if( c.a < alphaTest ) discard; + gl_FragColor = c; + + #include + #include +}`; + +var trail_vert = ` +#include +#include +#include +#include +#include +#include + +attribute vec3 previous; +attribute vec3 next; +attribute float side; +attribute float width; + +uniform vec2 resolution; +uniform float lineWidth; +uniform float sizeAttenuation; + +vec2 fix(vec4 i, float aspect) { + vec2 res = i.xy / i.w; + res.x *= aspect; + return res; +} + +void main() { + + ${uv_vertex_tile} + + float aspect = resolution.x / resolution.y; + + vColor = color; + + mat4 m = projectionMatrix * modelViewMatrix; + vec4 finalPosition = m * vec4( position, 1.0 ); + vec4 prevPos = m * vec4( previous, 1.0 ); + vec4 nextPos = m * vec4( next, 1.0 ); + + vec2 currentP = fix( finalPosition, aspect ); + vec2 prevP = fix( prevPos, aspect ); + vec2 nextP = fix( nextPos, aspect ); + + float w = lineWidth * width; + + vec2 dir; + if( nextP == currentP ) dir = normalize( currentP - prevP ); + else if( prevP == currentP ) dir = normalize( nextP - currentP ); + else { + vec2 dir1 = normalize( currentP - prevP ); + vec2 dir2 = normalize( nextP - currentP ); + dir = normalize( dir1 + dir2 ); + + vec2 perp = vec2( -dir1.y, dir1.x ); + vec2 miter = vec2( -dir.y, dir.x ); + //w = clamp( w / dot( miter, perp ), 0., 4., * lineWidth * width ); + + } + + //vec2 normal = ( cross( vec3( dir, 0. ) vec3( 0., 0., 1. ) ) ).xy; + vec4 normal = vec4( -dir.y, dir.x, 0., 1. ); + normal.xy *= .5 * w; + normal *= projectionMatrix; + if( sizeAttenuation == 0. ) { + normal.xy *= finalPosition.w; + normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy; + } + + finalPosition.xy += normal.xy * side; + + gl_Position = finalPosition; + + #include + #include + + vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); + + #include +}`; + +new THREE.Vector3(0, 0, 1); +class TrailBatch extends VFXBatch { + constructor(settings) { + super(settings); + this.vector_ = new THREE.Vector3(); + this.vector2_ = new THREE.Vector3(); + this.vector3_ = new THREE.Vector3(); + this.quaternion_ = new THREE.Quaternion(); + this.maxParticles = 10000; + this.setupBuffers(); + this.rebuildMaterial(); + } + setupBuffers() { + if (this.geometry) + this.geometry.dispose(); + this.geometry = new THREE.BufferGeometry(); + this.indexBuffer = new THREE.BufferAttribute(new Uint32Array(this.maxParticles * 6), 1); + this.indexBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setIndex(this.indexBuffer); + this.positionBuffer = new THREE.BufferAttribute(new Float32Array(this.maxParticles * 6), 3); + this.positionBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setAttribute('position', this.positionBuffer); + this.previousBuffer = new THREE.BufferAttribute(new Float32Array(this.maxParticles * 6), 3); + this.previousBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setAttribute('previous', this.previousBuffer); + this.nextBuffer = new THREE.BufferAttribute(new Float32Array(this.maxParticles * 6), 3); + this.nextBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setAttribute('next', this.nextBuffer); + this.widthBuffer = new THREE.BufferAttribute(new Float32Array(this.maxParticles * 2), 1); + this.widthBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setAttribute('width', this.widthBuffer); + this.sideBuffer = new THREE.BufferAttribute(new Float32Array(this.maxParticles * 2), 1); + this.sideBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setAttribute('side', this.sideBuffer); + this.uvBuffer = new THREE.BufferAttribute(new Float32Array(this.maxParticles * 4), 2); + this.uvBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setAttribute('uv', this.uvBuffer); + this.colorBuffer = new THREE.BufferAttribute(new Float32Array(this.maxParticles * 8), 4); + this.colorBuffer.setUsage(THREE.DynamicDrawUsage); + this.geometry.setAttribute('color', this.colorBuffer); + } + expandBuffers(target) { + while (target >= this.maxParticles) { + this.maxParticles *= 2; + } + this.setupBuffers(); + } + rebuildMaterial() { + this.layers.mask = this.settings.layers.mask; + const uniforms = { + lineWidth: { value: 1 }, + map: { value: null }, + useMap: { value: 0 }, + alphaMap: { value: null }, + useAlphaMap: { value: 0 }, + resolution: { value: new THREE.Vector2(1, 1) }, + sizeAttenuation: { value: 1 }, + visibility: { value: 1 }, + alphaTest: { value: 0 }, + repeat: { value: new THREE.Vector2(1, 1) }, + }; + const defines = {}; + defines['USE_UV'] = ''; + defines['USE_COLOR_ALPHA'] = ''; + if (this.settings.material.map) { + defines['USE_MAP'] = ''; + defines['MAP_UV'] = getMaterialUVChannelName(this.settings.material.map.channel); + uniforms['map'] = new THREE.Uniform(this.settings.material.map); + uniforms['mapTransform'] = new THREE.Uniform(new THREE.Matrix3().copy(this.settings.material.map.matrix)); + } + if (this.settings.material.defines && + this.settings.material.defines['USE_COLOR_AS_ALPHA'] !== undefined) { + defines['USE_COLOR_AS_ALPHA'] = ''; + } + if (this.settings.renderMode === RenderMode.Trail) { + this.material = new THREE.ShaderMaterial({ + uniforms: uniforms, + defines: defines, + vertexShader: trail_vert, + fragmentShader: trail_frag, + transparent: this.settings.material.transparent, + depthWrite: !this.settings.material.transparent, + side: this.settings.material.side, + blending: this.settings.material.blending || THREE.AdditiveBlending, + }); + } + else { + throw new Error('render mode unavailable'); + } + } + update() { + let index = 0; + let triangles = 0; + let particleCount = 0; + this.systems.forEach((system) => { + for (let j = 0; j < system.particleNum; j++) { + particleCount += system.particles[j].previous.length * 2; + } + }); + if (particleCount > this.maxParticles) { + this.expandBuffers(particleCount); + } + this.systems.forEach((system) => { + const rotation = this.quaternion_; + const translation = this.vector2_; + const scale = this.vector3_; + system.emitter.matrixWorld.decompose(translation, rotation, scale); + const particles = system.particles; + const particleNum = system.particleNum; + const uTileCount = this.settings.uTileCount; + const vTileCount = this.settings.vTileCount; + const tileWidth = 1 / uTileCount; + const tileHeight = 1 / vTileCount; + for (let j = 0; j < particleNum; j++) { + const particle = particles[j]; + const col = particle.uvTile % vTileCount; + const row = Math.floor(particle.uvTile / vTileCount + 0.001); + const iter = particle.previous.values(); + let curIter = iter.next(); + let previous = curIter.value; + let current = previous; + if (!curIter.done) + curIter = iter.next(); + let next; + if (curIter.value !== undefined) { + next = curIter.value; + } + else { + next = current; + } + for (let i = 0; i < particle.previous.length; i++ , index += 2) { + this.positionBuffer.setXYZ(index, current.position.x, current.position.y, current.position.z); + this.positionBuffer.setXYZ(index + 1, current.position.x, current.position.y, current.position.z); + if (system.worldSpace) { + this.positionBuffer.setXYZ(index, current.position.x, current.position.y, current.position.z); + this.positionBuffer.setXYZ(index + 1, current.position.x, current.position.y, current.position.z); + } + else { + if (particle.parentMatrix) { + this.vector_.copy(current.position).applyMatrix4(particle.parentMatrix); + } + else { + this.vector_.copy(current.position).applyMatrix4(system.emitter.matrixWorld); + } + this.positionBuffer.setXYZ(index, this.vector_.x, this.vector_.y, this.vector_.z); + this.positionBuffer.setXYZ(index + 1, this.vector_.x, this.vector_.y, this.vector_.z); + } + if (system.worldSpace) { + this.previousBuffer.setXYZ(index, previous.position.x, previous.position.y, previous.position.z); + this.previousBuffer.setXYZ(index + 1, previous.position.x, previous.position.y, previous.position.z); + } + else { + if (particle.parentMatrix) { + this.vector_.copy(previous.position).applyMatrix4(particle.parentMatrix); + } + else { + this.vector_.copy(previous.position).applyMatrix4(system.emitter.matrixWorld); + } + this.previousBuffer.setXYZ(index, this.vector_.x, this.vector_.y, this.vector_.z); + this.previousBuffer.setXYZ(index + 1, this.vector_.x, this.vector_.y, this.vector_.z); + } + if (system.worldSpace) { + this.nextBuffer.setXYZ(index, next.position.x, next.position.y, next.position.z); + this.nextBuffer.setXYZ(index + 1, next.position.x, next.position.y, next.position.z); + } + else { + if (particle.parentMatrix) { + this.vector_.copy(next.position).applyMatrix4(particle.parentMatrix); + } + else { + this.vector_.copy(next.position).applyMatrix4(system.emitter.matrixWorld); + } + this.nextBuffer.setXYZ(index, this.vector_.x, this.vector_.y, this.vector_.z); + this.nextBuffer.setXYZ(index + 1, this.vector_.x, this.vector_.y, this.vector_.z); + } + this.sideBuffer.setX(index, -1); + this.sideBuffer.setX(index + 1, 1); + if (system.worldSpace) { + this.widthBuffer.setX(index, current.size); + this.widthBuffer.setX(index + 1, current.size); + } + else { + if (particle.parentMatrix) { + this.widthBuffer.setX(index, current.size); + this.widthBuffer.setX(index + 1, current.size); + } + else { + const objectScale = (Math.abs(scale.x) + Math.abs(scale.y) + Math.abs(scale.z)) / 3; + this.widthBuffer.setX(index, current.size * objectScale); + this.widthBuffer.setX(index + 1, current.size * objectScale); + } + } + this.uvBuffer.setXY(index, (i / particle.previous.length + col) * tileWidth, (vTileCount - row - 1) * tileHeight); + this.uvBuffer.setXY(index + 1, (i / particle.previous.length + col) * tileWidth, (vTileCount - row) * tileHeight); + this.colorBuffer.setXYZW(index, current.color.x, current.color.y, current.color.z, current.color.w); + this.colorBuffer.setXYZW(index + 1, current.color.x, current.color.y, current.color.z, current.color.w); + if (i + 1 < particle.previous.length) { + this.indexBuffer.setX(triangles * 3, index); + this.indexBuffer.setX(triangles * 3 + 1, index + 1); + this.indexBuffer.setX(triangles * 3 + 2, index + 2); + triangles++; + this.indexBuffer.setX(triangles * 3, index + 2); + this.indexBuffer.setX(triangles * 3 + 1, index + 1); + this.indexBuffer.setX(triangles * 3 + 2, index + 3); + triangles++; + } + previous = current; + current = next; + if (!curIter.done) { + curIter = iter.next(); + if (curIter.value !== undefined) { + next = curIter.value; + } + } + } + } + }); + this.positionBuffer.updateRange.count = index * 3; + this.positionBuffer.needsUpdate = true; + this.previousBuffer.updateRange.count = index * 3; + this.previousBuffer.needsUpdate = true; + this.nextBuffer.updateRange.count = index * 3; + this.nextBuffer.needsUpdate = true; + this.sideBuffer.updateRange.count = index; + this.sideBuffer.needsUpdate = true; + this.widthBuffer.updateRange.count = index; + this.widthBuffer.needsUpdate = true; + this.uvBuffer.updateRange.count = index * 2; + this.uvBuffer.needsUpdate = true; + this.colorBuffer.updateRange.count = index * 4; + this.colorBuffer.needsUpdate = true; + this.indexBuffer.updateRange.count = triangles * 3; + this.indexBuffer.needsUpdate = true; + this.geometry.setDrawRange(0, triangles * 3); + } + dispose() { + this.geometry.dispose(); + } +} + +class BatchedRenderer extends THREE.Object3D { + constructor() { + super(); + this.batches = []; + this.systemToBatchIndex = new Map(); + this.type = 'BatchedRenderer'; + } + static equals(a, b) { + return (a.material.side === b.material.side && + a.material.blending === b.material.blending && + a.material.transparent === b.material.transparent && + a.material.type === b.material.type && + a.material.alphaTest === b.material.alphaTest && + a.material.map === b.material.map && + a.renderMode === b.renderMode && + a.uTileCount === b.uTileCount && + a.vTileCount === b.vTileCount && + a.instancingGeometry === b.instancingGeometry && + a.renderOrder === b.renderOrder && + a.layers.mask === b.layers.mask); + } + addSystem(system) { + system._renderer = this; + const settings = system.getRendererSettings(); + for (let i = 0; i < this.batches.length; i++) { + if (BatchedRenderer.equals(this.batches[i].settings, settings)) { + this.batches[i].addSystem(system); + this.systemToBatchIndex.set(system, i); + return; + } + } + let batch; + switch (settings.renderMode) { + case RenderMode.Trail: + batch = new TrailBatch(settings); + break; + case RenderMode.Mesh: + case RenderMode.BillBoard: + case RenderMode.VerticalBillBoard: + case RenderMode.HorizontalBillBoard: + case RenderMode.StretchedBillBoard: + batch = new SpriteBatch(settings); + break; + } + batch.addSystem(system); + this.batches.push(batch); + this.systemToBatchIndex.set(system, this.batches.length - 1); + this.add(batch); + } + deleteSystem(system) { + const batchIndex = this.systemToBatchIndex.get(system); + if (batchIndex != undefined) { + this.batches[batchIndex].removeSystem(system); + this.systemToBatchIndex.delete(system); + } + } + updateSystem(system) { + this.deleteSystem(system); + this.addSystem(system); + } + update(delta) { + this.systemToBatchIndex.forEach((value, ps) => { + ps.update(delta); + }); + for (let i = 0; i < this.batches.length; i++) { + this.batches[i].update(); + } + } +} + +const BatchedParticleRenderer = BatchedRenderer; + +class QuarksLoader extends THREE.ObjectLoader { + constructor(manager) { + super(manager); + } + linkReference(object) { + const objectsMap = {}; + object.traverse(function (child) { + objectsMap[child.uuid] = child; + }); + object.traverse(function (child) { + if (child.type === 'ParticleEmitter') { + const system = child.system; + system.emitterShape; + for (let i = 0; i < system.behaviors.length; i++) { + if (system.behaviors[i] instanceof EmitSubParticleSystem) { + system.behaviors[i].subParticleSystem = objectsMap[system.behaviors[i].subParticleSystem]; + } + } + } + }); + } + parse(json, onLoad) { + const object = super.parse(json, onLoad); + this.linkReference(object); + return object; + } + parseObject(data, geometries, materials, textures, animations) { + let object; + function getGeometry(name) { + if (geometries[name] === undefined) { + console.warn('THREE.ObjectLoader: Undefined geometry', name); + } + return geometries[name]; + } + function getMaterial(name) { + if (name === undefined) + return undefined; + if (Array.isArray(name)) { + const array = []; + for (let i = 0, l = name.length; i < l; i++) { + const uuid = name[i]; + if (materials[uuid] === undefined) { + console.warn('THREE.ObjectLoader: Undefined material', uuid); + } + array.push(materials[uuid]); + } + return array; + } + if (materials[name] === undefined) { + console.warn('THREE.ObjectLoader: Undefined material', name); + } + return materials[name]; + } + function getTexture(uuid) { + if (textures[uuid] === undefined) { + console.warn('THREE.ObjectLoader: Undefined texture', uuid); + } + return textures[uuid]; + } + let geometry, material; + const meta = { + textures: textures, + geometries: geometries, + materials: materials, + }; + const dependencies = {}; + switch (data.type) { + case 'ParticleEmitter': + object = ParticleSystem.fromJSON(data.ps, meta, dependencies).emitter; + break; + case 'Scene': + object = new THREE.Scene(); + if (data.background !== undefined) { + if (Number.isInteger(data.background)) { + object.background = new THREE.Color(data.background); + } + else { + object.background = getTexture(data.background); + } + } + if (data.environment !== undefined) { + object.environment = getTexture(data.environment); + } + if (data.fog !== undefined) { + if (data.fog.type === 'Fog') { + object.fog = new THREE.Fog(data.fog.color, data.fog.near, data.fog.far); + } + else if (data.fog.type === 'FogExp2') { + object.fog = new THREE.FogExp2(data.fog.color, data.fog.density); + } + } + if (data.backgroundBlurriness !== undefined) + object.backgroundBlurriness = data.backgroundBlurriness; + break; + case 'PerspectiveCamera': + object = new THREE.PerspectiveCamera(data.fov, data.aspect, data.near, data.far); + if (data.focus !== undefined) + object.focus = data.focus; + if (data.zoom !== undefined) + object.zoom = data.zoom; + if (data.filmGauge !== undefined) + object.filmGauge = data.filmGauge; + if (data.filmOffset !== undefined) + object.filmOffset = data.filmOffset; + if (data.view !== undefined) + object.view = Object.assign({}, data.view); + break; + case 'OrthographicCamera': + object = new THREE.OrthographicCamera(data.left, data.right, data.top, data.bottom, data.near, data.far); + if (data.zoom !== undefined) + object.zoom = data.zoom; + if (data.view !== undefined) + object.view = Object.assign({}, data.view); + break; + case 'AmbientLight': + object = new THREE.AmbientLight(data.color, data.intensity); + break; + case 'DirectionalLight': + object = new THREE.DirectionalLight(data.color, data.intensity); + break; + case 'PointLight': + object = new THREE.PointLight(data.color, data.intensity, data.distance, data.decay); + break; + case 'RectAreaLight': + object = new THREE.RectAreaLight(data.color, data.intensity, data.width, data.height); + break; + case 'SpotLight': + object = new THREE.SpotLight(data.color, data.intensity, data.distance, data.angle, data.penumbra, data.decay); + break; + case 'HemisphereLight': + object = new THREE.HemisphereLight(data.color, data.groundColor, data.intensity); + break; + case 'LightProbe': + object = new THREE.LightProbe().fromJSON(data); + break; + case 'SkinnedMesh': + geometry = getGeometry(data.geometry); + material = getMaterial(data.material); + object = new THREE.SkinnedMesh(geometry, material); + if (data.bindMode !== undefined) + object.bindMode = data.bindMode; + if (data.bindMatrix !== undefined) + object.bindMatrix.fromArray(data.bindMatrix); + if (data.skeleton !== undefined) + object.skeleton = data.skeleton; + break; + case 'Mesh': + geometry = getGeometry(data.geometry); + material = getMaterial(data.material); + object = new THREE.Mesh(geometry, material); + break; + case 'InstancedMesh': { + geometry = getGeometry(data.geometry); + material = getMaterial(data.material); + const count = data.count; + const instanceMatrix = data.instanceMatrix; + const instanceColor = data.instanceColor; + object = new THREE.InstancedMesh(geometry, material, count); + object.instanceMatrix = new THREE.InstancedBufferAttribute(new Float32Array(instanceMatrix.array), 16); + if (instanceColor !== undefined) + object.instanceColor = new THREE.InstancedBufferAttribute(new Float32Array(instanceColor.array), instanceColor.itemSize); + break; + } + case 'LOD': + object = new THREE.LOD(); + break; + case 'Line': + object = new THREE.Line(getGeometry(data.geometry), getMaterial(data.material)); + break; + case 'LineLoop': + object = new THREE.LineLoop(getGeometry(data.geometry), getMaterial(data.material)); + break; + case 'LineSegments': + object = new THREE.LineSegments(getGeometry(data.geometry), getMaterial(data.material)); + break; + case 'PointCloud': + case 'Points': + object = new THREE.Points(getGeometry(data.geometry), getMaterial(data.material)); + break; + case 'Sprite': + object = new THREE.Sprite(getMaterial(data.material)); + break; + case 'Group': + object = new THREE.Group(); + break; + case 'Bone': + object = new THREE.Bone(); + break; + default: + object = new THREE.Object3D(); + } + object.uuid = data.uuid; + if (data.name !== undefined) + object.name = data.name; + if (data.matrix !== undefined) { + object.matrix.fromArray(data.matrix); + if (data.matrixAutoUpdate !== undefined) + object.matrixAutoUpdate = data.matrixAutoUpdate; + if (object.matrixAutoUpdate) + object.matrix.decompose(object.position, object.quaternion, object.scale); + } + else { + if (data.position !== undefined) + object.position.fromArray(data.position); + if (data.rotation !== undefined) + object.rotation.fromArray(data.rotation); + if (data.quaternion !== undefined) + object.quaternion.fromArray(data.quaternion); + if (data.scale !== undefined) + object.scale.fromArray(data.scale); + } + if (data.castShadow !== undefined) + object.castShadow = data.castShadow; + if (data.receiveShadow !== undefined) + object.receiveShadow = data.receiveShadow; + if (data.shadow) { + if (data.shadow.bias !== undefined) + object.shadow.bias = data.shadow.bias; + if (data.shadow.normalBias !== undefined) + object.normalBias = data.shadow.normalBias; + if (data.shadow.radius !== undefined) + object.radius = data.shadow.radius; + if (data.shadow.mapSize !== undefined) + object.mapSize.fromArray(data.shadow.mapSize); + if (data.shadow.camera !== undefined) { + object.camera = this.parseObject(data.shadow.camera); + } + } + if (data.visible !== undefined) + object.visible = data.visible; + if (data.frustumCulled !== undefined) + object.frustumCulled = data.frustumCulled; + if (data.renderOrder !== undefined) + object.renderOrder = data.renderOrder; + if (data.userData !== undefined) + object.userData = data.userData; + if (data.layers !== undefined) + object.layers.mask = data.layers; + if (data.children !== undefined) { + const children = data.children; + for (let i = 0; i < children.length; i++) { + object.add(this.parseObject(children[i], geometries, materials, textures, animations)); + } + } + if (data.animations !== undefined) { + const objectAnimations = data.animations; + for (let i = 0; i < objectAnimations.length; i++) { + const uuid = objectAnimations[i]; + object.animations.push(animations[uuid]); + } + } + if (data.type === 'LOD') { + if (data.autoUpdate !== undefined) + object.autoUpdate = data.autoUpdate; + const levels = data.levels; + for (let l = 0; l < levels.length; l++) { + const level = levels[l]; + const child = object.getObjectByProperty('uuid', level.object); + if (child !== undefined) { + object.addLevel(child, level.distance); + } + } + } + return object; + } +} + +const Plugins = []; +function loadPlugin(plugin) { + const existing = Plugins.find((item) => item.id === plugin.id); + if (!existing) { + plugin.initialize(); + for (const emitterShape of plugin.emitterShapes) { + if (!EmitterShapes[emitterShape.type]) { + EmitterShapes[emitterShape.type] = emitterShape; + } + } + for (const behavior of plugin.behaviors) { + if (!BehaviorTypes[behavior.type]) { + BehaviorTypes[behavior.type] = behavior; + } + } + } +} +function unloadPlugin(pluginId) { + const plugin = Plugins.find((item) => item.id === pluginId); + if (plugin) { + for (const emitterShape of plugin.emitterShapes) { + if (EmitterShapes[emitterShape.type]) { + delete EmitterShapes[emitterShape.type]; + } + } + for (const behavior of plugin.behaviors) { + if (BehaviorTypes[behavior.type]) { + delete BehaviorTypes[behavior.type]; + } + } + } +} + +let NodeValueType = void 0; +(function (NodeValueType) { + NodeValueType[NodeValueType["Number"] = 0] = "Number"; + NodeValueType[NodeValueType["Vec2"] = 1] = "Vec2"; + NodeValueType[NodeValueType["Vec3"] = 2] = "Vec3"; + NodeValueType[NodeValueType["Vec4"] = 3] = "Vec4"; + NodeValueType[NodeValueType["Boolean"] = 4] = "Boolean"; + NodeValueType[NodeValueType["AnyType"] = 5] = "AnyType"; + NodeValueType[NodeValueType["NullableAnyType"] = 6] = "NullableAnyType"; + NodeValueType[NodeValueType["EventStream"] = 7] = "EventStream"; +})(NodeValueType || (NodeValueType = {})); +const genDefaultForNodeValueType = (type) => { + switch (type) { + case NodeValueType.Boolean: + return false; + case NodeValueType.Number: + return 0; + case NodeValueType.Vec2: + return new THREE.Vector2(); + case NodeValueType.Vec3: + return new THREE.Vector3(); + case NodeValueType.Vec4: + return new THREE.Vector4(); + case NodeValueType.AnyType: + return 0; + case NodeValueType.NullableAnyType: + return undefined; + } +}; + +class Node { + constructor(type, signatureIndex = -1, data = {}) { + this.inputs = []; + this.outputs = []; + this.signatureIndex = -1; + this.position = new THREE.Vector2(); + this.outputValues = []; + this.id = '' + Math.round(Math.random() * 100000); + this.type = type; + this.signatureIndex = signatureIndex; + this.data = data; + const realIndex = signatureIndex === -1 ? 0 : signatureIndex; + for (let i = 0; i < type.nodeTypeSignatures[realIndex].inputTypes.length; i++) { + this.inputs.push(undefined); + } + for (let i = 0; i < type.nodeTypeSignatures[realIndex].outputTypes.length; i++) { + this.outputs.push([]); + this.outputValues.push(genDefaultForNodeValueType(type.nodeTypeSignatures[realIndex].outputTypes[i])); + } + } + get inputTypes() { + const signatureIndex = this.signatureIndex === -1 ? 0 : this.signatureIndex; + return this.type.nodeTypeSignatures[signatureIndex].inputTypes; + } + get outputTypes() { + const signatureIndex = this.signatureIndex === -1 ? 0 : this.signatureIndex; + return this.type.nodeTypeSignatures[signatureIndex].outputTypes; + } + func(context, inputs, outputs) { + const signatureIndex = this.signatureIndex === -1 ? 0 : this.signatureIndex; + this.type.nodeTypeSignatures[signatureIndex].func(context, this.data, inputs, outputs); + } +} +class Wire { + constructor(input, inputIndex, output, outputIndex) { + this.input = input; + this.inputIndex = inputIndex; + this.input.outputs[inputIndex].push(this); + this.output = output; + this.outputIndex = outputIndex; + this.output.inputs[outputIndex] = this; + } +} + +class BaseCompiler { + constructor() { + this.visited = new Set(); + BaseCompiler.Instance = this; + } + buildExecutionOrder(graph, context) { + graph.nodesInOrder.length = 0; + this.visited.clear(); + for (let i = 0; i < graph.outputNodes.length; i++) { + const node = graph.outputNodes[i]; + if (node.inputs[0] !== undefined) { + this._traverse(node, graph, context); + } + } + graph.compiled = true; + } + _traverse(node, graph, context) { + this.visited.add(node.id); + for (let i = 0; i < node.inputs.length; i++) { + if (node.inputs[i] instanceof Wire) { + const inputNode = node.inputs[i].input; + if (!this.visited.has(inputNode.id)) { + this._traverse(inputNode, graph, context); + } + } + else if (node.inputs[i] !== undefined); + else; + } + graph.nodesInOrder.push(node); + } +} + +class Interpreter extends BaseCompiler { + constructor() { + super(); + } + executeCompiledGraph(graph, context) { + const nodes = graph.nodesInOrder; + for (let i = 0; i < nodes.length; i++) { + const inputValues = []; + const node = nodes[i]; + for (let j = 0; j < node.inputs.length; j++) { + if (node.inputs[j] instanceof Wire) { + inputValues.push(node.inputs[j].input.outputValues[node.inputs[j].inputIndex]); + } + else if (node.inputs[j] !== undefined) { + inputValues.push(node.inputs[j].getValue(context)); + } + else { + inputValues.push(undefined); + } + } + node.func(context, inputValues, node.outputValues); + } + } + run(graph, context) { + if (!graph.compiled) { + this.buildExecutionOrder(graph, context); + } + this.executeCompiledGraph(graph, context); + } +} + +class NodeType { + constructor(name) { + this.nodeTypeSignatures = []; + this.name = name; + } + addSignature(inputTypes, outputTypes, func) { + this.nodeTypeSignatures.push({ + inputTypes: inputTypes, + outputTypes: outputTypes, + func: func, + }); + } +} +class GraphNodeType extends NodeType { + constructor(nodeGraph) { + const inputTypes = []; + for (let i = 0; i < nodeGraph.inputNodes.length; i++) { + if (nodeGraph.inputNodes[i].type.name === 'input') { + inputTypes.push(nodeGraph.inputNodes[i].data.type); + } + } + const outputTypes = []; + for (let i = 0; i < nodeGraph.outputNodes.length; i++) { + if (nodeGraph.outputNodes[i].type.name === 'output') { + outputTypes.push(nodeGraph.outputNodes[i].data.type); + } + } + super(nodeGraph.name); + this.addSignature(inputTypes, outputTypes, (context, data, inputs, outputs) => { + context.inputs = inputs; + context.outputs = outputs; + Interpreter.Instance.run(nodeGraph, context); + }); + this.nodeGraph = nodeGraph; + } +} + +const NodeTypes = {}; +const addNode = new NodeType('add'); +addNode.addSignature([NodeValueType.Number, NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0] + inputs[1]; +}); +addNode.addSignature([NodeValueType.Vec2, NodeValueType.Vec2], [NodeValueType.Vec2], (context, data, inputs, outputs) => { + outputs[0].addVectors(inputs[0], inputs[1]); +}); +addNode.addSignature([NodeValueType.Vec3, NodeValueType.Vec3], [NodeValueType.Vec3], (context, data, inputs, outputs) => { + outputs[0].addVectors(inputs[0], inputs[1]); +}); +addNode.addSignature([NodeValueType.Vec4, NodeValueType.Vec4], [NodeValueType.Vec4], (context, data, inputs, outputs) => { + outputs[0].addVectors(inputs[0], inputs[1]); +}); +NodeTypes['add'] = addNode; +const subNode = new NodeType('sub'); +subNode.addSignature([NodeValueType.Number, NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0] - inputs[1]; +}); +subNode.addSignature([NodeValueType.Vec2, NodeValueType.Vec2], [NodeValueType.Vec2], (context, data, inputs, outputs) => { + outputs[0].subVectors(inputs[0], inputs[1]); +}); +subNode.addSignature([NodeValueType.Vec3, NodeValueType.Vec3], [NodeValueType.Vec3], (context, data, inputs, outputs) => { + outputs[0].subVectors(inputs[0], inputs[1]); +}); +subNode.addSignature([NodeValueType.Vec4, NodeValueType.Vec4], [NodeValueType.Vec4], (context, data, inputs, outputs) => { + outputs[0].subVectors(inputs[0], inputs[1]); +}); +NodeTypes['sub'] = subNode; +const mulNode = new NodeType('mul'); +mulNode.addSignature([NodeValueType.Number, NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0] * inputs[1]; +}); +mulNode.addSignature([NodeValueType.Vec2, NodeValueType.Number], [NodeValueType.Vec2], (context, data, inputs, outputs) => { + outputs[0].copy(inputs[0]).multiplyScalar(inputs[1]); +}); +mulNode.addSignature([NodeValueType.Vec3, NodeValueType.Number], [NodeValueType.Vec3], (context, data, inputs, outputs) => { + outputs[0].copy(inputs[0]).multiplyScalar(inputs[1]); +}); +mulNode.addSignature([NodeValueType.Vec4, NodeValueType.Number], [NodeValueType.Vec4], (context, data, inputs, outputs) => { + outputs[0].copy(inputs[0]).multiplyScalar(inputs[1]); +}); +NodeTypes['mul'] = mulNode; +const divNode = new NodeType('div'); +divNode.addSignature([NodeValueType.Number, NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0] / inputs[1]; +}); +divNode.addSignature([NodeValueType.Vec2, NodeValueType.Number], [NodeValueType.Vec2], (context, data, inputs, outputs) => { + outputs[0].copy(inputs[0]).divideScalar(inputs[1]); +}); +divNode.addSignature([NodeValueType.Vec3, NodeValueType.Number], [NodeValueType.Vec3], (context, data, inputs, outputs) => { + outputs[0].copy(inputs[0]).divideScalar(inputs[1]); +}); +divNode.addSignature([NodeValueType.Vec4, NodeValueType.Number], [NodeValueType.Vec4], (context, data, inputs, outputs) => { + outputs[0].copy(inputs[0]).divideScalar(inputs[1]); +}); +NodeTypes['div'] = divNode; +const sinNode = new NodeType('sin'); +sinNode.addSignature([NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = Math.sin(inputs[0]); +}); +NodeTypes['sin'] = sinNode; +const cosNode = new NodeType('cos'); +cosNode.addSignature([NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = Math.cos(inputs[0]); +}); +NodeTypes['cos'] = cosNode; +const tanNode = new NodeType('tan'); +tanNode.addSignature([NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = Math.tan(inputs[0]); +}); +NodeTypes['tan'] = tanNode; +const absNode = new NodeType('abs'); +absNode.addSignature([NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = Math.abs(inputs[0]); +}); +NodeTypes['abs'] = absNode; +const minNode = new NodeType('min'); +minNode.addSignature([NodeValueType.Number, NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = Math.min(inputs[0], inputs[1]); +}); +NodeTypes['min'] = minNode; +const maxNode = new NodeType('max'); +maxNode.addSignature([NodeValueType.Number, NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = Math.max(inputs[0], inputs[1]); +}); +NodeTypes['max'] = maxNode; +const dot = new NodeType('dot'); +dot.addSignature([NodeValueType.Vec2, NodeValueType.Vec2], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].dot(inputs[1]); +}); +dot.addSignature([NodeValueType.Vec3, NodeValueType.Vec3], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].dot(inputs[1]); +}); +dot.addSignature([NodeValueType.Vec4, NodeValueType.Vec4], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].dot(inputs[1]); +}); +NodeTypes['dot'] = dot; +const cross = new NodeType('cross'); +cross.addSignature([NodeValueType.Vec3, NodeValueType.Vec3], [NodeValueType.Vec3], (context, data, inputs, outputs) => { + outputs[0].crossVectors(inputs[0], inputs[1]); +}); +NodeTypes['cross'] = cross; +const length = new NodeType('length'); +length.addSignature([NodeValueType.Vec2], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].length(); +}); +length.addSignature([NodeValueType.Vec3], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].length(); +}); +length.addSignature([NodeValueType.Vec4], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].length(); +}); +NodeTypes['length'] = length; +const lengthSq = new NodeType('lengthSq'); +lengthSq.addSignature([NodeValueType.Vec2], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].lengthSq(); +}); +lengthSq.addSignature([NodeValueType.Vec3], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].lengthSq(); +}); +lengthSq.addSignature([NodeValueType.Vec4], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].lengthSq(); +}); +NodeTypes['lengthSq'] = lengthSq; +const normalize = new NodeType('normalize'); +normalize.addSignature([NodeValueType.Vec2], [NodeValueType.Vec2], (context, data, inputs, outputs) => { + outputs[0].copy(inputs[0]).normalize(); +}); +normalize.addSignature([NodeValueType.Vec3], [NodeValueType.Vec3], (context, data, inputs, outputs) => { + outputs[0].copy(inputs[0]).normalize(); +}); +normalize.addSignature([NodeValueType.Vec4], [NodeValueType.Vec4], (context, data, inputs, outputs) => { + outputs[0].copy(inputs[0]).normalize(); +}); +NodeTypes['normalize'] = normalize; +const distance = new NodeType('distance'); +distance.addSignature([NodeValueType.Vec2, NodeValueType.Vec2], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].distanceTo(inputs[1]); +}); +distance.addSignature([NodeValueType.Vec3, NodeValueType.Vec3], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].distanceTo(inputs[1]); +}); +NodeTypes['distance'] = distance; +const andNode = new NodeType('and'); +andNode.addSignature([NodeValueType.Boolean, NodeValueType.Boolean], [NodeValueType.Boolean], (context, data, inputs, outputs) => { + outputs[0] = inputs[0] && inputs[1]; +}); +NodeTypes['and'] = andNode; +const orNode = new NodeType('or'); +orNode.addSignature([NodeValueType.Boolean, NodeValueType.Boolean], [NodeValueType.Boolean], (context, data, inputs, outputs) => { + outputs[0] = inputs[0] || inputs[1]; +}); +NodeTypes['or'] = orNode; +const notNode = new NodeType('not'); +notNode.addSignature([NodeValueType.Boolean], [NodeValueType.Boolean], (context, data, inputs, outputs) => { + outputs[0] = !inputs[0]; +}); +NodeTypes['not'] = notNode; +const equalNode = new NodeType('equal'); +equalNode.addSignature([NodeValueType.Number, NodeValueType.Number], [NodeValueType.Boolean], (context, data, inputs, outputs) => { + outputs[0] = inputs[0] === inputs[1]; +}); +equalNode.addSignature([NodeValueType.Vec2, NodeValueType.Vec2], [NodeValueType.Boolean], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].equals(inputs[1]); +}); +equalNode.addSignature([NodeValueType.Vec3, NodeValueType.Vec3], [NodeValueType.Boolean], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].equals(inputs[1]); +}); +equalNode.addSignature([NodeValueType.Vec4, NodeValueType.Vec4], [NodeValueType.Boolean], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].equals(inputs[1]); +}); +NodeTypes['equal'] = equalNode; +const lessThanNode = new NodeType('lessThan'); +lessThanNode.addSignature([NodeValueType.Number, NodeValueType.Number], [NodeValueType.Boolean], (context, data, inputs, outputs) => { + outputs[0] = inputs[0] < inputs[1]; +}); +NodeTypes['lessThan'] = lessThanNode; +const greaterThanNode = new NodeType('greaterThan'); +greaterThanNode.addSignature([NodeValueType.Number, NodeValueType.Number], [NodeValueType.Boolean], (context, data, inputs, outputs) => { + outputs[0] = inputs[0] > inputs[1]; +}); +NodeTypes['greaterThan'] = greaterThanNode; +const lessThanOrEqualNode = new NodeType('lessThanOrEqual'); +lessThanOrEqualNode.addSignature([NodeValueType.Number, NodeValueType.Number], [NodeValueType.Boolean], (context, data, inputs, outputs) => { + outputs[0] = inputs[0] <= inputs[1]; +}); +NodeTypes['lessThanOrEqual'] = lessThanOrEqualNode; +const greaterThanOrEqualNode = new NodeType('greaterThanOrEqual'); +greaterThanOrEqualNode.addSignature([NodeValueType.Number, NodeValueType.Number], [NodeValueType.Boolean], (context, data, inputs, outputs) => { + outputs[0] = inputs[0] >= inputs[1]; +}); +NodeTypes['greaterThanOrEqual'] = greaterThanOrEqualNode; +const ifNode = new NodeType('if'); +ifNode.addSignature([NodeValueType.Boolean, NodeValueType.AnyType, NodeValueType.AnyType], [NodeValueType.AnyType], (context, data, inputs, outputs) => { + outputs[0] = inputs[0] ? inputs[1] : inputs[2]; +}); +NodeTypes['if'] = ifNode; +const numberNode = new NodeType('number'); +numberNode.addSignature([], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = data.value; +}); +NodeTypes['number'] = numberNode; +const vec2Node = new NodeType('vec2'); +vec2Node.addSignature([NodeValueType.Number, NodeValueType.Number], [NodeValueType.Vec2], (context, data, inputs, outputs) => { + outputs[0].x = inputs[0]; + outputs[0].y = inputs[1]; +}); +NodeTypes['vec2'] = vec2Node; +const vec3Node = new NodeType('vec3'); +vec3Node.addSignature([NodeValueType.Number, NodeValueType.Number, NodeValueType.Number], [NodeValueType.Vec3], (context, data, inputs, outputs) => { + outputs[0].x = inputs[0]; + outputs[0].y = inputs[1]; + outputs[0].z = inputs[2]; +}); +NodeTypes['vec3'] = vec3Node; +const vec4Node = new NodeType('vec4'); +vec4Node.addSignature([NodeValueType.Number, NodeValueType.Number, NodeValueType.Number, NodeValueType.Number], [NodeValueType.Vec4], (context, data, inputs, outputs) => { + outputs[0].x = inputs[0]; + outputs[0].y = inputs[1]; + outputs[0].z = inputs[2]; + outputs[0].w = inputs[3]; +}); +NodeTypes['vec4'] = vec4Node; +const splitVec2Node = new NodeType('splitVec2'); +splitVec2Node.addSignature([NodeValueType.Vec2], [NodeValueType.Number, NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].x; + outputs[1] = inputs[0].y; +}); +NodeTypes['splitVec2'] = splitVec2Node; +const splitVec3Node = new NodeType('splitVec3'); +splitVec3Node.addSignature([NodeValueType.Vec3], [NodeValueType.Number, NodeValueType.Number, NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].x; + outputs[1] = inputs[0].y; + outputs[2] = inputs[0].z; +}); +NodeTypes['splitVec3'] = splitVec3Node; +const splitVec4Node = new NodeType('splitVec4'); +splitVec4Node.addSignature([NodeValueType.Vec4], [NodeValueType.Number, NodeValueType.Number, NodeValueType.Number, NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0].x; + outputs[1] = inputs[0].y; + outputs[2] = inputs[0].z; + outputs[3] = inputs[0].w; +}); +NodeTypes['splitVec4'] = splitVec4Node; +const boolNode = new NodeType('bool'); +boolNode.addSignature([], [NodeValueType.Boolean], (context, data, inputs, outputs) => { + outputs[0] = data.value; +}); +NodeTypes['bool'] = boolNode; +const particlePropertyNode = new NodeType('particleProperty'); +particlePropertyNode.addSignature([NodeValueType.NullableAnyType], [NodeValueType.NullableAnyType], (context, data, inputs, outputs) => { + if (inputs[0] !== undefined) { + if (typeof inputs[0] === 'object') { + context.particle[data.property].copy(inputs[0]); + } + else { + context.particle[data.property] = inputs[0]; + } + } + if (context.particle[data.property] !== undefined) { + if (typeof outputs[0] === 'object') { + outputs[0].copy(context.particle[data.property]); + } + else { + outputs[0] = context.particle[data.property]; + } + } +}); +NodeTypes['particleProperty'] = particlePropertyNode; +const emitNode = new NodeType('emit'); +emitNode.addSignature([NodeValueType.EventStream], [], (context, data, inputs, outputs) => { + const arr = inputs[0]; + for (let i = 0; i < arr.length; i++) { + context.signal(i, arr[i]); + } +}); +NodeTypes['emit'] = emitNode; +const graphPropertyNode = new NodeType('graphProperty'); +graphPropertyNode.addSignature([NodeValueType.NullableAnyType], [NodeValueType.NullableAnyType], (context, data, inputs, outputs) => { + if (inputs[0] !== undefined) { + if (typeof inputs[0] === 'object') { + context.graph[data.property].copy(inputs[0]); + } + else { + context.graph[data.property] = inputs[0]; + } + } + if (context.graph[data.property] !== undefined) { + if (typeof outputs[0] === 'object') { + outputs[0].copy(context.graph[data.property]); + } + else { + outputs[0] = context.graph[data.property]; + } + } +}); +NodeTypes['graphProperty'] = graphPropertyNode; +const startEventNode = new NodeType('startEvent'); +startEventNode.addSignature([], [NodeValueType.EventStream], (context, data, inputs, outputs) => { + outputs[0] = [{ type: 'start' }]; +}); +NodeTypes['startEvent'] = startEventNode; +const repeaterNode = new NodeType('repeater'); +repeaterNode.addSignature([NodeValueType.EventStream, NodeValueType.Number], [NodeValueType.EventStream], (context, data, inputs, outputs) => { + const arr = inputs[0]; + const count = inputs[1]; + const result = []; + for (let j = 0; j < arr.length; j++) { + for (let i = 0; i < count; i++) { + result.push(arr[j]); + } + } + outputs[0] = result; +}); +NodeTypes['repeater'] = repeaterNode; +const timeNode = new NodeType('time'); +timeNode.addSignature([], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = context.emissionState.time; +}); +NodeTypes['time'] = timeNode; +const deltaNode = new NodeType('delta'); +deltaNode.addSignature([], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = context.delta; +}); +NodeTypes['delta'] = deltaNode; +const outputNode = new NodeType('output'); +outputNode.addSignature([NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = inputs[0]; +}); +outputNode.addSignature([NodeValueType.Vec2], [NodeValueType.Vec2], (context, data, inputs, outputs) => { + outputs[0] = inputs[0]; +}); +outputNode.addSignature([NodeValueType.Vec3], [NodeValueType.Vec3], (context, data, inputs, outputs) => { + outputs[0] = inputs[0]; +}); +outputNode.addSignature([NodeValueType.Vec4], [NodeValueType.Vec4], (context, data, inputs, outputs) => { + outputs[0] = inputs[0]; +}); +outputNode.addSignature([NodeValueType.Boolean], [NodeValueType.Boolean], (context, data, inputs, outputs) => { + outputs[0] = inputs[0]; +}); +NodeTypes['output'] = outputNode; +const lerpNode = new NodeType('lerp'); +lerpNode.addSignature([NodeValueType.Number, NodeValueType.Number, NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = + inputs[0] * (1 - inputs[2]) + inputs[1] * inputs[2]; +}); +lerpNode.addSignature([NodeValueType.Vec2, NodeValueType.Vec2, NodeValueType.Number], [NodeValueType.Vec2], (context, data, inputs, outputs) => { + outputs[0].lerpVectors(inputs[0], inputs[1], inputs[2]); +}); +lerpNode.addSignature([NodeValueType.Vec3, NodeValueType.Vec3, NodeValueType.Number], [NodeValueType.Vec3], (context, data, inputs, outputs) => { + outputs[0].lerpVectors(inputs[0], inputs[1], inputs[2]); +}); +lerpNode.addSignature([NodeValueType.Vec4, NodeValueType.Vec4, NodeValueType.Number], [NodeValueType.Vec4], (context, data, inputs, outputs) => { + outputs[0].lerpVectors(inputs[0], inputs[1], inputs[2]); +}); +NodeTypes['lerp'] = lerpNode; +const normalD = (x) => { + return (1 / Math.sqrt(2 * Math.PI)) * Math.exp(x * x * -0.5); +}; +const normalDistributionNode = new NodeType('normDistrib'); +normalDistributionNode.addSignature([NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = normalD(inputs[0]); +}); +NodeTypes['normDistrib'] = normalDistributionNode; +const normcdfNode = new NodeType('normcdf'); +normcdfNode.addSignature([NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + let x = inputs[0]; + const a1 = 0.254829592; + const a2 = -0.284496736; + const a3 = 1.421413741; + const a4 = -1.453152027; + const a5 = 1.061405429; + const p = 0.3275911; + let sign = 1; + if (x < 0) + sign = -1; + x = Math.abs(x) / Math.sqrt(2.0); + const t = 1.0 / (1.0 + p * x); + const y = 1.0 - ((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t * Math.exp(-x * x); + outputs[0] = 0.5 * (1.0 + sign * y); +}); +NodeTypes['normcdf'] = normcdfNode; +const normcdfInvNode = new NodeType('normcdfInv'); +const rationalApproximation = (t) => { + const c = [2.515517, 0.802853, 0.010328]; + const d = [1.432788, 0.189269, 0.001308]; + return t - ((c[2] * t + c[1]) * t + c[0]) / (((d[2] * t + d[1]) * t + d[0]) * t + 1.0); +}; +const normcdfInv = (p) => { + if (p < 0.5) { + return -rationalApproximation(Math.sqrt(-2.0 * Math.log(p))); + } + else { + return rationalApproximation(Math.sqrt(-2.0 * Math.log(1 - p))); + } +}; +normcdfInvNode.addSignature([NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = normcdfInv(inputs[0]); +}); +NodeTypes['normcdfInv'] = normcdfInvNode; +const clampNode = new NodeType('clamp'); +clampNode.addSignature([NodeValueType.Number, NodeValueType.Number, NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = Math.max(Math.min(inputs[0], inputs[2]), inputs[1]); +}); +NodeTypes['clamp'] = clampNode; +const smoothstepNode = new NodeType('smoothstep'); +smoothstepNode.addSignature([NodeValueType.Number, NodeValueType.Number, NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + const x = Math.max(Math.min(inputs[0], inputs[2]), inputs[1]); + outputs[0] = x * x * (3 - 2 * x); +}); +NodeTypes['smoothstep'] = smoothstepNode; +const randomNode = new NodeType('random'); +randomNode.addSignature([NodeValueType.Number, NodeValueType.Number], [NodeValueType.Number], (context, data, inputs, outputs) => { + outputs[0] = Math.random() * (inputs[1] - inputs[0]) + inputs[0]; +}); +randomNode.addSignature([NodeValueType.Vec2, NodeValueType.Vec2], [NodeValueType.Vec2], (context, data, inputs, outputs) => { + let random = Math.random(); + outputs[0].lerpVectors(inputs[0], inputs[1], random); +}); +randomNode.addSignature([NodeValueType.Vec3, NodeValueType.Vec3], [NodeValueType.Vec3], (context, data, inputs, outputs) => { + let random = Math.random(); + outputs[0].lerpVectors(inputs[0], inputs[1], random); +}); +randomNode.addSignature([NodeValueType.Vec4, NodeValueType.Vec4], [NodeValueType.Vec4], (context, data, inputs, outputs) => { + let random = Math.random(); + outputs[0].lerpVectors(inputs[0], inputs[1], random); +}); +NodeTypes['random'] = randomNode; +const vrandNode = new NodeType('vrand'); +vrandNode.addSignature([], [NodeValueType.Vec2], (context, data, inputs, outputs) => { + let x = normcdfInv(Math.random()); + let y = normcdfInv(Math.random()); + const mag = Math.sqrt(x * x + y * y); + outputs[0].set(x / mag, y / mag); +}); +vrandNode.addSignature([], [NodeValueType.Vec3], (context, data, inputs, outputs) => { + let x = normcdfInv(Math.random()); + let y = normcdfInv(Math.random()); + let z = normcdfInv(Math.random()); + const mag = Math.sqrt(x * x + y * y + z * z); + outputs[0].set(x / mag, y / mag, z / mag); +}); +vrandNode.addSignature([], [NodeValueType.Vec4], (context, data, inputs, outputs) => { + let x = normcdfInv(Math.random()); + let y = normcdfInv(Math.random()); + let z = normcdfInv(Math.random()); + let w = normcdfInv(Math.random()); + const mag = Math.sqrt(x * x + y * y + z * z + w * w); + outputs[0].set(x / mag, y / mag, z / mag, w / mag); +}); +NodeTypes['vrand'] = vrandNode; +const bsdfNode = new NodeType('bsdf'); +bsdfNode.addSignature([NodeValueType.Vec3, NodeValueType.Vec3, NodeValueType.Vec3, NodeValueType.Number], [], (context, data, inputs, outputs) => { }); +NodeTypes['bsdf'] = bsdfNode; +const OutputNodeTypeNames = new Set(['output', 'particleProperty', 'graphProperty', 'emit']); + +class NodeGraph { + constructor(name) { + this.inputNodes = []; + this.outputNodes = []; + this.allNodes = new Map(); + this.wires = []; + this.compiled = false; + this.nodesInOrder = []; + this.version = '1.0'; + this.uuid = THREE.MathUtils.generateUUID(); + this.name = name; + this.revision = 0; + } + addWire(wire) { + this.wires.push(wire); + this.revision++; + } + addNode(node) { + this.allNodes.set(node.id, node); + if (node.type === NodeTypes['input']) { + this.inputNodes.push(node); + } + else if (OutputNodeTypeNames.has(node.type.name)) { + this.outputNodes.push(node); + } + this.revision++; + } + getNode(id) { + return this.allNodes.get(id); + } + deleteNode(node) { + this.allNodes.delete(node.id); + this.revision++; + } + deleteWire(wire) { + let index = wire.input.outputs[wire.inputIndex].indexOf(wire); + if (index !== -1) { + wire.input.outputs[wire.inputIndex].splice(index, 1); + } + wire.output.inputs[wire.outputIndex] = undefined; + index = this.wires.indexOf(wire); + if (index != -1) { + this.wires[index] = this.wires[this.wires.length - 1]; + this.wires.pop(); + } + this.revision++; + } + toJSON() { + throw new Error('not implemented'); + } + clone() { + throw new Error('not implemented'); + } +} + +new THREE.Vector3(0, 0, 1); +const tempQ = new THREE.Quaternion(); +const tempV = new THREE.Vector3(); +const tempV2 = new THREE.Vector3(); +const PREWARM_FPS = 60; +const DEFAULT_GEOMETRY = new THREE.PlaneGeometry(1, 1, 1, 1); +class NodeVFX { + set time(time) { + this.emissionState.time = time; + } + get time() { + return this.emissionState.time; + } + get layers() { + return this.rendererSettings.layers; + } + get texture() { + return this.rendererSettings.material.map; + } + set texture(texture) { + this.rendererSettings.material.map = texture; + this.neededToUpdateRender = true; + } + get material() { + return this.rendererSettings.material; + } + set material(material) { + this.rendererSettings.material = material; + this.neededToUpdateRender = true; + } + get instancingGeometry() { + return this.rendererSettings.instancingGeometry; + } + set instancingGeometry(geometry) { + this.restart(); + this.particles.length = 0; + this.rendererSettings.instancingGeometry = geometry; + this.neededToUpdateRender = true; + } + get renderMode() { + return this.rendererSettings.renderMode; + } + set renderMode(renderMode) { + if ((this.rendererSettings.renderMode != RenderMode.Trail && renderMode === RenderMode.Trail) || + (this.rendererSettings.renderMode == RenderMode.Trail && renderMode !== RenderMode.Trail)) { + this.restart(); + this.particles.length = 0; + } + if (this.rendererSettings.renderMode !== renderMode) { + switch (renderMode) { + case RenderMode.Trail: + this.rendererEmitterSettings = { + startLength: 30, + followLocalOrigin: false, + }; + break; + case RenderMode.Mesh: + this.rendererEmitterSettings = { + geometry: new THREE.PlaneGeometry(1, 1), + }; + break; + case RenderMode.BillBoard: + case RenderMode.VerticalBillBoard: + case RenderMode.HorizontalBillBoard: + case RenderMode.StretchedBillBoard: + this.rendererEmitterSettings = {}; + break; + } + } + this.rendererSettings.renderMode = renderMode; + this.neededToUpdateRender = true; + } + get renderOrder() { + return this.rendererSettings.renderOrder; + } + set renderOrder(renderOrder) { + this.rendererSettings.renderOrder = renderOrder; + this.neededToUpdateRender = true; + } + get blending() { + return this.rendererSettings.material.blending; + } + set blending(blending) { + this.rendererSettings.material.blending = blending; + this.neededToUpdateRender = true; + } + constructor(parameters) { + var _a, _b, _c, _d, _e, _f, _g; + this.temp = new THREE.Vector3(); + this.travelDistance = 0; + this.normalMatrix = new THREE.Matrix3(); + this.speedFactor = 0; + this.autoDestroy = parameters.autoDestroy === undefined ? false : parameters.autoDestroy; + this.duration = (_a = parameters.duration) !== null && _a !== void 0 ? _a : 1; + this.looping = parameters.looping === undefined ? true : parameters.looping; + this.prewarm = parameters.prewarm === undefined ? false : parameters.prewarm; + this.worldSpace = (_b = parameters.worldSpace) !== null && _b !== void 0 ? _b : false; + this.rendererEmitterSettings = (_c = parameters.rendererEmitterSettings) !== null && _c !== void 0 ? _c : {}; + this.emissionGraph = parameters.emissionGraph; + this.updateGraph = parameters.updateGraph; + this.interpreter = new Interpreter(); + this.rendererSettings = { + instancingGeometry: (_d = parameters.instancingGeometry) !== null && _d !== void 0 ? _d : DEFAULT_GEOMETRY, + renderMode: (_e = parameters.renderMode) !== null && _e !== void 0 ? _e : RenderMode.BillBoard, + renderOrder: (_f = parameters.renderOrder) !== null && _f !== void 0 ? _f : 0, + material: parameters.material, + layers: (_g = parameters.layers) !== null && _g !== void 0 ? _g : new THREE.Layers(), + uTileCount: 1, + vTileCount: 1, + }; + this.neededToUpdateRender = true; + this.particles = new Array(); + this.emitter = new ParticleEmitter(this); + this.paused = false; + this.particleNum = 0; + this.emissionState = { + time: 0, + }; + this.emitEnded = false; + this.markForDestroy = false; + this.prewarmed = false; + } + pause() { + this.paused = true; + } + play() { + this.paused = false; + } + spawn(emissionState, matrix) { + tempQ.setFromRotationMatrix(matrix); + const translation = tempV; + const quaternion = tempQ; + const scale = tempV2; + matrix.decompose(translation, quaternion, scale); + this.particleNum++; + while (this.particles.length < this.particleNum) { + this.particles.push(new NodeParticle()); + } + const particle = this.particles[this.particleNum - 1]; + particle.reset(); + this.interpreter.run(this.updateGraph, { particle: particle, emissionState: this.emissionState }); + if (this.rendererSettings.renderMode === RenderMode.Trail && + this.rendererEmitterSettings.followLocalOrigin) { + const trail = particle; + trail.localPosition = new THREE.Vector3().copy(trail.position); + } + if (this.worldSpace) { + particle.position.applyMatrix4(matrix); + particle.size *= (Math.abs(scale.x) + Math.abs(scale.y) + Math.abs(scale.z)) / 3; + particle.velocity.multiply(scale).applyMatrix3(this.normalMatrix); + if (particle.rotation && particle.rotation instanceof THREE.Quaternion) { + particle.rotation.multiplyQuaternions(tempQ, particle.rotation); + } + } + } + endEmit() { + this.emitEnded = true; + if (this.autoDestroy) { + this.markForDestroy = true; + } + } + dispose() { + if (this._renderer) + this._renderer.deleteSystem(this); + this.emitter.dispose(); + if (this.emitter.parent) + this.emitter.parent.remove(this.emitter); + } + restart() { + this.paused = false; + this.particleNum = 0; + this.emissionState.time = 0; + this.emitEnded = false; + this.markForDestroy = false; + this.prewarmed = false; + } + update(delta) { + if (this.paused) + return; + let currentParent = this.emitter; + while (currentParent.parent) { + currentParent = currentParent.parent; + } + if (currentParent.type !== 'Scene') { + this.dispose(); + return; + } + if (this.emitEnded && this.particleNum === 0) { + if (this.markForDestroy && this.emitter.parent) + this.dispose(); + return; + } + if (this.looping && this.prewarm && !this.prewarmed) { + this.prewarmed = true; + for (let i = 0; i < this.duration * PREWARM_FPS; i++) { + this.update(1.0 / PREWARM_FPS); + } + } + if (delta > 0.1) { + delta = 0.1; + } + if (this.neededToUpdateRender) { + if (this._renderer) + this._renderer.updateSystem(this); + this.neededToUpdateRender = false; + } + this.emit(delta, this.emissionState, this.emitter.matrixWorld); + const context = { particle: undefined, emissionState: this.emissionState, delta }; + for (let i = 0; i < this.particleNum; i++) { + context.particle = this.particles[i]; + this.interpreter.run(this.updateGraph, context); + } + for (let i = 0; i < this.particleNum; i++) { + if (this.rendererEmitterSettings.followLocalOrigin && + this.particles[i].localPosition) { + this.particles[i].position.copy(this.particles[i].localPosition); + if (this.particles[i].parentMatrix) { + this.particles[i].position.applyMatrix4(this.particles[i].parentMatrix); + } + else { + this.particles[i].position.applyMatrix4(this.emitter.matrixWorld); + } + } + else { + this.particles[i].position.addScaledVector(this.particles[i].velocity, delta); + } + this.particles[i].age += delta; + } + if (this.rendererSettings.renderMode === RenderMode.Trail) { + for (let i = 0; i < this.particleNum; i++) { + const particle = this.particles[i]; + particle.update(); + } + } + for (let i = 0; i < this.particleNum; i++) { + const particle = this.particles[i]; + if (particle.died && (!(particle instanceof TrailParticle) || particle.previous.length === 0)) { + this.particles[i] = this.particles[this.particleNum - 1]; + this.particles[this.particleNum - 1] = particle; + this.particleNum--; + i--; + } + } + } + emit(delta, emissionState, emitterMatrix) { + if (emissionState.time > this.duration) { + if (this.looping) { + emissionState.time -= this.duration; + } + else { + if (!this.emitEnded) { + this.endEmit(); + } + } + } + this.normalMatrix.getNormalMatrix(emitterMatrix); + const context = { + signal: () => { + this.spawn(emissionState, emitterMatrix); + }, + emissionState, + delta, + }; + if (!this.emitEnded) { + this.interpreter.run(this.emissionGraph, context); + } + if (this.previousWorldPos === undefined) + this.previousWorldPos = new THREE.Vector3(); + this.emitter.getWorldPosition(this.previousWorldPos); + emissionState.time += delta; + } + toJSON(meta, options = {}) { + return {}; + } + getRendererSettings() { + return this.rendererSettings; + } + clone() { + return this; + } +} + +gdjs.__particleEmmiter3DExtension = { + ParticleEmitter3DRenderer, + ParticleEmitterAdapter, + + ApplyCollision, + ApplyForce, + ApplySequences, + AxisAngleGenerator, + BatchedParticleRenderer, + BatchedRenderer, + BehaviorFromJSON, + BehaviorTypes, + Bezier, + ChangeEmitDirection, + ColorGeneratorFromJSON, + ColorOverLife, + ColorRange, + ConeEmitter, + ConstantColor, + ConstantValue, + DonutEmitter, + EmitSubParticleSystem, + EmitterFromJSON, + EmitterMode, + EmitterShapes, + EulerGenerator, + ForceOverLife, + FrameOverLife, + GeneratorFromJSON, + Gradient, + GraphNodeType, + GravityForce, + GridEmitter, + Interpreter, + IntervalValue, + MeshSurfaceEmitter, + Node, + NodeGraph, + NodeType, + NodeTypes, + NodeValueType, + Noise, + OrbitOverLife, + ParticleEmitter, + ParticleSystem, + PiecewiseBezier, + PiecewiseFunction, + Plugins, + PointEmitter, + QuarksLoader, + RandomColor, + RandomColorBetweenGradient, + RandomQuatGenerator, + RecordState, + RenderMode, + Rotation3DOverLife, + RotationGeneratorFromJSON, + RotationOverLife, + SequencerFromJSON, + SizeOverLife, + SpeedOverLife, + SphereEmitter, + SpriteBatch, + SpriteParticle, + SubParticleEmitMode, + TextureSequencer, + TrailBatch, + TrailParticle, + TurbulenceField, + VFXBatch, + ValueGeneratorFromJSON, + WidthOverLength, + Wire, + genDefaultForNodeValueType, + getPhysicsResolver, + loadPlugin, + setPhysicsResolver, + unloadPlugin, +} +}; +gdjs.evtsExt__ParticleEmitter3D__DefineHelperClasses.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ParticleEmitter3D__DefineHelperClasses.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ParticleEmitter3D__DefineHelperClasses.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ParticleEmitter3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ParticleEmitter3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ParticleEmitter3D__DefineHelperClasses.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__ParticleEmitter3D__DefineHelperClasses.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__particleemitter3d__onscenepreevents-func.js b/gdjs-evtsext__particleemitter3d__onscenepreevents-func.js new file mode 100644 index 0000000000000000000000000000000000000000..6050182d745abec0e251c2c57b2f4ab4f3fe16b6 --- /dev/null +++ b/gdjs-evtsext__particleemitter3d__onscenepreevents-func.js @@ -0,0 +1,94 @@ + +if (typeof gdjs.evtsExt__ParticleEmitter3D__onScenePreEvents !== "undefined") { + gdjs.evtsExt__ParticleEmitter3D__onScenePreEvents.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ParticleEmitter3D__onScenePreEvents = {}; + + +gdjs.evtsExt__ParticleEmitter3D__onScenePreEvents.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; + +// See doStepPostEvents +runtimeScene.__particleEmmiter3DExtension = runtimeScene.__particleEmmiter3DExtension || {}; +runtimeScene.__particleEmmiter3DExtension.emittersStepped = 0; +}; +gdjs.evtsExt__ParticleEmitter3D__onScenePreEvents.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ParticleEmitter3D__onScenePreEvents.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ParticleEmitter3D__onScenePreEvents.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ParticleEmitter3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ParticleEmitter3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ParticleEmitter3D__onScenePreEvents.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__ParticleEmitter3D__onScenePreEvents.registeredGdjsCallbacks = []; +gdjs.evtsExt__ParticleEmitter3D__onScenePreEvents.registeredGdjsCallbacks.push((runtimeScene) => { + gdjs.evtsExt__ParticleEmitter3D__onScenePreEvents.func(runtimeScene, runtimeScene); +}) +gdjs.registerRuntimeScenePreEventsCallback(gdjs.evtsExt__ParticleEmitter3D__onScenePreEvents.registeredGdjsCallbacks[gdjs.evtsExt__ParticleEmitter3D__onScenePreEvents.registeredGdjsCallbacks.length - 1]); diff --git a/gdjs-evtsext__particleemitter3d__particleemitter3d.js b/gdjs-evtsext__particleemitter3d__particleemitter3d.js new file mode 100644 index 0000000000000000000000000000000000000000..4624779b3e7976e08b6728823df7fab66cc78373 --- /dev/null +++ b/gdjs-evtsext__particleemitter3d__particleemitter3d.js @@ -0,0 +1,6482 @@ + +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D = gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D || {}; + +/** + * Object generated from 3D particle emitter + */ +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D = class ParticleEmitter3D extends gdjs.CustomRuntimeObject3D { + constructor(parentInstanceContainer, objectData) { + super(parentInstanceContainer, objectData); + this._parentInstanceContainer = parentInstanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._objectData = {}; + + this._objectData.StartColor = objectData.content.StartColor !== undefined ? objectData.content.StartColor : "255;0;0"; + this._objectData.EndColor = objectData.content.EndColor !== undefined ? objectData.content.EndColor : "255;255;0"; + this._objectData.StartOpacity = objectData.content.StartOpacity !== undefined ? objectData.content.StartOpacity : Number("255") || 0; + this._objectData.EndOpacity = objectData.content.EndOpacity !== undefined ? objectData.content.EndOpacity : Number("0") || 0; + this._objectData.Flow = objectData.content.Flow !== undefined ? objectData.content.Flow : Number("50") || 0; + this._objectData.StartSizeMin = objectData.content.StartSizeMin !== undefined ? objectData.content.StartSizeMin : Number("10") || 0; + this._objectData.StartSizeMax = objectData.content.StartSizeMax !== undefined ? objectData.content.StartSizeMax : Number("20") || 0; + this._objectData.EndScale = objectData.content.EndScale !== undefined ? objectData.content.EndScale : Number("0") || 0; + this._objectData.StartSpeedMin = objectData.content.StartSpeedMin !== undefined ? objectData.content.StartSpeedMin : Number("100") || 0; + this._objectData.StartSpeedMax = objectData.content.StartSpeedMax !== undefined ? objectData.content.StartSpeedMax : Number("100") || 0; + this._objectData.LifespanMin = objectData.content.LifespanMin !== undefined ? objectData.content.LifespanMin : Number("1") || 0; + this._objectData.LifespanMax = objectData.content.LifespanMax !== undefined ? objectData.content.LifespanMax : Number("2") || 0; + this._objectData.Duration = objectData.content.Duration !== undefined ? objectData.content.Duration : Number("5") || 0; + this._objectData.AreParticlesRelative = objectData.content.AreParticlesRelative !== undefined ? objectData.content.AreParticlesRelative : false; + this._objectData.SpayConeAngle = objectData.content.SpayConeAngle !== undefined ? objectData.content.SpayConeAngle : Number("30") || 0; + this._objectData.Blending = objectData.content.Blending !== undefined ? objectData.content.Blending : "Additive"; + this._objectData.GravityTop = objectData.content.GravityTop !== undefined ? objectData.content.GravityTop : "Y-"; + this._objectData.Gravity = objectData.content.Gravity !== undefined ? objectData.content.Gravity : Number("0") || 0; + this._objectData.ShouldAutodestruct = objectData.content.ShouldAutodestruct !== undefined ? objectData.content.ShouldAutodestruct : true; + this._objectData.ParentOrigin = "Center-center"; + this._objectData.Z = Number("0") || 0; + this._objectData.RotationX = Number("0") || 0; + this._objectData.RotationY = Number("0") || 0; + + + // It calls the onCreated super implementation at the end. + this.onCreated(); + } + + // Hot-reload: + updateFromObjectData(oldObjectData, newObjectData) { + super.updateFromObjectData(oldObjectData, newObjectData); + if (oldObjectData.content.StartColor !== newObjectData.content.StartColor) + this._objectData.StartColor = newObjectData.content.StartColor; + if (oldObjectData.content.EndColor !== newObjectData.content.EndColor) + this._objectData.EndColor = newObjectData.content.EndColor; + if (oldObjectData.content.StartOpacity !== newObjectData.content.StartOpacity) + this._objectData.StartOpacity = newObjectData.content.StartOpacity; + if (oldObjectData.content.EndOpacity !== newObjectData.content.EndOpacity) + this._objectData.EndOpacity = newObjectData.content.EndOpacity; + if (oldObjectData.content.Flow !== newObjectData.content.Flow) + this._objectData.Flow = newObjectData.content.Flow; + if (oldObjectData.content.StartSizeMin !== newObjectData.content.StartSizeMin) + this._objectData.StartSizeMin = newObjectData.content.StartSizeMin; + if (oldObjectData.content.StartSizeMax !== newObjectData.content.StartSizeMax) + this._objectData.StartSizeMax = newObjectData.content.StartSizeMax; + if (oldObjectData.content.EndScale !== newObjectData.content.EndScale) + this._objectData.EndScale = newObjectData.content.EndScale; + if (oldObjectData.content.StartSpeedMin !== newObjectData.content.StartSpeedMin) + this._objectData.StartSpeedMin = newObjectData.content.StartSpeedMin; + if (oldObjectData.content.StartSpeedMax !== newObjectData.content.StartSpeedMax) + this._objectData.StartSpeedMax = newObjectData.content.StartSpeedMax; + if (oldObjectData.content.LifespanMin !== newObjectData.content.LifespanMin) + this._objectData.LifespanMin = newObjectData.content.LifespanMin; + if (oldObjectData.content.LifespanMax !== newObjectData.content.LifespanMax) + this._objectData.LifespanMax = newObjectData.content.LifespanMax; + if (oldObjectData.content.Duration !== newObjectData.content.Duration) + this._objectData.Duration = newObjectData.content.Duration; + if (oldObjectData.content.AreParticlesRelative !== newObjectData.content.AreParticlesRelative) + this._objectData.AreParticlesRelative = newObjectData.content.AreParticlesRelative; + if (oldObjectData.content.SpayConeAngle !== newObjectData.content.SpayConeAngle) + this._objectData.SpayConeAngle = newObjectData.content.SpayConeAngle; + if (oldObjectData.content.Blending !== newObjectData.content.Blending) + this._objectData.Blending = newObjectData.content.Blending; + if (oldObjectData.content.GravityTop !== newObjectData.content.GravityTop) + this._objectData.GravityTop = newObjectData.content.GravityTop; + if (oldObjectData.content.Gravity !== newObjectData.content.Gravity) + this._objectData.Gravity = newObjectData.content.Gravity; + if (oldObjectData.content.ShouldAutodestruct !== newObjectData.content.ShouldAutodestruct) + this._objectData.ShouldAutodestruct = newObjectData.content.ShouldAutodestruct; + if (oldObjectData.content.ParentOrigin !== newObjectData.content.ParentOrigin) + this._objectData.ParentOrigin = newObjectData.content.ParentOrigin; + if (oldObjectData.content.Z !== newObjectData.content.Z) + this._objectData.Z = newObjectData.content.Z; + if (oldObjectData.content.RotationX !== newObjectData.content.RotationX) + this._objectData.RotationX = newObjectData.content.RotationX; + if (oldObjectData.content.RotationY !== newObjectData.content.RotationY) + this._objectData.RotationY = newObjectData.content.RotationY; + + this.onHotReloading(this._parentInstanceContainer); + return true; + } + + // Properties: + + _getStartColor() { + return this._objectData.StartColor !== undefined ? this._objectData.StartColor : "255;0;0"; + } + _setStartColor(newValue) { + this._objectData.StartColor = newValue; + } + _getEndColor() { + return this._objectData.EndColor !== undefined ? this._objectData.EndColor : "255;255;0"; + } + _setEndColor(newValue) { + this._objectData.EndColor = newValue; + } + _getStartOpacity() { + return this._objectData.StartOpacity !== undefined ? this._objectData.StartOpacity : Number("255") || 0; + } + _setStartOpacity(newValue) { + this._objectData.StartOpacity = newValue; + } + _getEndOpacity() { + return this._objectData.EndOpacity !== undefined ? this._objectData.EndOpacity : Number("0") || 0; + } + _setEndOpacity(newValue) { + this._objectData.EndOpacity = newValue; + } + _getFlow() { + return this._objectData.Flow !== undefined ? this._objectData.Flow : Number("50") || 0; + } + _setFlow(newValue) { + this._objectData.Flow = newValue; + } + _getStartSizeMin() { + return this._objectData.StartSizeMin !== undefined ? this._objectData.StartSizeMin : Number("10") || 0; + } + _setStartSizeMin(newValue) { + this._objectData.StartSizeMin = newValue; + } + _getStartSizeMax() { + return this._objectData.StartSizeMax !== undefined ? this._objectData.StartSizeMax : Number("20") || 0; + } + _setStartSizeMax(newValue) { + this._objectData.StartSizeMax = newValue; + } + _getEndScale() { + return this._objectData.EndScale !== undefined ? this._objectData.EndScale : Number("0") || 0; + } + _setEndScale(newValue) { + this._objectData.EndScale = newValue; + } + _getStartSpeedMin() { + return this._objectData.StartSpeedMin !== undefined ? this._objectData.StartSpeedMin : Number("100") || 0; + } + _setStartSpeedMin(newValue) { + this._objectData.StartSpeedMin = newValue; + } + _getStartSpeedMax() { + return this._objectData.StartSpeedMax !== undefined ? this._objectData.StartSpeedMax : Number("100") || 0; + } + _setStartSpeedMax(newValue) { + this._objectData.StartSpeedMax = newValue; + } + _getLifespanMin() { + return this._objectData.LifespanMin !== undefined ? this._objectData.LifespanMin : Number("1") || 0; + } + _setLifespanMin(newValue) { + this._objectData.LifespanMin = newValue; + } + _getLifespanMax() { + return this._objectData.LifespanMax !== undefined ? this._objectData.LifespanMax : Number("2") || 0; + } + _setLifespanMax(newValue) { + this._objectData.LifespanMax = newValue; + } + _getDuration() { + return this._objectData.Duration !== undefined ? this._objectData.Duration : Number("5") || 0; + } + _setDuration(newValue) { + this._objectData.Duration = newValue; + } + _getAreParticlesRelative() { + return this._objectData.AreParticlesRelative !== undefined ? this._objectData.AreParticlesRelative : false; + } + _setAreParticlesRelative(newValue) { + this._objectData.AreParticlesRelative = newValue; + } + _toggleAreParticlesRelative() { + this._setAreParticlesRelative(!this._getAreParticlesRelative()); + } + _getSpayConeAngle() { + return this._objectData.SpayConeAngle !== undefined ? this._objectData.SpayConeAngle : Number("30") || 0; + } + _setSpayConeAngle(newValue) { + this._objectData.SpayConeAngle = newValue; + } + _getBlending() { + return this._objectData.Blending !== undefined ? this._objectData.Blending : "Additive"; + } + _setBlending(newValue) { + this._objectData.Blending = newValue; + } + _getGravityTop() { + return this._objectData.GravityTop !== undefined ? this._objectData.GravityTop : "Y-"; + } + _setGravityTop(newValue) { + this._objectData.GravityTop = newValue; + } + _getGravity() { + return this._objectData.Gravity !== undefined ? this._objectData.Gravity : Number("0") || 0; + } + _setGravity(newValue) { + this._objectData.Gravity = newValue; + } + _getShouldAutodestruct() { + return this._objectData.ShouldAutodestruct !== undefined ? this._objectData.ShouldAutodestruct : true; + } + _setShouldAutodestruct(newValue) { + this._objectData.ShouldAutodestruct = newValue; + } + _toggleShouldAutodestruct() { + this._setShouldAutodestruct(!this._getShouldAutodestruct()); + } + _getParentOrigin() { + return this._objectData.ParentOrigin !== undefined ? this._objectData.ParentOrigin : "Center-center"; + } + _setParentOrigin(newValue) { + this._objectData.ParentOrigin = newValue; + } + _getZ() { + return this._objectData.Z !== undefined ? this._objectData.Z : Number("0") || 0; + } + _setZ(newValue) { + this._objectData.Z = newValue; + } + _getRotationX() { + return this._objectData.RotationX !== undefined ? this._objectData.RotationX : Number("0") || 0; + } + _setRotationX(newValue) { + this._objectData.RotationX = newValue; + } + _getRotationY() { + return this._objectData.RotationY !== undefined ? this._objectData.RotationY : Number("0") || 0; + } + _setRotationY(newValue) { + this._objectData.RotationY = newValue; + } + + + + +} + +// Methods: +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext = {}; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDObjectObjects1= []; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDObjectObjects2= []; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDParticleObjects1= []; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDParticleObjects2= []; + + +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.userFunc0xddea40 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +const BatchedRenderer = gdjs.__particleEmmiter3DExtension.BatchedRenderer; +const ParticleSystem = gdjs.__particleEmmiter3DExtension.ParticleSystem; +const TextureLoader = gdjs.__particleEmmiter3DExtension.TextureLoader; +const IntervalValue = gdjs.__particleEmmiter3DExtension.IntervalValue; +const ConstantValue = gdjs.__particleEmmiter3DExtension.ConstantValue; +const ConstantColor = gdjs.__particleEmmiter3DExtension.ConstantColor; +const ColorOverLife = gdjs.__particleEmmiter3DExtension.ColorOverLife; +const SizeOverLife = gdjs.__particleEmmiter3DExtension.SizeOverLife; +const ApplyForce = gdjs.__particleEmmiter3DExtension.ApplyForce; +const Gradient = gdjs.__particleEmmiter3DExtension.Gradient; +const PiecewiseBezier = gdjs.__particleEmmiter3DExtension.PiecewiseBezier; +const Bezier = gdjs.__particleEmmiter3DExtension.Bezier; +const PointEmitter = gdjs.__particleEmmiter3DExtension.PointEmitter; +const ConeEmitter = gdjs.__particleEmmiter3DExtension.ConeEmitter; +const RenderMode = gdjs.__particleEmmiter3DExtension.RenderMode; + +const { ParticleEmitterAdapter, ParticleEmitter3DRenderer } = gdjs.__particleEmmiter3DExtension; + +/** @type {gdjs.CustomRuntimeObject} */ +const object = objects[0]; + +// Here runtimeScene is the gdjs.CustomRuntimeObjectInstanceContainer inside the custom object. +const gameScene = object.getRuntimeScene(); + +/** @type {SpriteObjectDataType} */ +const particleSpriteData = object._instanceContainer._objects.get("Particle"); +const resourceName = particleSpriteData.animations[0].directions[0].sprites[0].image; +const texture = object + .getInstanceContainer() + .getGame() + .getImageManager().getThreeTexture(resourceName); + +// Set the blending here because changes are not applied after the emitter creation. +const blendingString = object._getBlending(); +const blending = + blendingString === "Additive" ? THREE.AdditiveBlending : + blendingString === "Normal" ? THREE.NormalBlending : + blendingString === "Subtractive" ? THREE.SubtractiveBlending : + blendingString === "Multiply" ? THREE.MultiplyBlending : + blendingString === "None" ? THREE.NoBlending : + THREE.AdditiveBlending; + + +// Build a configuration with the right kind of objects. +// These values are not important as they are overrided by the object properties values. +const muzzle = { + duration: 10, + looping: false, + startLife: new IntervalValue(1, 2), + startSpeed: new IntervalValue(100, 200), + startSize: new IntervalValue(20, 50), + startColor: new ConstantColor(new THREE.Vector4(1, 1, 1, 1)), + worldSpace: true, + + maxParticle: 5, + emissionOverTime: new ConstantValue(50), + emissionBursts: [{ + time: 0, + count: new ConstantValue(1), + cycle: 1, + interval: 0.01, + probability: 1, + }], + + shape: new PointEmitter(), + material: new THREE.MeshBasicMaterial({ + map: texture, + blending: blending, + transparent: true, + side: THREE.DoubleSide + }), + startTileIndex: 0, + uTileCount: 1, + vTileCount: 1, + renderOrder: 2, + renderMode: RenderMode.BillBoard +}; +const particleSystem = new ParticleSystem(muzzle); + +const colorOverLife = new ColorOverLife( + new Gradient( + [ + [new THREE.Vector3(1, 0, 0), 0], + [new THREE.Vector3(1, 0, 0), 1], + ], + [ + [1, 0], + [1, 1], + ] + )); +particleSystem.addBehavior(colorOverLife); +const sizeOverLife = new SizeOverLife(new PiecewiseBezier([[new Bezier(1, 2 / 3, 1 / 3, 0), 0]])); +particleSystem.addBehavior(sizeOverLife); +const applyForce = new ApplyForce(new THREE.Vector3(0, 0, -1), new ConstantValue(0)); +particleSystem.addBehavior(applyForce); + +particleSystem.emitter.name = object.getName() + object.getNameId(); + +object.__particleEmitterAdapter = new ParticleEmitterAdapter(particleSystem, colorOverLife, sizeOverLife, applyForce); +object.__particleSystem = particleSystem; + +// This is a hack that may break in future releases. +// Replace the group that would hold children objects by the emmiter. +const layer = gameScene.getLayer(object.getLayer()); +const group = object.getRenderer()._threeGroup; +layer.getRenderer().remove3DRendererObject(group); +particleSystem.emitter.position.copy(group.position); +particleSystem.emitter.rotation.order = 'ZYX'; +particleSystem.emitter.rotation.copy(group.rotation); + +const particleEmitter3DRenderer = new ParticleEmitter3DRenderer(object, object._instanceContainer, object.getInstanceContainer()); +object._renderer = particleEmitter3DRenderer; +particleEmitter3DRenderer._threeGroup = particleSystem.emitter; +layer.getRenderer().add3DRendererObject(particleSystem.emitter); + +particleSystem.emitter.updateMatrixWorld(true); + + +// See doStepPostEvents +gameScene.__particleEmmiter3DExtension = gameScene.__particleEmmiter3DExtension || {}; +gameScene.__particleEmmiter3DExtension.emittersCount = gameScene.__particleEmmiter3DExtension.emittersCount || 0; +gameScene.__particleEmmiter3DExtension.emittersCount++; + + +}; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +{gdjs.evtsExt__ParticleEmitter3D__DefineHelperClasses.func(runtimeScene, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +}} + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDObjectObjects1); +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.userFunc0xddea40(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDObjectObjects1[i].UpdateFromProperties((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}{for(var i = 0, len = gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDObjectObjects1[i].setRotationCenter3D(0, 0, 0); +} +}} + +} + + +}; + +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreated = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._instanceContainer; +var thisObjectList = [this]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var thisGDParticleObjectsList = [...runtimeScene.getObjects("Particle")]; +var GDParticleObjects = Hashtable.newFrom({"Particle": thisGDParticleObjectsList}); +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +, "Particle": GDParticleObjects +}, + _objectArraysMap: { +"Object": thisObjectList +, "Particle": thisGDParticleObjectsList +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ParticleEmitter3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ParticleEmitter3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDParticleObjects1.length = 0; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDParticleObjects2.length = 0; + +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDParticleObjects1.length = 0; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onCreatedContext.GDParticleObjects2.length = 0; + +gdjs.CustomRuntimeObject.prototype.onCreated.call(this); + +return; +} +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onDestroyContext = {}; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onDestroyContext.GDObjectObjects1= []; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onDestroyContext.GDParticleObjects1= []; + + +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onDestroyContext.userFunc0xddea40 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +/** @type {gdjs.CustomRuntimeObject} */ +const object = objects[0]; +// Here runtimeScene is the gdjs.CustomRuntimeObjectInstanceContainer inside the custom object. +const gameScene = object.getRuntimeScene(); + +object.__particleSystem.dispose(); + +// See doStepPostEvents +gameScene.__particleEmmiter3DExtension.emittersCount--; + +if (gameScene.__particleEmmiter3DExtension.emittersCount === 0) { + // Update batch system now because doStepPostEvents won't be called. + gameScene.__particleEmmiter3DExtension.layerNames = gameScene.__particleEmmiter3DExtension.layerNames || []; + const layerNames = gameScene.__particleEmmiter3DExtension.layerNames; + gameScene.getAllLayerNames(layerNames); + for (const layerName of layerNames) { + const layer = gameScene.getLayer(layerName); + if (layer.__particleEmmiter3DExtension) { + layer.__particleEmmiter3DExtension.batchSystem.update(object.getElapsedTime() / 1000); + } + } +} +}; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onDestroyContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onDestroyContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onDestroyContext.GDObjectObjects1); +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onDestroyContext.userFunc0xddea40(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onDestroy = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._instanceContainer; +var thisObjectList = [this]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var thisGDParticleObjectsList = [...runtimeScene.getObjects("Particle")]; +var GDParticleObjects = Hashtable.newFrom({"Particle": thisGDParticleObjectsList}); +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +, "Particle": GDParticleObjects +}, + _objectArraysMap: { +"Object": thisObjectList +, "Particle": thisGDParticleObjectsList +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ParticleEmitter3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ParticleEmitter3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onDestroyContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onDestroyContext.GDParticleObjects1.length = 0; + +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onDestroyContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onDestroyContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onDestroyContext.GDParticleObjects1.length = 0; + + +return; +} +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext = {}; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDObjectObjects1= []; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDObjectObjects2= []; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDParticleObjects1= []; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDParticleObjects2= []; + + +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDObjectObjects1[i].UpdateFromProperties((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +}; + +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloading = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._instanceContainer; +var thisObjectList = [this]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var thisGDParticleObjectsList = [...runtimeScene.getObjects("Particle")]; +var GDParticleObjects = Hashtable.newFrom({"Particle": thisGDParticleObjectsList}); +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +, "Particle": GDParticleObjects +}, + _objectArraysMap: { +"Object": thisObjectList +, "Particle": thisGDParticleObjectsList +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ParticleEmitter3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ParticleEmitter3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDParticleObjects1.length = 0; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDParticleObjects2.length = 0; + +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDParticleObjects1.length = 0; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.onHotReloadingContext.GDParticleObjects2.length = 0; + + +return; +} +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.UpdateFromPropertiesContext = {}; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.UpdateFromPropertiesContext.GDObjectObjects1= []; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.UpdateFromPropertiesContext.GDObjectObjects2= []; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.UpdateFromPropertiesContext.GDObjectObjects3= []; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.UpdateFromPropertiesContext.GDParticleObjects1= []; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.UpdateFromPropertiesContext.GDParticleObjects2= []; +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.UpdateFromPropertiesContext.GDParticleObjects3= []; + + +gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.UpdateFromPropertiesContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.UpdateFromPropertiesContext.GDObjectObjects1, gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.UpdateFromPropertiesContext.GDObjectObjects2); + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__ParticleEmitter3D__ParticleEmitter3D.ParticleEmitter3D.prototype.UpdateFromPropertiesContext.GDObjectObjects2.length;i + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Player__CreateBonus = {}; +gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1= []; +gdjs.evtsExt__Player__CreateBonus.GDBonusObjects2= []; +gdjs.evtsExt__Player__CreateBonus.GDBonusObjects3= []; + + +gdjs.evtsExt__Player__CreateBonus.mapOfGDgdjs_9546evtsExt_9595_9595Player_9595_9595CreateBonus_9546GDBonusObjects1Objects = Hashtable.newFrom({"Bonus": gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1}); +gdjs.evtsExt__Player__CreateBonus.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = ((typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Type")) || 0 : 0) == 1); +} +if (isConditionTrue_0) { +gdjs.copyArray(gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1, gdjs.evtsExt__Player__CreateBonus.GDBonusObjects2); + +{for(var i = 0, len = gdjs.evtsExt__Player__CreateBonus.GDBonusObjects2.length ;i < len;++i) { + gdjs.evtsExt__Player__CreateBonus.GDBonusObjects2[i].setFaceResourceName("front", "BombeBonus.png"); +} +}} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = ((typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Type")) || 0 : 0) == 2); +} +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1 */ +{for(var i = 0, len = gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1[i].setFaceResourceName("front", "assets\\FlammeBonus.png"); +} +}} + +} + + +};gdjs.evtsExt__Player__CreateBonus.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1.length = 0; + +{gdjs.evtTools.object.createObjectOnScene((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : runtimeScene), gdjs.evtsExt__Player__CreateBonus.mapOfGDgdjs_9546evtsExt_9595_9595Player_9595_9595CreateBonus_9546GDBonusObjects1Objects, eventsFunctionContext.getArgument("PositionX") + 5, eventsFunctionContext.getArgument("PositionY") + 5, ""); +}{for(var i = 0, len = gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1[i].returnVariable(gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1[i].getVariables().get("Type")).setNumber(eventsFunctionContext.getArgument("Type")); +} +}{for(var i = 0, len = gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).setZ((gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1[i].getHeight()) / 2); +} +} +{ //Subevents +gdjs.evtsExt__Player__CreateBonus.eventsList0(runtimeScene, eventsFunctionContext);} //End of subevents +} + +} + + +}; + +gdjs.evtsExt__Player__CreateBonus.func = function(runtimeScene, Bonus, PositionX, PositionY, Type, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +"Bonus": Bonus +}, + _objectArraysMap: { +"Bonus": gdjs.objectsListsToArray(Bonus) +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Player"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Player"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "PositionX") return PositionX; +if (argName === "PositionY") return PositionY; +if (argName === "Type") return Type; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + +gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1.length = 0; +gdjs.evtsExt__Player__CreateBonus.GDBonusObjects2.length = 0; +gdjs.evtsExt__Player__CreateBonus.GDBonusObjects3.length = 0; + +gdjs.evtsExt__Player__CreateBonus.eventsList1(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Player__CreateBonus.GDBonusObjects1.length = 0; +gdjs.evtsExt__Player__CreateBonus.GDBonusObjects2.length = 0; +gdjs.evtsExt__Player__CreateBonus.GDBonusObjects3.length = 0; + + +return; +} + +gdjs.evtsExt__Player__CreateBonus.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__player__playeranimator.js b/gdjs-evtsext__player__playeranimator.js new file mode 100644 index 0000000000000000000000000000000000000000..57decb8f901bdcb7db245ab902752a6798fbbce7 --- /dev/null +++ b/gdjs-evtsext__player__playeranimator.js @@ -0,0 +1,1749 @@ + +gdjs.evtsExt__Player__PlayerAnimator = gdjs.evtsExt__Player__PlayerAnimator || {}; + +/** + * Behavior generated from + */ +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator = class PlayerAnimator extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.Tween = behaviorData.Tween !== undefined ? behaviorData.Tween : ""; + this._behaviorData.Tween3D = behaviorData.Tween3D !== undefined ? behaviorData.Tween3D : ""; + this._behaviorData.Flash = behaviorData.Flash !== undefined ? behaviorData.Flash : ""; + this._behaviorData.MovementAngle = Number("90") || 0; + this._behaviorData.State = "Alive"; + this._behaviorData.Angle = Number("90") || 0; + this._behaviorData.ExplosionDirectionX = Number("0") || 0; + this._behaviorData.ExplosionDirectionY = Number("0") || 0; + } + + // Hot-reload: + updateFromBehaviorData(oldBehaviorData, newBehaviorData) { + + if (oldBehaviorData.Tween !== newBehaviorData.Tween) + this._behaviorData.Tween = newBehaviorData.Tween; + if (oldBehaviorData.Tween3D !== newBehaviorData.Tween3D) + this._behaviorData.Tween3D = newBehaviorData.Tween3D; + if (oldBehaviorData.Flash !== newBehaviorData.Flash) + this._behaviorData.Flash = newBehaviorData.Flash; + if (oldBehaviorData.MovementAngle !== newBehaviorData.MovementAngle) + this._behaviorData.MovementAngle = newBehaviorData.MovementAngle; + if (oldBehaviorData.State !== newBehaviorData.State) + this._behaviorData.State = newBehaviorData.State; + if (oldBehaviorData.Angle !== newBehaviorData.Angle) + this._behaviorData.Angle = newBehaviorData.Angle; + if (oldBehaviorData.ExplosionDirectionX !== newBehaviorData.ExplosionDirectionX) + this._behaviorData.ExplosionDirectionX = newBehaviorData.ExplosionDirectionX; + if (oldBehaviorData.ExplosionDirectionY !== newBehaviorData.ExplosionDirectionY) + this._behaviorData.ExplosionDirectionY = newBehaviorData.ExplosionDirectionY; + + return true; + } + + // Network sync: + getNetworkSyncData() { + return { + ...super.getNetworkSyncData(), + props: { + + Tween: this._behaviorData.Tween, + Tween3D: this._behaviorData.Tween3D, + Flash: this._behaviorData.Flash, + MovementAngle: this._behaviorData.MovementAngle, + State: this._behaviorData.State, + Angle: this._behaviorData.Angle, + ExplosionDirectionX: this._behaviorData.ExplosionDirectionX, + ExplosionDirectionY: this._behaviorData.ExplosionDirectionY, + } + }; + } + updateFromNetworkSyncData(networkSyncData) { + super.updateFromNetworkSyncData(networkSyncData); + + if (networkSyncData.props.Tween !== undefined) + this._behaviorData.Tween = networkSyncData.props.Tween; + if (networkSyncData.props.Tween3D !== undefined) + this._behaviorData.Tween3D = networkSyncData.props.Tween3D; + if (networkSyncData.props.Flash !== undefined) + this._behaviorData.Flash = networkSyncData.props.Flash; + if (networkSyncData.props.MovementAngle !== undefined) + this._behaviorData.MovementAngle = networkSyncData.props.MovementAngle; + if (networkSyncData.props.State !== undefined) + this._behaviorData.State = networkSyncData.props.State; + if (networkSyncData.props.Angle !== undefined) + this._behaviorData.Angle = networkSyncData.props.Angle; + if (networkSyncData.props.ExplosionDirectionX !== undefined) + this._behaviorData.ExplosionDirectionX = networkSyncData.props.ExplosionDirectionX; + if (networkSyncData.props.ExplosionDirectionY !== undefined) + this._behaviorData.ExplosionDirectionY = networkSyncData.props.ExplosionDirectionY; + } + + // Properties: + + _getTween() { + return this._behaviorData.Tween !== undefined ? this._behaviorData.Tween : ""; + } + _setTween(newValue) { + this._behaviorData.Tween = newValue; + } + _getTween3D() { + return this._behaviorData.Tween3D !== undefined ? this._behaviorData.Tween3D : ""; + } + _setTween3D(newValue) { + this._behaviorData.Tween3D = newValue; + } + _getFlash() { + return this._behaviorData.Flash !== undefined ? this._behaviorData.Flash : ""; + } + _setFlash(newValue) { + this._behaviorData.Flash = newValue; + } + _getMovementAngle() { + return this._behaviorData.MovementAngle !== undefined ? this._behaviorData.MovementAngle : Number("90") || 0; + } + _setMovementAngle(newValue) { + this._behaviorData.MovementAngle = newValue; + } + _getState() { + return this._behaviorData.State !== undefined ? this._behaviorData.State : "Alive"; + } + _setState(newValue) { + this._behaviorData.State = newValue; + } + _getAngle() { + return this._behaviorData.Angle !== undefined ? this._behaviorData.Angle : Number("90") || 0; + } + _setAngle(newValue) { + this._behaviorData.Angle = newValue; + } + _getExplosionDirectionX() { + return this._behaviorData.ExplosionDirectionX !== undefined ? this._behaviorData.ExplosionDirectionX : Number("0") || 0; + } + _setExplosionDirectionX(newValue) { + this._behaviorData.ExplosionDirectionX = newValue; + } + _getExplosionDirectionY() { + return this._behaviorData.ExplosionDirectionY !== undefined ? this._behaviorData.ExplosionDirectionY : Number("0") || 0; + } + _setExplosionDirectionY(newValue) { + this._behaviorData.ExplosionDirectionY = newValue; + } +} + +/** + * Shared data generated from + */ +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.SharedData = class PlayerAnimatorSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._Player_PlayerAnimatorSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._Player_PlayerAnimatorSharedData = new gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.SharedData( + initialData + ); + } + return instanceContainer._Player_PlayerAnimatorSharedData; +} + +// Methods: +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreatedContext = {}; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreatedContext.GDObjectObjects1= []; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreatedContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreatedContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreatedContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreatedContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreatedContext.GDObjectObjects1[i].setAngle(90); +} +}{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreatedContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreatedContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setAngle(90); +} +}} + +} + + +}; + +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreated = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Tween": this._getTween() +, "Tween3D": this._getTween3D() +, "Flash": this._getFlash() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Player"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Player"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreatedContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreatedContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.onCreatedContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.doStepPostEventsContext = {}; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.doStepPostEventsContext.GDObjectObjects1= []; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.doStepPostEventsContext.GDObjectObjects2= []; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.doStepPostEventsContext.GDObjectObjects3= []; + + +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.doStepPostEventsContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.doStepPostEventsContext.GDObjectObjects1, gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.doStepPostEventsContext.GDObjectObjects2); + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.doStepPostEventsContext.GDObjectObjects2.length;i Math.abs((( gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDPlayerObjects2.length === 0 ) ? 0 :gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDPlayerObjects2[0].getCenterYInScene()) - (( gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects2.length === 0 ) ? 0 :gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects2[0].getCenterYInScene()))); +} +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects2 */ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDObjectObjects2); +{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDObjectObjects2[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).PlayDeathAnimation(gdjs.evtTools.common.sign((gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDObjectObjects2[i].getCenterXInScene()) - (( gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects2.length === 0 ) ? 0 :gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects2[0].getCenterXInScene())), 0, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +{ + +/* Reuse gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects1 */ +gdjs.copyArray(eventsFunctionContext.getObjects("Player"), gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDPlayerObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = (Math.abs((( gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDPlayerObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDPlayerObjects1[0].getCenterXInScene()) - (( gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects1[0].getCenterXInScene())) < Math.abs((( gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDPlayerObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDPlayerObjects1[0].getCenterYInScene()) - (( gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects1[0].getCenterYInScene()))); +} +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects1 */ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDObjectObjects1); +/* Reuse gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDPlayerObjects1 */ +{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).PlayDeathAnimation(0, gdjs.evtTools.common.sign((( gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDPlayerObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDPlayerObjects1[0].getCenterYInScene()) - (( gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects1[0].getCenterYInScene())), (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +};gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Explosion"), gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationFromExplosionContext.GDExplosionObjects1.length;i 0); +} +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1 */ +{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween3D")).TweenPositionZ("FlyAwayZ", 600, 0.75, "easeOutQuad", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +};gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).setRotationX(0); +} +}{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).setRotationY(0); +} +}} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = ((typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("ExplosionDirectionY")) || 0 : 0) == 0); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween")).addObjectPositionXTween2("FlyAway", (gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1[i].getX()) + eventsFunctionContext.getArgument("ExplosionDirectionX") * 1000, "easeInQuad", 0.75, false); +} +}{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween3D")).TweenPositionZ("FlyAwayZ", 400, 0.75, "easeOutQuad", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = ((typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("ExplosionDirectionX")) || 0 : 0) == 0); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween")).addObjectPositionYTween2("FlyAway", (gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1[i].getY()) + eventsFunctionContext.getArgument("ExplosionDirectionY") * 600, "easeInQuad", 0.75, false); +} +} +{ //Subevents +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.eventsList0(runtimeScene, eventsFunctionContext);} //End of subevents +} + +} + + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setExplosionDirectionX(eventsFunctionContext.getArgument("ExplosionDirectionX")); +} +}{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setExplosionDirectionY(eventsFunctionContext.getArgument("ExplosionDirectionY")); +} +}{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setState("DeathAnimation"); +} +}} + +} + + +}; + +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimation = function(ExplosionDirectionX, ExplosionDirectionY, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Tween": this._getTween() +, "Tween3D": this._getTween3D() +, "Flash": this._getFlash() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Player"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Player"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "ExplosionDirectionX") return ExplosionDirectionX; +if (argName === "ExplosionDirectionY") return ExplosionDirectionY; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects3.length = 0; + +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.eventsList1(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayDeathAnimationContext.GDObjectObjects3.length = 0; + + +return; +} +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.IsPlayingDeathAnimationContext = {}; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.IsPlayingDeathAnimationContext.GDObjectObjects1= []; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.IsPlayingDeathAnimationContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.IsPlayingDeathAnimationContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.IsPlayingDeathAnimationContext.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.IsPlayingDeathAnimationContext.GDObjectObjects1.length;i (gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.asyncCallback17698684(runtimeScene, eventsFunctionContext, asyncObjectsList))); +} +} + +} + + +};gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ + +{ //Subevents +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.eventsList0(runtimeScene, eventsFunctionContext);} //End of subevents +} + +} + + +};gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.eventsList2 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects1[i].setAngle(90); +} +}{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setAngle(90); +} +}{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).SetMovementAngle(90, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween3D")).SetStretchZ(8, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}{for(var i = 0, len = gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween3D")).TweenStretchZ("Unstrentch", 1, 1, "elastic", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +} +{ //Subevents +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.eventsList1(runtimeScene, eventsFunctionContext);} //End of subevents +} + +} + + +}; + +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimation = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Tween": this._getTween() +, "Tween3D": this._getTween3D() +, "Flash": this._getFlash() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Player"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Player"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.eventsList2(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.PlayRespawnAnimationContext.GDObjectObjects2.length = 0; + + +return; +} + +gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator.prototype.doStepPreEvents = function() { + this._onceTriggers.startNewFrame(); +}; + + +gdjs.registerBehavior("Player::PlayerAnimator", gdjs.evtsExt__Player__PlayerAnimator.PlayerAnimator); diff --git a/gdjs-evtsext__player__playerbehavior.js b/gdjs-evtsext__player__playerbehavior.js new file mode 100644 index 0000000000000000000000000000000000000000..e1644d8f0e3e6c05472a8c9800cb46ae22168871 --- /dev/null +++ b/gdjs-evtsext__player__playerbehavior.js @@ -0,0 +1,1947 @@ + +gdjs.evtsExt__Player__PlayerBehavior = gdjs.evtsExt__Player__PlayerBehavior || {}; + +/** + * Behavior generated from Player behavior + */ +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior = class PlayerBehavior extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.Id = behaviorData.Id !== undefined ? behaviorData.Id : Number("1") || 0; + this._behaviorData.InitialBombCapacity = behaviorData.InitialBombCapacity !== undefined ? behaviorData.InitialBombCapacity : Number("2") || 0; + this._behaviorData.InitialBombRange = behaviorData.InitialBombRange !== undefined ? behaviorData.InitialBombRange : Number("2") || 0; + this._behaviorData.BombCapacity = Number("2") || 0; + this._behaviorData.BombRange = Number("2") || 0; + this._behaviorData.IsDead = false; + } + + // Hot-reload: + updateFromBehaviorData(oldBehaviorData, newBehaviorData) { + + if (oldBehaviorData.Id !== newBehaviorData.Id) + this._behaviorData.Id = newBehaviorData.Id; + if (oldBehaviorData.InitialBombCapacity !== newBehaviorData.InitialBombCapacity) + this._behaviorData.InitialBombCapacity = newBehaviorData.InitialBombCapacity; + if (oldBehaviorData.InitialBombRange !== newBehaviorData.InitialBombRange) + this._behaviorData.InitialBombRange = newBehaviorData.InitialBombRange; + if (oldBehaviorData.BombCapacity !== newBehaviorData.BombCapacity) + this._behaviorData.BombCapacity = newBehaviorData.BombCapacity; + if (oldBehaviorData.BombRange !== newBehaviorData.BombRange) + this._behaviorData.BombRange = newBehaviorData.BombRange; + if (oldBehaviorData.IsDead !== newBehaviorData.IsDead) + this._behaviorData.IsDead = newBehaviorData.IsDead; + + return true; + } + + // Network sync: + getNetworkSyncData() { + return { + ...super.getNetworkSyncData(), + props: { + + Id: this._behaviorData.Id, + InitialBombCapacity: this._behaviorData.InitialBombCapacity, + InitialBombRange: this._behaviorData.InitialBombRange, + BombCapacity: this._behaviorData.BombCapacity, + BombRange: this._behaviorData.BombRange, + IsDead: this._behaviorData.IsDead, + } + }; + } + updateFromNetworkSyncData(networkSyncData) { + super.updateFromNetworkSyncData(networkSyncData); + + if (networkSyncData.props.Id !== undefined) + this._behaviorData.Id = networkSyncData.props.Id; + if (networkSyncData.props.InitialBombCapacity !== undefined) + this._behaviorData.InitialBombCapacity = networkSyncData.props.InitialBombCapacity; + if (networkSyncData.props.InitialBombRange !== undefined) + this._behaviorData.InitialBombRange = networkSyncData.props.InitialBombRange; + if (networkSyncData.props.BombCapacity !== undefined) + this._behaviorData.BombCapacity = networkSyncData.props.BombCapacity; + if (networkSyncData.props.BombRange !== undefined) + this._behaviorData.BombRange = networkSyncData.props.BombRange; + if (networkSyncData.props.IsDead !== undefined) + this._behaviorData.IsDead = networkSyncData.props.IsDead; + } + + // Properties: + + _getId() { + return this._behaviorData.Id !== undefined ? this._behaviorData.Id : Number("1") || 0; + } + _setId(newValue) { + this._behaviorData.Id = newValue; + } + _getInitialBombCapacity() { + return this._behaviorData.InitialBombCapacity !== undefined ? this._behaviorData.InitialBombCapacity : Number("2") || 0; + } + _setInitialBombCapacity(newValue) { + this._behaviorData.InitialBombCapacity = newValue; + } + _getInitialBombRange() { + return this._behaviorData.InitialBombRange !== undefined ? this._behaviorData.InitialBombRange : Number("2") || 0; + } + _setInitialBombRange(newValue) { + this._behaviorData.InitialBombRange = newValue; + } + _getBombCapacity() { + return this._behaviorData.BombCapacity !== undefined ? this._behaviorData.BombCapacity : Number("2") || 0; + } + _setBombCapacity(newValue) { + this._behaviorData.BombCapacity = newValue; + } + _getBombRange() { + return this._behaviorData.BombRange !== undefined ? this._behaviorData.BombRange : Number("2") || 0; + } + _setBombRange(newValue) { + this._behaviorData.BombRange = newValue; + } + _getIsDead() { + return this._behaviorData.IsDead !== undefined ? this._behaviorData.IsDead : false; + } + _setIsDead(newValue) { + this._behaviorData.IsDead = newValue; + } + _toggleIsDead() { + this._setIsDead(!this._getIsDead()); + } +} + +/** + * Shared data generated from Player behavior + */ +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.SharedData = class PlayerBehaviorSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._Player_PlayerBehaviorSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._Player_PlayerBehaviorSharedData = new gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.SharedData( + initialData + ); + } + return instanceContainer._Player_PlayerBehaviorSharedData; +} + +// Methods: +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext = {}; +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext.GDObjectObjects1= []; +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).ResetPowers((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext.GDObjectObjects1[i].hide(); +} +}} + +} + + +}; + +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreated = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Player"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Player"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.onCreatedContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.PickUpBonusContext = {}; +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.PickUpBonusContext.GDObjectObjects1= []; +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.PickUpBonusContext.GDObjectObjects2= []; +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.PickUpBonusContext.GDBonusObjects1= []; +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.PickUpBonusContext.GDBonusObjects2= []; + + +gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.PickUpBonusContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Bonus"), gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.PickUpBonusContext.GDBonusObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Player__PlayerBehavior.PlayerBehavior.prototype.PickUpBonusContext.GDBonusObjects1.length;i= 0 ) { + isConditionTrue_0 = true; + gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.IsInvincibleContext.GDObjectObjects1[k] = gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.IsInvincibleContext.GDObjectObjects1[i]; + ++k; + } +} +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.IsInvincibleContext.GDObjectObjects1.length = k; +if (isConditionTrue_0) { +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = true; }}} + +} + + +}; + +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.IsInvincible = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Respawn"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Respawn"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.IsInvincibleContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.IsInvincibleContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.IsInvincibleContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.IsInvincibleContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.IsInvincibleContext.GDObjectObjects2.length = 0; + + +return !!eventsFunctionContext.returnValue; +} +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext = {}; +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.GDObjectObjects1= []; +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.GDObjectObjects1.length;i= eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getInvincibilityTime() ) { + isConditionTrue_0 = true; + gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.GDObjectObjects1[k] = gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.GDObjectObjects1[i]; + ++k; + } +} +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.GDObjectObjects1.length = k; +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.GDObjectObjects1 */ +{for(var i = 0, len = gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.GDObjectObjects1[i].removeTimer("Invincible"); +} +}} + +} + + +}; + +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEvents = function(parentEventsFunctionContext) { +this._onceTriggers.startNewFrame(); +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Respawn"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Respawn"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPreEventsContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext = {}; +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.GDObjectObjects1= []; +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +isConditionTrue_0 = gdjs.evtTools.runtimeScene.sceneJustBegins(runtimeScene); +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setOriginX((gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.GDObjectObjects1[i].getX())); +} +}{for(var i = 0, len = gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setOriginY((gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.GDObjectObjects1[i].getY())); +} +}} + +} + + +}; + +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEvents = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Respawn"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Respawn"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Respawn__Respawn.Respawn.prototype.doStepPostEventsContext.GDObjectObjects2.length = 0; + + +return; +} + + +gdjs.registerBehavior("Respawn::Respawn", gdjs.evtsExt__Respawn__Respawn.Respawn); diff --git a/gdjs-evtsext__shakeobject3d__create-func.js b/gdjs-evtsext__shakeobject3d__create-func.js new file mode 100644 index 0000000000000000000000000000000000000000..c8245a3137f01665a5693a794a355759005094b3 --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__create-func.js @@ -0,0 +1,90 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__Create !== "undefined") { + gdjs.evtsExt__ShakeObject3D__Create.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__Create = {}; + + +gdjs.evtsExt__ShakeObject3D__Create.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); + +gdjs._shakeObjectExtension.noiseManager.getGenerator(name); +}; +gdjs.evtsExt__ShakeObject3D__Create.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__Create.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__Create.func = function(runtimeScene, Name, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Name") return Name; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__Create.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__ShakeObject3D__Create.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__definehelperclasses-func.js b/gdjs-evtsext__shakeobject3d__definehelperclasses-func.js new file mode 100644 index 0000000000000000000000000000000000000000..f406f658cc39f9689f5637104788eba66a3421ba --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__definehelperclasses-func.js @@ -0,0 +1,719 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__DefineHelperClasses !== "undefined") { + gdjs.evtsExt__ShakeObject3D__DefineHelperClasses.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__DefineHelperClasses = {}; + + +gdjs.evtsExt__ShakeObject3D__DefineHelperClasses.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +if (gdjs._shakeObjectExtension) { + return; +} + +/** Noise generator manager. */ +class NoiseManager { + /** + * Create the manager of noise generators. + */ + constructor() { + this.seed = gdjs.randomInRange(1, Number.MAX_SAFE_INTEGER); + /** @type {Map} */ + this.generators = new Map(); + } + + /** + * @param name {string} + * @return {NoiseGenerator} + */ + getGenerator(name) { + let generator = this.generators.get(name); + if (!generator) { + generator = new NoiseGenerator(name + this.seed); + this.generators.set(name, generator); + } + return generator; + } + + /** + * @param seed {number} + */ + setSeed(seed) { + this.seed = seed; + this.generators.forEach(generator => generator.setSeed(name + this.seed)); + } + + /** + * @param name {string} + */ + deleteGenerator(name) { + this.generators.delete(name); + } + + /** + */ + deleteAllGenerators() { + this.generators.clear(); + } +} + +/** Noise generator with octaves. */ +class NoiseGenerator { + /** + * Create a noise generator with a seed. + * @param seed {string} + */ + constructor(seed) { + this.simplexNoise = new SimplexNoise(seed); + this.frequency = 1; + this.octaves = 1; + this.persistence = 0.5; + this.lacunarity = 2; + this.xLoopPeriod = 0; + this.yLoopPeriod = 0; + } + + /** + * @param seed {string} + */ + setSeed(seed) { + this.simplexNoise = new SimplexNoise(seed); + } + + /** + * @param x {float} + * @param y {float} + * @param z {float} optionnal + * @param w {float} optionnal + * @return {float} + */ + noise(x, y, z, w) { + if (this.xLoopPeriod && this.yLoopPeriod) { + const circleRatioX = 2 * Math.PI / this.xLoopPeriod; + const circleRatioY = 2 * Math.PI / this.yLoopPeriod; + const angleX = circleRatioX * x; + const angleY = circleRatioY * y; + x = Math.cos(angleX) / circleRatioX; + y = Math.sin(angleX) / circleRatioX; + z = Math.cos(angleY) / circleRatioY; + w = Math.sin(angleY) / circleRatioY; + } + else if (this.xLoopPeriod) { + const circleRatio = 2 * Math.PI / this.xLoopPeriod; + const angleX = circleRatio * x; + w = z; + z = y; + x = Math.cos(angleX) / circleRatio; + y = Math.sin(angleX) / circleRatio; + } + else if (this.yLoopPeriod) { + const circleRatio = 2 * Math.PI / this.xLoopPeriod; + const angleX = circleRatio * x; + w = z; + // Make the circle perimeter equals to the looping period + // to keep the same perceived frequency with or without looping. + y = Math.cos(angleX) / circleRatio; + z = Math.sin(angleX) / circleRatio; + } + let noiseFunction = this.simplexNoise.noise4D.bind(this.simplexNoise); + if (z === undefined) { + noiseFunction = this.simplexNoise.noise2D.bind(this.simplexNoise); + } + else if (w === undefined) { + noiseFunction = this.simplexNoise.noise3D.bind(this.simplexNoise); + } + let frequency = this.frequency; + let noiseSum = 0; + let amplitudeSum = 0; + let amplitude = 1; + for (let i = 0; i < this.octaves; i++) { + noiseSum += noiseFunction(x * frequency, y * frequency, z * frequency, w * frequency) * amplitude; + amplitudeSum += Math.abs(amplitude); + amplitude *= this.persistence; + frequency *= this.lacunarity; + } + return noiseSum / amplitudeSum; + } +} + +/* +A fast javascript implementation of simplex noise by Jonas Wagner +https://github.com/jwagner/simplex-noise.js + +Based on a speed-improved simplex noise algorithm for 2D, 3D and 4D in Java. +Which is based on example code by Stefan Gustavson (stegu@itn.liu.se). +With Optimisations by Peter Eastman (peastman@drizzle.stanford.edu). +Better rank ordering method by Stefan Gustavson in 2012. + + Copyright (c) 2021 Jonas Wagner + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + */ + +const F2 = 0.5 * (Math.sqrt(3.0) - 1.0); +const G2 = (3.0 - Math.sqrt(3.0)) / 6.0; +const F3 = 1.0 / 3.0; +const G3 = 1.0 / 6.0; +const F4 = (Math.sqrt(5.0) - 1.0) / 4.0; +const G4 = (5.0 - Math.sqrt(5.0)) / 20.0; +const grad3 = new Float32Array([1, 1, 0, + -1, 1, 0, + 1, -1, 0, + -1, -1, 0, + 1, 0, 1, + -1, 0, 1, + 1, 0, -1, + -1, 0, -1, + 0, 1, 1, + 0, -1, 1, + 0, 1, -1, + 0, -1, -1]); +const grad4 = new Float32Array([0, 1, 1, 1, 0, 1, 1, -1, 0, 1, -1, 1, 0, 1, -1, -1, + 0, -1, 1, 1, 0, -1, 1, -1, 0, -1, -1, 1, 0, -1, -1, -1, + 1, 0, 1, 1, 1, 0, 1, -1, 1, 0, -1, 1, 1, 0, -1, -1, + -1, 0, 1, 1, -1, 0, 1, -1, -1, 0, -1, 1, -1, 0, -1, -1, + 1, 1, 0, 1, 1, 1, 0, -1, 1, -1, 0, 1, 1, -1, 0, -1, + -1, 1, 0, 1, -1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, -1, + 1, 1, 1, 0, 1, 1, -1, 0, 1, -1, 1, 0, 1, -1, -1, 0, + -1, 1, 1, 0, -1, 1, -1, 0, -1, -1, 1, 0, -1, -1, -1, 0]); + + +/** + * Builds a random permutation table. + * This is exported only for (internal) testing purposes. + * Do not rely on this export. + * @param {() => number} random + * @private + */ +function buildPermutationTable(random) { + const p = new Uint8Array(256); + for (let i = 0; i < 256; i++) { + p[i] = i; + } + for (let i = 0; i < 255; i++) { + const r = i + ~~(random() * (256 - i)); + const aux = p[i]; + p[i] = p[r]; + p[r] = aux; + } + return p; +} + +/* +The ALEA PRNG and masher code used by simplex-noise.js +is based on code by Johannes Baagøe, modified by Jonas Wagner. +See alea.md for the full license. +@param {string|number} seed +*/ +function alea(seed) { + let s0 = 0; + let s1 = 0; + let s2 = 0; + let c = 1; + const mash = masher(); + s0 = mash(' '); + s1 = mash(' '); + s2 = mash(' '); + s0 -= mash(seed); + if (s0 < 0) { + s0 += 1; + } + s1 -= mash(seed); + if (s1 < 0) { + s1 += 1; + } + s2 -= mash(seed); + if (s2 < 0) { + s2 += 1; + } + return function () { + const t = 2091639 * s0 + c * 2.3283064365386963e-10; // 2^-32 + s0 = s1; + s1 = s2; + return s2 = t - (c = t | 0); + }; +} + +function masher() { + let n = 0xefc8249d; + return function (data) { + data = data.toString(); + for (let i = 0; i < data.length; i++) { + n += data.charCodeAt(i); + let h = 0.02519603282416938 * n; + n = h >>> 0; + h -= n; + h *= n; + n = h >>> 0; + h -= n; + n += h * 0x100000000; // 2^32 + } + return (n >>> 0) * 2.3283064365386963e-10; // 2^-32 + }; +} + +/** Deterministic simplex noise generator suitable for 2D, 3D and 4D spaces. */ +class SimplexNoise { + /** + * Creates a new `SimplexNoise` instance. + * This involves some setup. You can save a few cpu cycles by reusing the same instance. + * @param {(() => number)|string|number} randomOrSeed A random number generator or a seed (string|number). + * Defaults to Math.random (random irreproducible initialization). + */ + constructor(randomOrSeed) { + if (randomOrSeed === void 0) { randomOrSeed = Math.random; } + const random = typeof randomOrSeed == 'function' ? randomOrSeed : alea(randomOrSeed); + this.p = buildPermutationTable(random); + this.perm = new Uint8Array(512); + this.permMod12 = new Uint8Array(512); + for (let i = 0; i < 512; i++) { + this.perm[i] = this.p[i & 255]; + this.permMod12[i] = this.perm[i] % 12; + } + } + + /** + * Samples the noise field in 2 dimensions + * @param {number} x + * @param {number} y + * @returns a number in the interval [-1, 1] + */ + noise2D(x, y) { + const permMod12 = this.permMod12; + const perm = this.perm; + let n0 = 0; // Noise contributions from the three corners + let n1 = 0; + let n2 = 0; + // Skew the input space to determine which simplex cell we're in + const s = (x + y) * F2; // Hairy factor for 2D + const i = Math.floor(x + s); + const j = Math.floor(y + s); + const t = (i + j) * G2; + const X0 = i - t; // Unskew the cell origin back to (x,y) space + const Y0 = j - t; + const x0 = x - X0; // The x,y distances from the cell origin + const y0 = y - Y0; + // For the 2D case, the simplex shape is an equilateral triangle. + // Determine which simplex we are in. + let i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords + if (x0 > y0) { + i1 = 1; + j1 = 0; + } // lower triangle, XY order: (0,0)->(1,0)->(1,1) + else { + i1 = 0; + j1 = 1; + } // upper triangle, YX order: (0,0)->(0,1)->(1,1) + // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and + // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where + // c = (3-sqrt(3))/6 + const x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords + const y1 = y0 - j1 + G2; + const x2 = x0 - 1.0 + 2.0 * G2; // Offsets for last corner in (x,y) unskewed coords + const y2 = y0 - 1.0 + 2.0 * G2; + // Work out the hashed gradient indices of the three simplex corners + const ii = i & 255; + const jj = j & 255; + // Calculate the contribution from the three corners + let t0 = 0.5 - x0 * x0 - y0 * y0; + if (t0 >= 0) { + const gi0 = permMod12[ii + perm[jj]] * 3; + t0 *= t0; + n0 = t0 * t0 * (grad3[gi0] * x0 + grad3[gi0 + 1] * y0); // (x,y) of grad3 used for 2D gradient + } + let t1 = 0.5 - x1 * x1 - y1 * y1; + if (t1 >= 0) { + const gi1 = permMod12[ii + i1 + perm[jj + j1]] * 3; + t1 *= t1; + n1 = t1 * t1 * (grad3[gi1] * x1 + grad3[gi1 + 1] * y1); + } + let t2 = 0.5 - x2 * x2 - y2 * y2; + if (t2 >= 0) { + const gi2 = permMod12[ii + 1 + perm[jj + 1]] * 3; + t2 *= t2; + n2 = t2 * t2 * (grad3[gi2] * x2 + grad3[gi2 + 1] * y2); + } + // Add contributions from each corner to get the final noise value. + // The result is scaled to return values in the interval [-1,1]. + return 70.0 * (n0 + n1 + n2); + } + + /** + * Samples the noise field in 3 dimensions + * @param {number} x + * @param {number} y + * @param {number} z + * @returns a number in the interval [-1, 1] + */ + noise3D(x, y, z) { + const permMod12 = this.permMod12; + const perm = this.perm; + let n0, n1, n2, n3; // Noise contributions from the four corners + // Skew the input space to determine which simplex cell we're in + const s = (x + y + z) * F3; // Very nice and simple skew factor for 3D + const i = Math.floor(x + s); + const j = Math.floor(y + s); + const k = Math.floor(z + s); + const t = (i + j + k) * G3; + const X0 = i - t; // Unskew the cell origin back to (x,y,z) space + const Y0 = j - t; + const Z0 = k - t; + const x0 = x - X0; // The x,y,z distances from the cell origin + const y0 = y - Y0; + const z0 = z - Z0; + // For the 3D case, the simplex shape is a slightly irregular tetrahedron. + // Determine which simplex we are in. + let i1, j1, k1; // Offsets for second corner of simplex in (i,j,k) coords + let i2, j2, k2; // Offsets for third corner of simplex in (i,j,k) coords + if (x0 >= y0) { + if (y0 >= z0) { + i1 = 1; + j1 = 0; + k1 = 0; + i2 = 1; + j2 = 1; + k2 = 0; + } // X Y Z order + else if (x0 >= z0) { + i1 = 1; + j1 = 0; + k1 = 0; + i2 = 1; + j2 = 0; + k2 = 1; + } // X Z Y order + else { + i1 = 0; + j1 = 0; + k1 = 1; + i2 = 1; + j2 = 0; + k2 = 1; + } // Z X Y order + } + else { // x0 y0) + rankx++; + else + ranky++; + if (x0 > z0) + rankx++; + else + rankz++; + if (x0 > w0) + rankx++; + else + rankw++; + if (y0 > z0) + ranky++; + else + rankz++; + if (y0 > w0) + ranky++; + else + rankw++; + if (z0 > w0) + rankz++; + else + rankw++; + // simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some order. + // Many values of c will never occur, since e.g. x>y>z>w makes x= 3 ? 1 : 0; + const j1 = ranky >= 3 ? 1 : 0; + const k1 = rankz >= 3 ? 1 : 0; + const l1 = rankw >= 3 ? 1 : 0; + // The integer offsets for the third simplex corner + const i2 = rankx >= 2 ? 1 : 0; + const j2 = ranky >= 2 ? 1 : 0; + const k2 = rankz >= 2 ? 1 : 0; + const l2 = rankw >= 2 ? 1 : 0; + // The integer offsets for the fourth simplex corner + const i3 = rankx >= 1 ? 1 : 0; + const j3 = ranky >= 1 ? 1 : 0; + const k3 = rankz >= 1 ? 1 : 0; + const l3 = rankw >= 1 ? 1 : 0; + // The fifth corner has all coordinate offsets = 1, so no need to compute that. + const x1 = x0 - i1 + G4; // Offsets for second corner in (x,y,z,w) coords + const y1 = y0 - j1 + G4; + const z1 = z0 - k1 + G4; + const w1 = w0 - l1 + G4; + const x2 = x0 - i2 + 2.0 * G4; // Offsets for third corner in (x,y,z,w) coords + const y2 = y0 - j2 + 2.0 * G4; + const z2 = z0 - k2 + 2.0 * G4; + const w2 = w0 - l2 + 2.0 * G4; + const x3 = x0 - i3 + 3.0 * G4; // Offsets for fourth corner in (x,y,z,w) coords + const y3 = y0 - j3 + 3.0 * G4; + const z3 = z0 - k3 + 3.0 * G4; + const w3 = w0 - l3 + 3.0 * G4; + const x4 = x0 - 1.0 + 4.0 * G4; // Offsets for last corner in (x,y,z,w) coords + const y4 = y0 - 1.0 + 4.0 * G4; + const z4 = z0 - 1.0 + 4.0 * G4; + const w4 = w0 - 1.0 + 4.0 * G4; + // Work out the hashed gradient indices of the five simplex corners + const ii = i & 255; + const jj = j & 255; + const kk = k & 255; + const ll = l & 255; + // Calculate the contribution from the five corners + let t0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0; + if (t0 < 0) + n0 = 0.0; + else { + const gi0 = (perm[ii + perm[jj + perm[kk + perm[ll]]]] % 32) * 4; + t0 *= t0; + n0 = t0 * t0 * (grad4[gi0] * x0 + grad4[gi0 + 1] * y0 + grad4[gi0 + 2] * z0 + grad4[gi0 + 3] * w0); + } + let t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1; + if (t1 < 0) + n1 = 0.0; + else { + const gi1 = (perm[ii + i1 + perm[jj + j1 + perm[kk + k1 + perm[ll + l1]]]] % 32) * 4; + t1 *= t1; + n1 = t1 * t1 * (grad4[gi1] * x1 + grad4[gi1 + 1] * y1 + grad4[gi1 + 2] * z1 + grad4[gi1 + 3] * w1); + } + let t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2; + if (t2 < 0) + n2 = 0.0; + else { + const gi2 = (perm[ii + i2 + perm[jj + j2 + perm[kk + k2 + perm[ll + l2]]]] % 32) * 4; + t2 *= t2; + n2 = t2 * t2 * (grad4[gi2] * x2 + grad4[gi2 + 1] * y2 + grad4[gi2 + 2] * z2 + grad4[gi2 + 3] * w2); + } + let t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3; + if (t3 < 0) + n3 = 0.0; + else { + const gi3 = (perm[ii + i3 + perm[jj + j3 + perm[kk + k3 + perm[ll + l3]]]] % 32) * 4; + t3 *= t3; + n3 = t3 * t3 * (grad4[gi3] * x3 + grad4[gi3 + 1] * y3 + grad4[gi3 + 2] * z3 + grad4[gi3 + 3] * w3); + } + let t4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4; + if (t4 < 0) + n4 = 0.0; + else { + const gi4 = (perm[ii + 1 + perm[jj + 1 + perm[kk + 1 + perm[ll + 1]]]] % 32) * 4; + t4 *= t4; + n4 = t4 * t4 * (grad4[gi4] * x4 + grad4[gi4 + 1] * y4 + grad4[gi4 + 2] * z4 + grad4[gi4 + 3] * w4); + } + // Sum up and scale the result to cover the range [-1,1] + return 27.0 * (n0 + n1 + n2 + n3 + n4); + }; +} + +gdjs._shakeObjectExtension = { + noiseManager: new NoiseManager(), +}; + +}; +gdjs.evtsExt__ShakeObject3D__DefineHelperClasses.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__DefineHelperClasses.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__DefineHelperClasses.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__DefineHelperClasses.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__ShakeObject3D__DefineHelperClasses.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__delete-func.js b/gdjs-evtsext__shakeobject3d__delete-func.js new file mode 100644 index 0000000000000000000000000000000000000000..2d561a598099fc2b6fec6685d8cb6f71f2b5efcc --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__delete-func.js @@ -0,0 +1,90 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__Delete !== "undefined") { + gdjs.evtsExt__ShakeObject3D__Delete.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__Delete = {}; + + +gdjs.evtsExt__ShakeObject3D__Delete.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); + +gdjs._shakeObjectExtension.noiseManager.deleteGenerator(name); +}; +gdjs.evtsExt__ShakeObject3D__Delete.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__Delete.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__Delete.func = function(runtimeScene, Name, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Name") return Name; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__Delete.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__ShakeObject3D__Delete.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__deleteall-func.js b/gdjs-evtsext__shakeobject3d__deleteall-func.js new file mode 100644 index 0000000000000000000000000000000000000000..0b6cbc74a3335e246e6bdd69d10ec2a90f451615 --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__deleteall-func.js @@ -0,0 +1,87 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__DeleteAll !== "undefined") { + gdjs.evtsExt__ShakeObject3D__DeleteAll.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__DeleteAll = {}; + + +gdjs.evtsExt__ShakeObject3D__DeleteAll.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +gdjs._shakeObjectExtension.noiseManager.deleteAllGenerators(); +}; +gdjs.evtsExt__ShakeObject3D__DeleteAll.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__DeleteAll.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__DeleteAll.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__DeleteAll.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__ShakeObject3D__DeleteAll.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__frequency-func.js b/gdjs-evtsext__shakeobject3d__frequency-func.js new file mode 100644 index 0000000000000000000000000000000000000000..4815eb3c98e2ff68f25382b0d64f9da2d9c94e58 --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__frequency-func.js @@ -0,0 +1,90 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__Frequency !== "undefined") { + gdjs.evtsExt__ShakeObject3D__Frequency.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__Frequency = {}; + + +gdjs.evtsExt__ShakeObject3D__Frequency.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); + +eventsFunctionContext.returnValue = gdjs._shakeObjectExtension.noiseManager.getGenerator(name).frequency; +}; +gdjs.evtsExt__ShakeObject3D__Frequency.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__Frequency.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__Frequency.func = function(runtimeScene, Name, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Name") return Name; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__Frequency.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__ShakeObject3D__Frequency.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__lacunarity-func.js b/gdjs-evtsext__shakeobject3d__lacunarity-func.js new file mode 100644 index 0000000000000000000000000000000000000000..5b953d76028176e5d5d54f75144ffdfc30cf43b3 --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__lacunarity-func.js @@ -0,0 +1,90 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__Lacunarity !== "undefined") { + gdjs.evtsExt__ShakeObject3D__Lacunarity.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__Lacunarity = {}; + + +gdjs.evtsExt__ShakeObject3D__Lacunarity.userFunc0x8c2040 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); + +eventsFunctionContext.returnValue = gdjs._shakeObjectExtension.noiseManager.getGenerator(name).lacunarity; +}; +gdjs.evtsExt__ShakeObject3D__Lacunarity.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__Lacunarity.userFunc0x8c2040(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__Lacunarity.func = function(runtimeScene, Name, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Name") return Name; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__Lacunarity.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__ShakeObject3D__Lacunarity.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__noise2d-func.js b/gdjs-evtsext__shakeobject3d__noise2d-func.js new file mode 100644 index 0000000000000000000000000000000000000000..4ee3392822a03ef16ae4565e41d916d02f59e83f --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__noise2d-func.js @@ -0,0 +1,94 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__Noise2d !== "undefined") { + gdjs.evtsExt__ShakeObject3D__Noise2d.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__Noise2d = {}; + + +gdjs.evtsExt__ShakeObject3D__Noise2d.userFunc0xddea40 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); +const x = eventsFunctionContext.getArgument("X"); +const y = eventsFunctionContext.getArgument("Y"); + +eventsFunctionContext.returnValue = gdjs._shakeObjectExtension.noiseManager.getGenerator(name).noise(x, y); +}; +gdjs.evtsExt__ShakeObject3D__Noise2d.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__Noise2d.userFunc0xddea40(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__Noise2d.func = function(runtimeScene, Name, X, Y, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Name") return Name; +if (argName === "X") return X; +if (argName === "Y") return Y; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__Noise2d.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__ShakeObject3D__Noise2d.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__noise3d-func.js b/gdjs-evtsext__shakeobject3d__noise3d-func.js new file mode 100644 index 0000000000000000000000000000000000000000..080f0d54a224d09b075f89994edb13bf76dfa35f --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__noise3d-func.js @@ -0,0 +1,96 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__Noise3d !== "undefined") { + gdjs.evtsExt__ShakeObject3D__Noise3d.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__Noise3d = {}; + + +gdjs.evtsExt__ShakeObject3D__Noise3d.userFunc0xddea40 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); +const x = eventsFunctionContext.getArgument("X"); +const y = eventsFunctionContext.getArgument("Y"); +const z = eventsFunctionContext.getArgument("Z"); + +eventsFunctionContext.returnValue = gdjs._shakeObjectExtension.noiseManager.getGenerator(name).noise(x, y, z); +}; +gdjs.evtsExt__ShakeObject3D__Noise3d.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__Noise3d.userFunc0xddea40(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__Noise3d.func = function(runtimeScene, Name, X, Y, Z, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Name") return Name; +if (argName === "X") return X; +if (argName === "Y") return Y; +if (argName === "Z") return Z; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__Noise3d.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__ShakeObject3D__Noise3d.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__noise4d-func.js b/gdjs-evtsext__shakeobject3d__noise4d-func.js new file mode 100644 index 0000000000000000000000000000000000000000..10acc68360c776fcdaa4a443003d61cad58a4d45 --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__noise4d-func.js @@ -0,0 +1,98 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__Noise4d !== "undefined") { + gdjs.evtsExt__ShakeObject3D__Noise4d.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__Noise4d = {}; + + +gdjs.evtsExt__ShakeObject3D__Noise4d.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); +const x = eventsFunctionContext.getArgument("X"); +const y = eventsFunctionContext.getArgument("Y"); +const z = eventsFunctionContext.getArgument("Z"); +const w = eventsFunctionContext.getArgument("W"); + +eventsFunctionContext.returnValue = gdjs._shakeObjectExtension.noiseManager.getGenerator(name).noise(x, y, z, w); +}; +gdjs.evtsExt__ShakeObject3D__Noise4d.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__Noise4d.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__Noise4d.func = function(runtimeScene, Name, X, Y, Z, W, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Name") return Name; +if (argName === "X") return X; +if (argName === "Y") return Y; +if (argName === "Z") return Z; +if (argName === "W") return W; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__Noise4d.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__ShakeObject3D__Noise4d.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__octaves-func.js b/gdjs-evtsext__shakeobject3d__octaves-func.js new file mode 100644 index 0000000000000000000000000000000000000000..7fe30c579acc563d376e34254693e0a2cf6325be --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__octaves-func.js @@ -0,0 +1,90 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__Octaves !== "undefined") { + gdjs.evtsExt__ShakeObject3D__Octaves.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__Octaves = {}; + + +gdjs.evtsExt__ShakeObject3D__Octaves.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); + +eventsFunctionContext.returnValue = gdjs._shakeObjectExtension.noiseManager.getGenerator(name).octaves; +}; +gdjs.evtsExt__ShakeObject3D__Octaves.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__Octaves.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__Octaves.func = function(runtimeScene, Name, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Name") return Name; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__Octaves.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__ShakeObject3D__Octaves.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__onfirstsceneloaded-func.js b/gdjs-evtsext__shakeobject3d__onfirstsceneloaded-func.js new file mode 100644 index 0000000000000000000000000000000000000000..750016170e150a3bf00767f760535c2b3137a7e7 --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__onfirstsceneloaded-func.js @@ -0,0 +1,90 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__onFirstSceneLoaded !== "undefined") { + gdjs.evtsExt__ShakeObject3D__onFirstSceneLoaded.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__onFirstSceneLoaded = {}; + + +gdjs.evtsExt__ShakeObject3D__onFirstSceneLoaded.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +{gdjs.evtsExt__ShakeObject3D__DefineHelperClasses.func(runtimeScene, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +}} + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__onFirstSceneLoaded.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__onFirstSceneLoaded.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__ShakeObject3D__onFirstSceneLoaded.registeredGdjsCallbacks = []; +gdjs.evtsExt__ShakeObject3D__onFirstSceneLoaded.registeredGdjsCallbacks.push((runtimeScene) => { + gdjs.evtsExt__ShakeObject3D__onFirstSceneLoaded.func(runtimeScene, runtimeScene); +}) +gdjs.registerFirstRuntimeSceneLoadedCallback(gdjs.evtsExt__ShakeObject3D__onFirstSceneLoaded.registeredGdjsCallbacks[gdjs.evtsExt__ShakeObject3D__onFirstSceneLoaded.registeredGdjsCallbacks.length - 1]); diff --git a/gdjs-evtsext__shakeobject3d__persistence-func.js b/gdjs-evtsext__shakeobject3d__persistence-func.js new file mode 100644 index 0000000000000000000000000000000000000000..9d01d0cb02a6635eb76aa8a8882cbbc8d5ef974d --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__persistence-func.js @@ -0,0 +1,90 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__Persistence !== "undefined") { + gdjs.evtsExt__ShakeObject3D__Persistence.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__Persistence = {}; + + +gdjs.evtsExt__ShakeObject3D__Persistence.userFunc0x8c2040 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); + +eventsFunctionContext.returnValue = gdjs._shakeObjectExtension.noiseManager.getGenerator(name).persistence; +}; +gdjs.evtsExt__ShakeObject3D__Persistence.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__Persistence.userFunc0x8c2040(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__Persistence.func = function(runtimeScene, Name, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Name") return Name; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__Persistence.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__ShakeObject3D__Persistence.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__seed-func.js b/gdjs-evtsext__shakeobject3d__seed-func.js new file mode 100644 index 0000000000000000000000000000000000000000..7d1845b90b1f2884311842ffd8cff4b741356e2a --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__seed-func.js @@ -0,0 +1,87 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__Seed !== "undefined") { + gdjs.evtsExt__ShakeObject3D__Seed.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__Seed = {}; + + +gdjs.evtsExt__ShakeObject3D__Seed.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +eventsFunctionContext.returnValue = gdjs._shakeObjectExtension.noiseManager.seed; +}; +gdjs.evtsExt__ShakeObject3D__Seed.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__Seed.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__Seed.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__Seed.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__ShakeObject3D__Seed.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__setfrequency-func.js b/gdjs-evtsext__shakeobject3d__setfrequency-func.js new file mode 100644 index 0000000000000000000000000000000000000000..d467cc64700eb04de48ffce4351357a8bf824901 --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__setfrequency-func.js @@ -0,0 +1,91 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__SetFrequency !== "undefined") { + gdjs.evtsExt__ShakeObject3D__SetFrequency.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__SetFrequency = {}; + + +gdjs.evtsExt__ShakeObject3D__SetFrequency.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); + +gdjs._shakeObjectExtension.noiseManager.getGenerator(name).frequency = eventsFunctionContext.getArgument("Frequency"); +}; +gdjs.evtsExt__ShakeObject3D__SetFrequency.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__SetFrequency.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__SetFrequency.func = function(runtimeScene, Frequency, Name, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Frequency") return Frequency; +if (argName === "Name") return Name; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__SetFrequency.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__ShakeObject3D__SetFrequency.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__setlacunarity-func.js b/gdjs-evtsext__shakeobject3d__setlacunarity-func.js new file mode 100644 index 0000000000000000000000000000000000000000..d92087bed80f72a1eb84f66dc7bbfeb36fedbadb --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__setlacunarity-func.js @@ -0,0 +1,91 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__SetLacunarity !== "undefined") { + gdjs.evtsExt__ShakeObject3D__SetLacunarity.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__SetLacunarity = {}; + + +gdjs.evtsExt__ShakeObject3D__SetLacunarity.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); + +gdjs._shakeObjectExtension.noiseManager.getGenerator(name).lacunarity = eventsFunctionContext.getArgument("Lacunarity"); +}; +gdjs.evtsExt__ShakeObject3D__SetLacunarity.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__SetLacunarity.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__SetLacunarity.func = function(runtimeScene, Lacunarity, Name, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Lacunarity") return Lacunarity; +if (argName === "Name") return Name; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__SetLacunarity.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__ShakeObject3D__SetLacunarity.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__setloopperiodx-func.js b/gdjs-evtsext__shakeobject3d__setloopperiodx-func.js new file mode 100644 index 0000000000000000000000000000000000000000..b72f4d0971134599b5459e71f2b0d21cd8ef68b0 --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__setloopperiodx-func.js @@ -0,0 +1,91 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__SetLoopPeriodX !== "undefined") { + gdjs.evtsExt__ShakeObject3D__SetLoopPeriodX.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__SetLoopPeriodX = {}; + + +gdjs.evtsExt__ShakeObject3D__SetLoopPeriodX.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); + +gdjs._shakeObjectExtension.noiseManager.getGenerator(name).xLoopPeriod = eventsFunctionContext.getArgument("LoopPeriod"); +}; +gdjs.evtsExt__ShakeObject3D__SetLoopPeriodX.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__SetLoopPeriodX.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__SetLoopPeriodX.func = function(runtimeScene, LoopPeriod, Name, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "LoopPeriod") return LoopPeriod; +if (argName === "Name") return Name; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__SetLoopPeriodX.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__ShakeObject3D__SetLoopPeriodX.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__setloopperiody-func.js b/gdjs-evtsext__shakeobject3d__setloopperiody-func.js new file mode 100644 index 0000000000000000000000000000000000000000..d6278479bcf000a57f0ebf289e7f1b854c3ca38e --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__setloopperiody-func.js @@ -0,0 +1,91 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__SetLoopPeriodY !== "undefined") { + gdjs.evtsExt__ShakeObject3D__SetLoopPeriodY.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__SetLoopPeriodY = {}; + + +gdjs.evtsExt__ShakeObject3D__SetLoopPeriodY.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); + +gdjs._shakeObjectExtension.noiseManager.getGenerator(name).yLoopPeriod = eventsFunctionContext.getArgument("LoopPeriod"); +}; +gdjs.evtsExt__ShakeObject3D__SetLoopPeriodY.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__SetLoopPeriodY.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__SetLoopPeriodY.func = function(runtimeScene, LoopPeriod, Name, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "LoopPeriod") return LoopPeriod; +if (argName === "Name") return Name; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__SetLoopPeriodY.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__ShakeObject3D__SetLoopPeriodY.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__setoctaves-func.js b/gdjs-evtsext__shakeobject3d__setoctaves-func.js new file mode 100644 index 0000000000000000000000000000000000000000..56fdedce4ef319c8a64f1d0fc3fce62d668cabc7 --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__setoctaves-func.js @@ -0,0 +1,91 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__SetOctaves !== "undefined") { + gdjs.evtsExt__ShakeObject3D__SetOctaves.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__SetOctaves = {}; + + +gdjs.evtsExt__ShakeObject3D__SetOctaves.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); + +gdjs._shakeObjectExtension.noiseManager.getGenerator(name).octaves = eventsFunctionContext.getArgument("Octaves"); +}; +gdjs.evtsExt__ShakeObject3D__SetOctaves.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__SetOctaves.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__SetOctaves.func = function(runtimeScene, Octaves, Name, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Octaves") return Octaves; +if (argName === "Name") return Name; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__SetOctaves.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__ShakeObject3D__SetOctaves.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__setpersistence-func.js b/gdjs-evtsext__shakeobject3d__setpersistence-func.js new file mode 100644 index 0000000000000000000000000000000000000000..55f0fc14eae2572ef2e2c0bf3ee8aff04e1b9b1b --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__setpersistence-func.js @@ -0,0 +1,91 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__SetPersistence !== "undefined") { + gdjs.evtsExt__ShakeObject3D__SetPersistence.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__SetPersistence = {}; + + +gdjs.evtsExt__ShakeObject3D__SetPersistence.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const name = eventsFunctionContext.getArgument("Name"); + +gdjs._shakeObjectExtension.noiseManager.getGenerator(name).persistence = eventsFunctionContext.getArgument("Persistence"); +}; +gdjs.evtsExt__ShakeObject3D__SetPersistence.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__SetPersistence.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__SetPersistence.func = function(runtimeScene, Persistence, Name, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Persistence") return Persistence; +if (argName === "Name") return Name; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__SetPersistence.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__ShakeObject3D__SetPersistence.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__setseed-func.js b/gdjs-evtsext__shakeobject3d__setseed-func.js new file mode 100644 index 0000000000000000000000000000000000000000..f46af639b3914358b02a7d55f572a365c0abca66 --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__setseed-func.js @@ -0,0 +1,88 @@ + +if (typeof gdjs.evtsExt__ShakeObject3D__SetSeed !== "undefined") { + gdjs.evtsExt__ShakeObject3D__SetSeed.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__ShakeObject3D__SetSeed = {}; + + +gdjs.evtsExt__ShakeObject3D__SetSeed.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +gdjs._shakeObjectExtension.noiseManager.setSeed(eventsFunctionContext.getArgument("Seed")); +}; +gdjs.evtsExt__ShakeObject3D__SetSeed.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__ShakeObject3D__SetSeed.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__SetSeed.func = function(runtimeScene, Seed, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Seed") return Seed; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__ShakeObject3D__SetSeed.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__ShakeObject3D__SetSeed.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__shakeobject3d__shakemodel3d.js b/gdjs-evtsext__shakeobject3d__shakemodel3d.js new file mode 100644 index 0000000000000000000000000000000000000000..95fc83271efc179bde1e707046274aa832120d5e --- /dev/null +++ b/gdjs-evtsext__shakeobject3d__shakemodel3d.js @@ -0,0 +1,2066 @@ + +gdjs.evtsExt__ShakeObject3D__ShakeModel3D = gdjs.evtsExt__ShakeObject3D__ShakeModel3D || {}; + +/** + * Behavior generated from 3D shake + */ +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D = class ShakeModel3D extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.TranslationAmplitudeX = behaviorData.TranslationAmplitudeX !== undefined ? behaviorData.TranslationAmplitudeX : Number("0") || 0; + this._behaviorData.TranslationAmplitudeY = behaviorData.TranslationAmplitudeY !== undefined ? behaviorData.TranslationAmplitudeY : Number("0") || 0; + this._behaviorData.TranslationAmplitudeZ = behaviorData.TranslationAmplitudeZ !== undefined ? behaviorData.TranslationAmplitudeZ : Number("0") || 0; + this._behaviorData.RotationAmplitudeX = behaviorData.RotationAmplitudeX !== undefined ? behaviorData.RotationAmplitudeX : Number("5") || 0; + this._behaviorData.RotationAmplitudeY = behaviorData.RotationAmplitudeY !== undefined ? behaviorData.RotationAmplitudeY : Number("5") || 0; + this._behaviorData.RotationAmplitudeZ = behaviorData.RotationAmplitudeZ !== undefined ? behaviorData.RotationAmplitudeZ : Number("5") || 0; + this._behaviorData.Time = Number("") || 0; + this._behaviorData.Duration = Number("") || 0; + this._behaviorData.StartEasingDuration = Number("") || 0; + this._behaviorData.StopEasingDuration = Number("") || 0; + this._behaviorData.Frequency = behaviorData.Frequency !== undefined ? behaviorData.Frequency : Number("") || 0; + this._behaviorData.DeltaX = Number("") || 0; + this._behaviorData.DeltaY = Number("") || 0; + this._behaviorData.DeltaZ = Number("") || 0; + this._behaviorData.DeltaAngleX = Number("") || 0; + this._behaviorData.DeltaAngleY = Number("") || 0; + this._behaviorData.DeltaAngleZ = Number("") || 0; + this._behaviorData.NoiseTime = Number("") || 0; + this._behaviorData.Object3D = behaviorData.Object3D !== undefined ? behaviorData.Object3D : ""; + this._behaviorData.IsStartingAtCreation = behaviorData.IsStartingAtCreation !== undefined ? behaviorData.IsStartingAtCreation : false; + } + + // Hot-reload: + updateFromBehaviorData(oldBehaviorData, newBehaviorData) { + + if (oldBehaviorData.TranslationAmplitudeX !== newBehaviorData.TranslationAmplitudeX) + this._behaviorData.TranslationAmplitudeX = newBehaviorData.TranslationAmplitudeX; + if (oldBehaviorData.TranslationAmplitudeY !== newBehaviorData.TranslationAmplitudeY) + this._behaviorData.TranslationAmplitudeY = newBehaviorData.TranslationAmplitudeY; + if (oldBehaviorData.TranslationAmplitudeZ !== newBehaviorData.TranslationAmplitudeZ) + this._behaviorData.TranslationAmplitudeZ = newBehaviorData.TranslationAmplitudeZ; + if (oldBehaviorData.RotationAmplitudeX !== newBehaviorData.RotationAmplitudeX) + this._behaviorData.RotationAmplitudeX = newBehaviorData.RotationAmplitudeX; + if (oldBehaviorData.RotationAmplitudeY !== newBehaviorData.RotationAmplitudeY) + this._behaviorData.RotationAmplitudeY = newBehaviorData.RotationAmplitudeY; + if (oldBehaviorData.RotationAmplitudeZ !== newBehaviorData.RotationAmplitudeZ) + this._behaviorData.RotationAmplitudeZ = newBehaviorData.RotationAmplitudeZ; + if (oldBehaviorData.Time !== newBehaviorData.Time) + this._behaviorData.Time = newBehaviorData.Time; + if (oldBehaviorData.Duration !== newBehaviorData.Duration) + this._behaviorData.Duration = newBehaviorData.Duration; + if (oldBehaviorData.StartEasingDuration !== newBehaviorData.StartEasingDuration) + this._behaviorData.StartEasingDuration = newBehaviorData.StartEasingDuration; + if (oldBehaviorData.StopEasingDuration !== newBehaviorData.StopEasingDuration) + this._behaviorData.StopEasingDuration = newBehaviorData.StopEasingDuration; + if (oldBehaviorData.Frequency !== newBehaviorData.Frequency) + this._behaviorData.Frequency = newBehaviorData.Frequency; + if (oldBehaviorData.DeltaX !== newBehaviorData.DeltaX) + this._behaviorData.DeltaX = newBehaviorData.DeltaX; + if (oldBehaviorData.DeltaY !== newBehaviorData.DeltaY) + this._behaviorData.DeltaY = newBehaviorData.DeltaY; + if (oldBehaviorData.DeltaZ !== newBehaviorData.DeltaZ) + this._behaviorData.DeltaZ = newBehaviorData.DeltaZ; + if (oldBehaviorData.DeltaAngleX !== newBehaviorData.DeltaAngleX) + this._behaviorData.DeltaAngleX = newBehaviorData.DeltaAngleX; + if (oldBehaviorData.DeltaAngleY !== newBehaviorData.DeltaAngleY) + this._behaviorData.DeltaAngleY = newBehaviorData.DeltaAngleY; + if (oldBehaviorData.DeltaAngleZ !== newBehaviorData.DeltaAngleZ) + this._behaviorData.DeltaAngleZ = newBehaviorData.DeltaAngleZ; + if (oldBehaviorData.NoiseTime !== newBehaviorData.NoiseTime) + this._behaviorData.NoiseTime = newBehaviorData.NoiseTime; + if (oldBehaviorData.Object3D !== newBehaviorData.Object3D) + this._behaviorData.Object3D = newBehaviorData.Object3D; + if (oldBehaviorData.IsStartingAtCreation !== newBehaviorData.IsStartingAtCreation) + this._behaviorData.IsStartingAtCreation = newBehaviorData.IsStartingAtCreation; + + return true; + } + + // Network sync: + getNetworkSyncData() { + return { + ...super.getNetworkSyncData(), + props: { + + TranslationAmplitudeX: this._behaviorData.TranslationAmplitudeX, + TranslationAmplitudeY: this._behaviorData.TranslationAmplitudeY, + TranslationAmplitudeZ: this._behaviorData.TranslationAmplitudeZ, + RotationAmplitudeX: this._behaviorData.RotationAmplitudeX, + RotationAmplitudeY: this._behaviorData.RotationAmplitudeY, + RotationAmplitudeZ: this._behaviorData.RotationAmplitudeZ, + Time: this._behaviorData.Time, + Duration: this._behaviorData.Duration, + StartEasingDuration: this._behaviorData.StartEasingDuration, + StopEasingDuration: this._behaviorData.StopEasingDuration, + Frequency: this._behaviorData.Frequency, + DeltaX: this._behaviorData.DeltaX, + DeltaY: this._behaviorData.DeltaY, + DeltaZ: this._behaviorData.DeltaZ, + DeltaAngleX: this._behaviorData.DeltaAngleX, + DeltaAngleY: this._behaviorData.DeltaAngleY, + DeltaAngleZ: this._behaviorData.DeltaAngleZ, + NoiseTime: this._behaviorData.NoiseTime, + Object3D: this._behaviorData.Object3D, + IsStartingAtCreation: this._behaviorData.IsStartingAtCreation, + } + }; + } + updateFromNetworkSyncData(networkSyncData) { + super.updateFromNetworkSyncData(networkSyncData); + + if (networkSyncData.props.TranslationAmplitudeX !== undefined) + this._behaviorData.TranslationAmplitudeX = networkSyncData.props.TranslationAmplitudeX; + if (networkSyncData.props.TranslationAmplitudeY !== undefined) + this._behaviorData.TranslationAmplitudeY = networkSyncData.props.TranslationAmplitudeY; + if (networkSyncData.props.TranslationAmplitudeZ !== undefined) + this._behaviorData.TranslationAmplitudeZ = networkSyncData.props.TranslationAmplitudeZ; + if (networkSyncData.props.RotationAmplitudeX !== undefined) + this._behaviorData.RotationAmplitudeX = networkSyncData.props.RotationAmplitudeX; + if (networkSyncData.props.RotationAmplitudeY !== undefined) + this._behaviorData.RotationAmplitudeY = networkSyncData.props.RotationAmplitudeY; + if (networkSyncData.props.RotationAmplitudeZ !== undefined) + this._behaviorData.RotationAmplitudeZ = networkSyncData.props.RotationAmplitudeZ; + if (networkSyncData.props.Time !== undefined) + this._behaviorData.Time = networkSyncData.props.Time; + if (networkSyncData.props.Duration !== undefined) + this._behaviorData.Duration = networkSyncData.props.Duration; + if (networkSyncData.props.StartEasingDuration !== undefined) + this._behaviorData.StartEasingDuration = networkSyncData.props.StartEasingDuration; + if (networkSyncData.props.StopEasingDuration !== undefined) + this._behaviorData.StopEasingDuration = networkSyncData.props.StopEasingDuration; + if (networkSyncData.props.Frequency !== undefined) + this._behaviorData.Frequency = networkSyncData.props.Frequency; + if (networkSyncData.props.DeltaX !== undefined) + this._behaviorData.DeltaX = networkSyncData.props.DeltaX; + if (networkSyncData.props.DeltaY !== undefined) + this._behaviorData.DeltaY = networkSyncData.props.DeltaY; + if (networkSyncData.props.DeltaZ !== undefined) + this._behaviorData.DeltaZ = networkSyncData.props.DeltaZ; + if (networkSyncData.props.DeltaAngleX !== undefined) + this._behaviorData.DeltaAngleX = networkSyncData.props.DeltaAngleX; + if (networkSyncData.props.DeltaAngleY !== undefined) + this._behaviorData.DeltaAngleY = networkSyncData.props.DeltaAngleY; + if (networkSyncData.props.DeltaAngleZ !== undefined) + this._behaviorData.DeltaAngleZ = networkSyncData.props.DeltaAngleZ; + if (networkSyncData.props.NoiseTime !== undefined) + this._behaviorData.NoiseTime = networkSyncData.props.NoiseTime; + if (networkSyncData.props.Object3D !== undefined) + this._behaviorData.Object3D = networkSyncData.props.Object3D; + if (networkSyncData.props.IsStartingAtCreation !== undefined) + this._behaviorData.IsStartingAtCreation = networkSyncData.props.IsStartingAtCreation; + } + + // Properties: + + _getTranslationAmplitudeX() { + return this._behaviorData.TranslationAmplitudeX !== undefined ? this._behaviorData.TranslationAmplitudeX : Number("0") || 0; + } + _setTranslationAmplitudeX(newValue) { + this._behaviorData.TranslationAmplitudeX = newValue; + } + _getTranslationAmplitudeY() { + return this._behaviorData.TranslationAmplitudeY !== undefined ? this._behaviorData.TranslationAmplitudeY : Number("0") || 0; + } + _setTranslationAmplitudeY(newValue) { + this._behaviorData.TranslationAmplitudeY = newValue; + } + _getTranslationAmplitudeZ() { + return this._behaviorData.TranslationAmplitudeZ !== undefined ? this._behaviorData.TranslationAmplitudeZ : Number("0") || 0; + } + _setTranslationAmplitudeZ(newValue) { + this._behaviorData.TranslationAmplitudeZ = newValue; + } + _getRotationAmplitudeX() { + return this._behaviorData.RotationAmplitudeX !== undefined ? this._behaviorData.RotationAmplitudeX : Number("5") || 0; + } + _setRotationAmplitudeX(newValue) { + this._behaviorData.RotationAmplitudeX = newValue; + } + _getRotationAmplitudeY() { + return this._behaviorData.RotationAmplitudeY !== undefined ? this._behaviorData.RotationAmplitudeY : Number("5") || 0; + } + _setRotationAmplitudeY(newValue) { + this._behaviorData.RotationAmplitudeY = newValue; + } + _getRotationAmplitudeZ() { + return this._behaviorData.RotationAmplitudeZ !== undefined ? this._behaviorData.RotationAmplitudeZ : Number("5") || 0; + } + _setRotationAmplitudeZ(newValue) { + this._behaviorData.RotationAmplitudeZ = newValue; + } + _getTime() { + return this._behaviorData.Time !== undefined ? this._behaviorData.Time : Number("") || 0; + } + _setTime(newValue) { + this._behaviorData.Time = newValue; + } + _getDuration() { + return this._behaviorData.Duration !== undefined ? this._behaviorData.Duration : Number("") || 0; + } + _setDuration(newValue) { + this._behaviorData.Duration = newValue; + } + _getStartEasingDuration() { + return this._behaviorData.StartEasingDuration !== undefined ? this._behaviorData.StartEasingDuration : Number("") || 0; + } + _setStartEasingDuration(newValue) { + this._behaviorData.StartEasingDuration = newValue; + } + _getStopEasingDuration() { + return this._behaviorData.StopEasingDuration !== undefined ? this._behaviorData.StopEasingDuration : Number("") || 0; + } + _setStopEasingDuration(newValue) { + this._behaviorData.StopEasingDuration = newValue; + } + _getFrequency() { + return this._behaviorData.Frequency !== undefined ? this._behaviorData.Frequency : Number("") || 0; + } + _setFrequency(newValue) { + this._behaviorData.Frequency = newValue; + } + _getDeltaX() { + return this._behaviorData.DeltaX !== undefined ? this._behaviorData.DeltaX : Number("") || 0; + } + _setDeltaX(newValue) { + this._behaviorData.DeltaX = newValue; + } + _getDeltaY() { + return this._behaviorData.DeltaY !== undefined ? this._behaviorData.DeltaY : Number("") || 0; + } + _setDeltaY(newValue) { + this._behaviorData.DeltaY = newValue; + } + _getDeltaZ() { + return this._behaviorData.DeltaZ !== undefined ? this._behaviorData.DeltaZ : Number("") || 0; + } + _setDeltaZ(newValue) { + this._behaviorData.DeltaZ = newValue; + } + _getDeltaAngleX() { + return this._behaviorData.DeltaAngleX !== undefined ? this._behaviorData.DeltaAngleX : Number("") || 0; + } + _setDeltaAngleX(newValue) { + this._behaviorData.DeltaAngleX = newValue; + } + _getDeltaAngleY() { + return this._behaviorData.DeltaAngleY !== undefined ? this._behaviorData.DeltaAngleY : Number("") || 0; + } + _setDeltaAngleY(newValue) { + this._behaviorData.DeltaAngleY = newValue; + } + _getDeltaAngleZ() { + return this._behaviorData.DeltaAngleZ !== undefined ? this._behaviorData.DeltaAngleZ : Number("") || 0; + } + _setDeltaAngleZ(newValue) { + this._behaviorData.DeltaAngleZ = newValue; + } + _getNoiseTime() { + return this._behaviorData.NoiseTime !== undefined ? this._behaviorData.NoiseTime : Number("") || 0; + } + _setNoiseTime(newValue) { + this._behaviorData.NoiseTime = newValue; + } + _getObject3D() { + return this._behaviorData.Object3D !== undefined ? this._behaviorData.Object3D : ""; + } + _setObject3D(newValue) { + this._behaviorData.Object3D = newValue; + } + _getIsStartingAtCreation() { + return this._behaviorData.IsStartingAtCreation !== undefined ? this._behaviorData.IsStartingAtCreation : false; + } + _setIsStartingAtCreation(newValue) { + this._behaviorData.IsStartingAtCreation = newValue; + } + _toggleIsStartingAtCreation() { + this._setIsStartingAtCreation(!this._getIsStartingAtCreation()); + } +} + +/** + * Shared data generated from 3D shake + */ +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.SharedData = class ShakeModel3DSharedData { + constructor(sharedData) { + + this.EasingFactor = Number("") || 0; + } + + // Shared properties: + + _getEasingFactor() { + return this.EasingFactor !== undefined ? this.EasingFactor : Number("") || 0; + } + _setEasingFactor(newValue) { + this.EasingFactor = newValue; + } +} + +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._ShakeObject3D_ShakeModel3DSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._ShakeObject3D_ShakeModel3DSharedData = new gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.SharedData( + initialData + ); + } + return instanceContainer._ShakeObject3D_ShakeModel3DSharedData; +} + +// Methods: +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.onCreatedContext = {}; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.onCreatedContext.GDObjectObjects1= []; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.onCreatedContext.GDObjectObjects2= []; + + +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.onCreatedContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.onCreatedContext.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.onCreatedContext.GDObjectObjects1.length;i 0 ) { + isConditionTrue_0 = true; + gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsShakingContext.GDObjectObjects1[k] = gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsShakingContext.GDObjectObjects1[i]; + ++k; + } +} +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsShakingContext.GDObjectObjects1.length = k; +} +if (isConditionTrue_0) { +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = true; }}} + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsShaking = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsShakingContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsShakingContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsShakingContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsShakingContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsShakingContext.GDObjectObjects2.length = 0; + + +return !!eventsFunctionContext.returnValue; +} +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsStoppingContext = {}; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsStoppingContext.GDObjectObjects1= []; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsStoppingContext.GDObjectObjects2= []; + + +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsStoppingContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsStoppingContext.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.IsStoppingContext.GDObjectObjects1.length;i 0 ) { + isConditionTrue_0 = true; + gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StartEasingFactorContext.GDObjectObjects1[k] = gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StartEasingFactorContext.GDObjectObjects1[i]; + ++k; + } +} +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StartEasingFactorContext.GDObjectObjects1.length = k; +if (isConditionTrue_0) { +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp(eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getTime() / eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getStartEasingDuration(), 0, 1); }}} + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StartEasingFactor = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StartEasingFactorContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StartEasingFactorContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StartEasingFactorContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StartEasingFactorContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StartEasingFactorContext.GDObjectObjects2.length = 0; + + +return Number(eventsFunctionContext.returnValue) || 0; +} +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext = {}; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects1= []; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects2= []; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects3= []; + + +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects1, gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects2); + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects2.length;i= eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getDuration() ) { + isConditionTrue_0 = true; + gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects1[k] = gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects1[i]; + ++k; + } +} +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects1.length = k; +if (isConditionTrue_0) { +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = 0; }}} + +} + + +};gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects1.length;i 0 ) { + isConditionTrue_0 = true; + gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects1[k] = gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects1[i]; + ++k; + } +} +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects1.length = k; +if (isConditionTrue_0) { +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = gdjs.evtTools.common.clamp((eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getDuration() - eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getTime()) / eventsFunctionContext.getObjects("Object")[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getStopEasingDuration(), 0, 1); }}} + +} + + +}; + +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactor = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("ShakeObject3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("ShakeObject3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects3.length = 0; + +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.eventsList1(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects2.length = 0; +gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D.prototype.StopEasingFactorContext.GDObjectObjects3.length = 0; + + +return Number(eventsFunctionContext.returnValue) || 0; +} + + +gdjs.registerBehavior("ShakeObject3D::ShakeModel3D", gdjs.evtsExt__ShakeObject3D__ShakeModel3D.ShakeModel3D); diff --git a/gdjs-evtsext__sticker__definehelperclasses-func.js b/gdjs-evtsext__sticker__definehelperclasses-func.js new file mode 100644 index 0000000000000000000000000000000000000000..23b483516a1866acaebc51cf4e218dafe6e6f20a --- /dev/null +++ b/gdjs-evtsext__sticker__definehelperclasses-func.js @@ -0,0 +1,306 @@ + +if (typeof gdjs.evtsExt__Sticker__DefineHelperClasses !== "undefined") { + gdjs.evtsExt__Sticker__DefineHelperClasses.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Sticker__DefineHelperClasses = {}; + + +gdjs.evtsExt__Sticker__DefineHelperClasses.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +if (gdjs._stickerExtension) { + return; +} + +// Unstick from deleted objects. +gdjs.registerObjectDeletedFromSceneCallback(function (runtimeScene, deletedObject) { + const extension = runtimeScene._stickerExtension; + if (!extension) { + return; + } + const allStickers = runtimeScene._stickerExtension.allStickers; + for (const behavior of allStickers) { + const sticker = behavior._sticker; + if (sticker.isStuckTo(deletedObject)) { + if (behavior._getIsDestroyedWithParent()) { + behavior.owner.deleteFromScene(runtimeScene); + } + sticker.unstick(); + } + } +}); + +class Sticker { + /** @type {gdjs.RuntimeBehavior} */ + behavior; + /** @type {gdjs.RuntimeObject | null} */ + basisObject; + followingDoneThisFrame = false; + relativeX = 0; + relativeY = 0; + relativeAngle = 0; + relativeRotatedX = 0; + relativeRotatedY = 0; + basisOldX = 0; + basisOldY = 0; + basisOldAngle = 0; + basisOldWidth = 0; + basisOldHeight = 0; + basisOldCenterXInScene = 0; + basisOldCenterYInScene = 0; + + /** + * @param {gdjs.RuntimeBehavior} behavior + */ + constructor(behavior) { + this.behavior = behavior; + } + + /** + * @param {gdjs.RuntimeObject} basisObject + */ + isStuckTo(basisObject) { + return this.basisObject === basisObject; + } + + /** + * @param {gdjs.RuntimeObject} basisObject + */ + stickTo(basisObject) { + this.basisObject = basisObject; + this.updateOldCoordinates(); + this.updateRelativeCoordinates(); + } + + unstick() { + this.basisObject = null; + } + + onStepPreEvents() { + this.followingDoneThisFrame = false; + } + + /** + * Update the coordinates in the basisObject basis. + * + * It uses the basisObject coordinates from the previous frame. + * This way, the sticker can move relatively to it and still + * follow basisObject. + * + * @param {gdjs.RuntimeObject} basisObject + */ + updateRelativeCoordinates() { + const object = this.behavior.owner; + + // Update relative coordinates + this.relativeX = object.getX() - this.basisOldX; + this.relativeY = object.getY() - this.basisOldY; + if (!this.behavior._getOnlyFollowPosition()) { + this.relativeAngle = object.getAngle() - this.basisOldAngle; + this.relativeWidth = object.getWidth() / this.basisOldWidth; + this.relativeHeight = object.getHeight() / this.basisOldHeight; + const deltaX = object.getCenterXInScene() - this.basisOldCenterXInScene; + const deltaY = object.getCenterYInScene() - this.basisOldCenterYInScene; + const angle = this.basisOldAngle * Math.PI / 180; + this.relativeRotatedX = (deltaX * Math.cos(angle) + deltaY * Math.sin(angle)) / this.basisOldWidth; + this.relativeRotatedY = (-deltaX * Math.sin(angle) + deltaY * Math.cos(angle)) / this.basisOldHeight; + + // Save initial values to avoid calculus and rounding errors + this.basisOriginalWidth = this.basisObject.getWidth(); + this.basisOriginalHeight = this.basisObject.getHeight(); + this.basisOriginalAngle = this.basisObject.getAngle(); + } + } + + /** + * Copy the coordinates to use it the next frame. + */ + updateOldCoordinates() { + const object = this.behavior.owner; + + this.ownerOldX = object.getX(); + this.ownerOldY = object.getY(); + + this.basisOldX = this.basisObject.getX(); + this.basisOldY = this.basisObject.getY(); + + if (!this.behavior._getOnlyFollowPosition()) { + this.ownerOldAngle = object.getAngle(); + this.ownerOldWidth = object.getWidth(); + this.ownerOldHeight = object.getHeight(); + + this.basisOldAngle = this.basisObject.getAngle(); + this.basisOldWidth = this.basisObject.getWidth(); + this.basisOldHeight = this.basisObject.getHeight(); + this.basisOldCenterXInScene = this.basisObject.getCenterXInScene(); + this.basisOldCenterYInScene = this.basisObject.getCenterYInScene(); + } + } + + /** + * Follow the basisObject (called in doStepPostEvents). + * + * This method is also called by children to ensure + * parents are updated first. + */ + followBasisObject() { + if (this.followingDoneThisFrame) { + return; + } + this.followingDoneThisFrame = true; + const basisObject = this.basisObject; + if (basisObject) { + // If the behavior on the basis object has a different name, + // the objects will still follow their basis objects + // but frame delays could happen. + const behaviorName = this.behavior.getName(); + if (basisObject.hasBehavior(behaviorName)) { + const basisBehavior = basisObject.getBehavior(behaviorName); + if (basisBehavior.type === this.behavior.type) { + // Follow parents 1st to avoid frame delays + basisBehavior._sticker.followBasisObject(); + } + } + + const object = this.behavior.owner; + + if (this.behavior._getOnlyFollowPosition()) { + if (object.getX() !== this.ownerOldX + || object.getY() !== this.ownerOldY) { + this.updateRelativeCoordinates(); + } + + if (this.basisOldX !== basisObject.getX() || + this.basisOldY !== basisObject.getY()) { + object.setPosition( + basisObject.getX() + this.relativeX, + basisObject.getY() + this.relativeY); + } + } else { + if (object.getX() !== this.ownerOldX + || object.getY() !== this.ownerOldY + || object.getAngle() !== this.ownerOldAngle + || object.getWidth() !== this.ownerOldWidth + || object.getHeight() !== this.ownerOldHeight) { + this.updateRelativeCoordinates(); + } + + // Follow basisObject + if (basisObject.getAngle() === this.basisOriginalAngle && this.basisOriginalAngle === 0) { + if (basisObject.getWidth() === this.basisOriginalWidth || + basisObject.getHeight() === this.basisOriginalHeight) { + if (this.basisOldX !== basisObject.getX() || + this.basisOldY !== basisObject.getY()) { + object.setPosition( + basisObject.getX() + this.relativeX, + basisObject.getY() + this.relativeY); + } + } else { + object.setCenterPositionInScene( + basisObject.getCenterXInScene() + this.relativeRotatedX * basisObject.getWidth(), + basisObject.getCenterYInScene() + this.relativeRotatedY * basisObject.getHeight()); + } + } else { + object.setAngle(basisObject.getAngle() + this.relativeAngle); + + const deltaX = this.relativeRotatedX * basisObject.getWidth(); + const deltaY = this.relativeRotatedY * basisObject.getHeight(); + const angle = -basisObject.getAngle() * Math.PI / 180; + object.setX(basisObject.getCenterXInScene() + object.getX() - object.getCenterXInScene() + deltaX * Math.cos(angle) + deltaY * Math.sin(angle)); + object.setY(basisObject.getCenterYInScene() + object.getY() - object.getCenterYInScene() - deltaX * Math.sin(angle) + deltaY * Math.cos(angle)); + } + // Unproportional dimensions changes won't work as expected + // if the object angle is not null but nothing more can be done + // because there is no full affine transformation on objects. + if (basisObject.getWidth() !== this.basisOriginalWidth) { + object.setWidth(this.relativeWidth * basisObject.getWidth()); + } + if (basisObject.getHeight() !== this.basisOriginalHeight) { + object.setHeight(this.relativeHeight * basisObject.getHeight()); + } + } + + this.updateOldCoordinates(); + } + } +} + +gdjs._stickerExtension = { + Sticker +} +}; +gdjs.evtsExt__Sticker__DefineHelperClasses.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Sticker__DefineHelperClasses.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Sticker__DefineHelperClasses.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Sticker"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Sticker"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Sticker__DefineHelperClasses.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__Sticker__DefineHelperClasses.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__sticker__isstuck-func.js b/gdjs-evtsext__sticker__isstuck-func.js new file mode 100644 index 0000000000000000000000000000000000000000..b9db94627be53343faa6d392461ae4b2da9a8495 --- /dev/null +++ b/gdjs-evtsext__sticker__isstuck-func.js @@ -0,0 +1,112 @@ + +if (typeof gdjs.evtsExt__Sticker__IsStuck !== "undefined") { + gdjs.evtsExt__Sticker__IsStuck.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Sticker__IsStuck = {}; +gdjs.evtsExt__Sticker__IsStuck.GDObjectObjects1= []; +gdjs.evtsExt__Sticker__IsStuck.GDBasisObjectObjects1= []; + + +gdjs.evtsExt__Sticker__IsStuck.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const stickerBehaviorName = eventsFunctionContext.getBehaviorName("Behavior"); +/** @type {Hashtable} */ +const stickerObjectsLists = eventsFunctionContext.getObjectsLists("Object"); +/** @type {Hashtable} */ +const basisObjectsLists = eventsFunctionContext.getObjectsLists("BasisObject"); + +eventsFunctionContext.returnValue = gdjs.evtTools.object.twoListsTest( + (stickerObject, basisObject) => { + const sticker = stickerObject.getBehavior(stickerBehaviorName)._sticker; + return sticker.isStuckTo(basisObject); + }, + stickerObjectsLists, + basisObjectsLists, + false +); +}; +gdjs.evtsExt__Sticker__IsStuck.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Sticker__IsStuck.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Sticker__IsStuck.func = function(runtimeScene, Object, Behavior, BasisObject, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +, "BasisObject": BasisObject +}, + _objectArraysMap: { +"Object": gdjs.objectsListsToArray(Object) +, "BasisObject": gdjs.objectsListsToArray(BasisObject) +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Sticker"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Sticker"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + +gdjs.evtsExt__Sticker__IsStuck.GDObjectObjects1.length = 0; +gdjs.evtsExt__Sticker__IsStuck.GDBasisObjectObjects1.length = 0; + +gdjs.evtsExt__Sticker__IsStuck.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Sticker__IsStuck.GDObjectObjects1.length = 0; +gdjs.evtsExt__Sticker__IsStuck.GDBasisObjectObjects1.length = 0; + + +return !!eventsFunctionContext.returnValue; +} + +gdjs.evtsExt__Sticker__IsStuck.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__sticker__sticker.js b/gdjs-evtsext__sticker__sticker.js new file mode 100644 index 0000000000000000000000000000000000000000..e1fc5debd4378089c365fd2eff4433eadac6edf1 --- /dev/null +++ b/gdjs-evtsext__sticker__sticker.js @@ -0,0 +1,720 @@ + +gdjs.evtsExt__Sticker__Sticker = gdjs.evtsExt__Sticker__Sticker || {}; + +/** + * Behavior generated from Sticker + */ +gdjs.evtsExt__Sticker__Sticker.Sticker = class Sticker extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__Sticker__Sticker.Sticker.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.OnlyFollowPosition = behaviorData.OnlyFollowPosition !== undefined ? behaviorData.OnlyFollowPosition : false; + this._behaviorData.IsDestroyedWithParent = behaviorData.IsDestroyedWithParent !== undefined ? behaviorData.IsDestroyedWithParent : false; + } + + // Hot-reload: + updateFromBehaviorData(oldBehaviorData, newBehaviorData) { + + if (oldBehaviorData.OnlyFollowPosition !== newBehaviorData.OnlyFollowPosition) + this._behaviorData.OnlyFollowPosition = newBehaviorData.OnlyFollowPosition; + if (oldBehaviorData.IsDestroyedWithParent !== newBehaviorData.IsDestroyedWithParent) + this._behaviorData.IsDestroyedWithParent = newBehaviorData.IsDestroyedWithParent; + + return true; + } + + // Network sync: + getNetworkSyncData() { + return { + ...super.getNetworkSyncData(), + props: { + + OnlyFollowPosition: this._behaviorData.OnlyFollowPosition, + IsDestroyedWithParent: this._behaviorData.IsDestroyedWithParent, + } + }; + } + updateFromNetworkSyncData(networkSyncData) { + super.updateFromNetworkSyncData(networkSyncData); + + if (networkSyncData.props.OnlyFollowPosition !== undefined) + this._behaviorData.OnlyFollowPosition = networkSyncData.props.OnlyFollowPosition; + if (networkSyncData.props.IsDestroyedWithParent !== undefined) + this._behaviorData.IsDestroyedWithParent = networkSyncData.props.IsDestroyedWithParent; + } + + // Properties: + + _getOnlyFollowPosition() { + return this._behaviorData.OnlyFollowPosition !== undefined ? this._behaviorData.OnlyFollowPosition : false; + } + _setOnlyFollowPosition(newValue) { + this._behaviorData.OnlyFollowPosition = newValue; + } + _toggleOnlyFollowPosition() { + this._setOnlyFollowPosition(!this._getOnlyFollowPosition()); + } + _getIsDestroyedWithParent() { + return this._behaviorData.IsDestroyedWithParent !== undefined ? this._behaviorData.IsDestroyedWithParent : false; + } + _setIsDestroyedWithParent(newValue) { + this._behaviorData.IsDestroyedWithParent = newValue; + } + _toggleIsDestroyedWithParent() { + this._setIsDestroyedWithParent(!this._getIsDestroyedWithParent()); + } +} + +/** + * Shared data generated from Sticker + */ +gdjs.evtsExt__Sticker__Sticker.Sticker.SharedData = class StickerSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__Sticker__Sticker.Sticker.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._Sticker_StickerSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._Sticker_StickerSharedData = new gdjs.evtsExt__Sticker__Sticker.Sticker.SharedData( + initialData + ); + } + return instanceContainer._Sticker_StickerSharedData; +} + +// Methods: +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onCreatedContext = {}; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onCreatedContext.GDObjectObjects1= []; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onCreatedContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onCreatedContext.userFunc0xa13d90 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +const Sticker = gdjs._stickerExtension.Sticker; + +const behaviorName = eventsFunctionContext.getBehaviorName("Behavior"); +const object = objects[0]; +const behavior = object.getBehavior(behaviorName); + +behavior._sticker = new Sticker(behavior); + +// Set up the scene sticker objects list - if not done already. +runtimeScene._stickerExtension = runtimeScene._stickerExtension || { + allStickers: new Set(), +}; +// Register this object as a sticker. +runtimeScene._stickerExtension.allStickers.add(behavior); + +}; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onCreatedContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +{gdjs.evtsExt__Sticker__DefineHelperClasses.func(runtimeScene, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +}} + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onCreatedContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onCreatedContext.GDObjectObjects1); +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onCreatedContext.userFunc0xa13d90(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onCreated = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Sticker"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Sticker"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onCreatedContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onCreatedContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onCreatedContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPreEventsContext = {}; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPreEventsContext.GDObjectObjects1= []; + + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPreEventsContext.userFunc0xcb5dc0 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +const behaviorName = eventsFunctionContext.getBehaviorName("Behavior"); +const object = objects[0]; +const behavior = object.getBehavior(behaviorName); + +behavior._sticker.onStepPreEvents(); +}; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPreEventsContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPreEventsContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPreEventsContext.GDObjectObjects1); +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPreEventsContext.userFunc0xcb5dc0(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPreEvents = function(parentEventsFunctionContext) { +this._onceTriggers.startNewFrame(); +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Sticker"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Sticker"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPreEventsContext.GDObjectObjects1.length = 0; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPreEventsContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPreEventsContext.GDObjectObjects1.length = 0; + + +return; +} +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPostEventsContext = {}; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPostEventsContext.GDObjectObjects1= []; + + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPostEventsContext.userFunc0xa13d90 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +const behaviorName = eventsFunctionContext.getBehaviorName("Behavior"); +const object = objects[0]; +const behavior = object.getBehavior(behaviorName); + +behavior._sticker.followBasisObject(); +}; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPostEventsContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPostEventsContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPostEventsContext.GDObjectObjects1); +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPostEventsContext.userFunc0xa13d90(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPostEvents = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Sticker"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Sticker"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPostEventsContext.GDObjectObjects1.length = 0; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPostEventsContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.doStepPostEventsContext.GDObjectObjects1.length = 0; + + +return; +} +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.StickContext = {}; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.StickContext.GDObjectObjects1= []; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.StickContext.GDBasisObjectObjects1= []; + + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.StickContext.userFunc0xca8b48 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +const object = objects[0]; +const behaviorName = eventsFunctionContext.getBehaviorName("Behavior"); +const basisObjects = eventsFunctionContext.getObjects("BasisObject"); + +if (basisObjects.length === 0) return; +// An object can stick to only one object. +const basisObject = basisObjects[0]; +object.getBehavior(behaviorName)._sticker.stickTo(basisObject); + +}; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.StickContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.StickContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.StickContext.GDObjectObjects1); +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.StickContext.userFunc0xca8b48(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.Stick = function(BasisObject, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +, "BasisObject": BasisObject +}, + _objectArraysMap: { +"Object": thisObjectList +, "BasisObject": gdjs.objectsListsToArray(BasisObject) +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Sticker"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Sticker"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.StickContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.StickContext.GDBasisObjectObjects1.length = 0; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.StickContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.StickContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.StickContext.GDBasisObjectObjects1.length = 0; + + +return; +} +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.UnstickContext = {}; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.UnstickContext.GDObjectObjects1= []; + + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.UnstickContext.userFunc0xa13d90 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +const object = objects[0]; +const behaviorName = eventsFunctionContext.getBehaviorName("Behavior"); +const behavior = object.getBehavior(behaviorName); + +object.getBehavior(behaviorName)._sticker.unstick(); + +}; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.UnstickContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.UnstickContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.UnstickContext.GDObjectObjects1); +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.UnstickContext.userFunc0xa13d90(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.Unstick = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Sticker"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Sticker"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.UnstickContext.GDObjectObjects1.length = 0; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.UnstickContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.UnstickContext.GDObjectObjects1.length = 0; + + +return; +} +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onDestroyContext = {}; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onDestroyContext.GDObjectObjects1= []; + + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onDestroyContext.userFunc0xa13d90 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +const behaviorName = eventsFunctionContext.getBehaviorName("Behavior"); +const object = objects[0]; +const behavior = object.getBehavior(behaviorName); + +runtimeScene._stickerExtension.allStickers.delete(behavior._sticker); + +}; +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onDestroyContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onDestroyContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onDestroyContext.GDObjectObjects1); +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onDestroyContext.userFunc0xa13d90(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onDestroy = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Sticker"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Sticker"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onDestroyContext.GDObjectObjects1.length = 0; + +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onDestroyContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Sticker__Sticker.Sticker.prototype.onDestroyContext.GDObjectObjects1.length = 0; + + +return; +} + + +gdjs.registerBehavior("Sticker::Sticker", gdjs.evtsExt__Sticker__Sticker.Sticker); diff --git a/gdjs-evtsext__topdowncornersliding__definejavascriptfortopdown-func.js b/gdjs-evtsext__topdowncornersliding__definejavascriptfortopdown-func.js new file mode 100644 index 0000000000000000000000000000000000000000..ebda211993de8f3f93ea9f03c832f7ced87cba02 --- /dev/null +++ b/gdjs-evtsext__topdowncornersliding__definejavascriptfortopdown-func.js @@ -0,0 +1,1313 @@ + +if (typeof gdjs.evtsExt__TopDownCornerSliding__DefineJavaScriptForTopDown !== "undefined") { + gdjs.evtsExt__TopDownCornerSliding__DefineJavaScriptForTopDown.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__TopDownCornerSliding__DefineJavaScriptForTopDown = {}; + + +gdjs.evtsExt__TopDownCornerSliding__DefineJavaScriptForTopDown.userFunc0xd4aa58 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +if (gdjs.__topDownCornerSlidingExtension) { + return; +} + +// TODO Remove this when afterPositionUpdate is added to the hook interface. +gdjs.TopDownMovementRuntimeBehavior.prototype.actuallyDoStepPreEvents = gdjs.TopDownMovementRuntimeBehavior.prototype.doStepPreEvents; +gdjs.TopDownMovementRuntimeBehavior.prototype.doStepPreEvents = function (instanceContainer) { + this.actuallyDoStepPreEvents(instanceContainer); + + for (const topDownMovementHook of this._topDownMovementHooks) { + if (topDownMovementHook.afterPositionUpdateTODO) { + topDownMovementHook.afterPositionUpdateTODO(null); + } + } +} + +const deltasX = [1, 1, 0, -1, -1, -1, 0, 1]; +const deltasY = [0, 1, 1, 1, 0, -1, -1, -1]; +const temporaryPointForTransformations = [0, 0]; +const epsilon = 0.015625; + +/** + * {number} a + * {number} b + * {return {boolean}} + */ +const almostEquals = (a, b) => { + return b - epsilon < a && a < b + epsilon; +} + +class CornerSlider { + + /** + * @param {gdjs.RuntimeInstanceContainer} instanceContainer + * @param {gdjs.RuntimeBehavior} behavior + * @param {gdjs.TopDownMovementRuntimeBehavior} topDownBehavior + */ + constructor(instanceContainer, behavior, topDownBehavior) { + this.instanceContainer = instanceContainer; + this.behavior = behavior; + this.topDownBehavior = topDownBehavior; + + topDownBehavior.registerHook(this); + + /** + * Obstacles near the object, updated with _updatePotentialCollidingObjects. + * @type {Obstacle[]} + */ + this.potentialCollidingObjects = []; + /** @type {gdjs.RuntimeObject[]} */ + this.collidingObjects = []; + this.obstacleManager = getManager(instanceContainer); + + // Remember the decision to bypass an obstacle... + this.lastAnyObstacle = false; + this.needToCheckBypassWay = true; + + // ...and the context of that decision + this.lastAssistanceDirection = -1; + this.lastDirection = -1; + + /** @type {FloatPoint} */ + this.transformedPosition = [0, 0]; + /** @type {gdjs.AABB} */ + this.relativeHitBoxesAABB = { min: [0, 0], max: [0, 0] }; + /** @type {gdjs.AABB} */ + this.absoluteHitBoxesAABB = { min: [0, 0], max: [0, 0] }; + this.hitBoxesAABBUpToDate = false; + this.oldWidth = 0; + this.oldHeight = 0; + this.previousX = 0; + this.previousY = 0; + + /** @type {AssistanceResult} */ + this.result = new AssistanceResult(); + } + + /** + * Return the direction to use instead of the direction given in + * parameter. + * @param {gdjs.TopDownMovementRuntimeBehavior.TopDownMovementHookContext} context + * @return {number} + */ + overrideDirection(context) { + let direction = context.getDirection(); + if (!this.behavior.activated()) { + return direction; + } + + const object = this.topDownBehavior.owner; + // Check if the object has moved + // To avoid to loop on the transform and its inverse + // because of float approximation. + const position = temporaryPointForTransformations; + // TODO Handle isometry + // if (this.topDownBehavior._basisTransformation) { + // this.topDownBehavior._basisTransformation.toScreen( + // this.transformedPosition, + // position + // ); + // } else { + position[0] = this.transformedPosition[0]; + position[1] = this.transformedPosition[1]; + // } + if (object.getX() !== position[0] || object.getY() !== position[1]) { + position[0] = object.getX(); + position[1] = object.getY(); + // TODO Handle isometry + // if (this.topDownBehavior._basisTransformation) { + // this.topDownBehavior._basisTransformation.toWorld( + // position, + // this.transformedPosition + // ); + // } else { + this.transformedPosition[0] = position[0]; + this.transformedPosition[1] = position[1]; + // } + } + + const stickIsUsed = + this.topDownBehavior._stickForce !== 0 && direction === -1; + let inputDirection = 0; + if (stickIsUsed) { + inputDirection = this.getStickDirection(); + } else { + inputDirection = direction; + } + const assistanceDirection = this.suggestDirection( + inputDirection + ); + if (assistanceDirection !== -1) { + if (stickIsUsed) { + this.topDownBehavior._stickAngle = assistanceDirection * 45; + } + return assistanceDirection; + } + return direction; + } + + /** + * Called before the acceleration and new direction is applied to the + * velocity. + * @param {gdjs.TopDownMovementRuntimeBehavior.TopDownMovementHookContext} context + */ + beforeSpeedUpdate(context) { } + + /** + * Called before the velocity is applied to the object position and + * angle. + */ + beforePositionUpdate() { + if (!this.behavior.activated()) { + return; + } + + const object = this.topDownBehavior.owner; + this.previousX = object.getX(); + this.previousY = object.getY(); + } + + // TODO Rename this methode to the new hook interface method. + afterPositionUpdateTODO() { + if (!this.behavior.activated()) { + return; + } + + const object = this.topDownBehavior.owner; + const point = temporaryPointForTransformations; + point[0] = object.getX() - this.previousX; + point[1] = object.getY() - this.previousY; + // TODO Handle isometry + // if (this.topDownBehavior._basisTransformation) { + // this.topDownBehavior._basisTransformation.toWorld(point, point); + // } + this.shift(point[0], point[1]); + + this.applyCollision(); + + const position = temporaryPointForTransformations; + + // TODO Handle isometry + // if (this.topDownBehavior._basisTransformation) { + // this.topDownBehavior._basisTransformation.toScreen( + // this.transformedPosition, + // position + // ); + // } else { + position[0] = this.transformedPosition[0]; + position[1] = this.transformedPosition[1]; + // } + object.setX(position[0]); + object.setY(position[1]); + } + + getStickDirection() { + let direction = + (this.topDownBehavior._stickAngle + + this.topDownBehavior._movementAngleOffset) / + 45; + direction = direction - Math.floor(direction / 8) * 8; + for (let strait = 0; strait < 8; strait += 2) { + if (strait - 0.125 < direction && direction < strait + 0.125) { + direction = strait; + } + if (strait + 0.125 <= direction && direction <= strait + 2 - 0.125) { + direction = strait + 1; + } + } + if (8 - 0.125 < direction) { + direction = 0; + } + return direction; + } + + /** Analyze the real intent of the player instead of applying the input blindly. + * @param {integer} direction + * @returns {integer} a direction that matches the player intents. + */ + suggestDirection(direction) { + this.needToCheckBypassWay = + this.needToCheckBypassWay || direction !== this.lastDirection; + + if (direction === -1) { + return this.noAssistance(); + } + + const object = this.topDownBehavior.owner; + if ( + object.getWidth() !== this.oldWidth || + object.getHeight() !== this.oldHeight + ) { + this.hitBoxesAABBUpToDate = false; + this.oldWidth = object.getWidth(); + this.oldHeight = object.getHeight(); + } + + // Compute the list of the objects that will be used + const timeDelta = object.getElapsedTime(this.instanceContainer) / 1000; + this.updatePotentialCollidingObjects( + 1 + this.topDownBehavior.getMaxSpeed() * timeDelta + ); + + const downKey = 1 <= direction && direction <= 3; + const leftKey = 3 <= direction && direction <= 5; + const upKey = 5 <= direction && direction <= 7; + const rightKey = direction <= 1 || 7 <= direction; + + // Used to align the player when the assistance make him bypass an obstacle + let stopMinX = Number.MAX_VALUE; + let stopMinY = Number.MAX_VALUE; + let stopMaxX = -Number.MAX_VALUE; + let stopMaxY = -Number.MAX_VALUE; + let isBypassX = false; + let isBypassY = false; + + // Incites of how the player should be assisted + let assistanceLeft = 0; + let assistanceRight = 0; + let assistanceUp = 0; + let assistanceDown = 0; + + // the actual decision + let assistanceDirection = -1; + + const objectAABB = this.getHitBoxesAABB(); + const minX = objectAABB.min[0]; + const minY = objectAABB.min[1]; + const maxX = objectAABB.max[0]; + const maxY = objectAABB.max[1]; + const width = maxX - minX; + const height = maxY - minY; + + // This affectation has no meaning, it will be override. + /** @type {gdjs.AABB | null} */ + let bypassedObstacleAABB = null; + + this.collidingObjects.length = 0; + this.collidingObjects.push(object); + + for (var i = 0; i < this.potentialCollidingObjects.length; ++i) { + const obstacleBehavior = this.potentialCollidingObjects[i]; + const corner = obstacleBehavior.behavior._getSlidingCornerSize(); + const obstacle = obstacleBehavior.owner; + if (obstacle === object) { + continue; + } + + const obstacleAABB = obstacleBehavior.getHitBoxesAABB(); + const obstacleMinX = obstacleAABB.min[0]; + const obstacleMinY = obstacleAABB.min[1]; + const obstacleMaxX = obstacleAABB.max[0]; + const obstacleMaxY = obstacleAABB.max[1]; + + const deltaX = deltasX[direction]; + const deltaY = deltasY[direction]; + // Extends the box in the player direction + if ( + Math.max(maxX, Math.floor(maxX + deltaX)) > obstacleMinX && + Math.min(minX, Math.ceil(minX + deltaX)) < obstacleMaxX && + Math.max(maxY, Math.floor(maxY + deltaY)) > obstacleMinY && + Math.min(minY, Math.ceil(minY + deltaY)) < obstacleMaxY + ) { + this.collidingObjects.push(obstacle); + + // The player is corner to corner to the obstacle. + // The assistance will depend on other obstacles. + // Both direction are set and the actual to take + // is decided at the end. + if ( + almostEquals(maxX, obstacleMinX) && + almostEquals(maxY, obstacleMinY) + ) { + assistanceRight++; + assistanceDown++; + } else if ( + almostEquals(maxX, obstacleMinX) && + almostEquals(minY, obstacleMaxY) + ) { + assistanceRight++; + assistanceUp++; + } else if ( + almostEquals(minX, obstacleMaxX) && + almostEquals(minY, obstacleMaxY) + ) { + assistanceLeft++; + assistanceUp++; + } else if ( + almostEquals(minX, obstacleMaxX) && + almostEquals(maxY, obstacleMinY) + ) { + assistanceLeft++; + assistanceDown++; + } else if ( + (upKey && almostEquals(minY, obstacleMaxY)) || + (downKey && almostEquals(maxY, obstacleMinY)) + ) { + // The player is not on the corner of the obstacle. + // Set the assistance both ways to fall back in + // the same case as 2 obstacles side by side + // being collide with the player. + if ( + (rightKey || maxX > obstacleMinX + corner) && + minX < obstacleMaxX && + (leftKey || minX < obstacleMaxX - corner) && + maxX > obstacleMinX + ) { + assistanceLeft++; + assistanceRight++; + } + // The player is on the corner of the obstacle. + // (not the exact corner, see corner affectation) + else if ( + !rightKey && + obstacleMinX < maxX && + maxX <= obstacleMinX + corner && + // In case the cornerSize is bigger than the obstacle size, + // go the on the shortest side. + (leftKey || minX + maxX <= obstacleMinX + obstacleMaxX) + ) { + assistanceLeft++; + isBypassX = true; + if (obstacleMinX - width < stopMinX) { + stopMinX = obstacleMinX - width; + bypassedObstacleAABB = obstacleAABB; + } + } else if ( + !leftKey && + obstacleMaxX - corner <= minX && + minX < obstacleMaxX && + (rightKey || minX + maxX > obstacleMinX + obstacleMaxX) + ) { + assistanceRight++; + isBypassX = true; + if (obstacleMaxX > stopMaxX) { + stopMaxX = obstacleMaxX; + bypassedObstacleAABB = obstacleAABB; + } + } + } else if ( + (leftKey && almostEquals(minX, obstacleMaxX)) || + (rightKey && almostEquals(maxX, obstacleMinX)) + ) { + // The player is not on the corner of the obstacle. + // Set the assistance both ways to fall back in + // the same case as 2 obstacles side by side + // being collide with the player. + if ( + (downKey || maxY > obstacleMinY + corner) && + minY < obstacleMaxY && + (upKey || minY < obstacleMaxY - corner) && + maxY > obstacleMinY + ) { + assistanceUp++; + assistanceDown++; + } + // The player is on the corner of the obstacle. + // (not the exact corner, see corner affectation) + else if ( + !downKey && + obstacleMinY < maxY && + maxY <= obstacleMinY + corner && + (upKey || minY + maxY <= obstacleMinY + obstacleMaxY) + ) { + assistanceUp++; + isBypassY = true; + if (obstacleMinY - height < stopMinY) { + stopMinY = obstacleMinY - height; + bypassedObstacleAABB = obstacleAABB; + } + } else if ( + !upKey && + obstacleMaxY - corner <= minY && + minY < obstacleMaxY && + (downKey || minY + maxY > obstacleMinY + obstacleMaxY) + ) { + assistanceDown++; + isBypassY = true; + if (obstacleMaxY > stopMaxY) { + stopMaxY = obstacleMaxY; + bypassedObstacleAABB = obstacleAABB; + } + } + } + } + } + + // This may happen when the player is in the corner of 2 perpendicular walls. + // No assistance is needed. + if ( + assistanceLeft && + assistanceRight && + assistanceUp && + assistanceDown + ) { + return this.noAssistance(); + } + // This may happen when the player goes in diagonal against a wall. + // Make him follow the wall. This allows player to keep full speed. + // + // When he collided a square from the wall corner to corner, + // a 3rd assistance may be true but it fall back in the same case. + else if (assistanceLeft && assistanceRight) { + isBypassX = false; + if (leftKey && !rightKey) { + assistanceDirection = 4; + } else if (rightKey && !leftKey) { + assistanceDirection = 0; + } else { + // Contradictory decisions are dismissed. + // + // This can happen, for instance, with a wall composed of squares. + // Taken separately from one to another, a square could be bypass one the right + // and the next one on the left even though they are side by side + // and the player can't actually go between them. + return this.noAssistance(); + } + } else if (assistanceUp && assistanceDown) { + isBypassY = false; + if (upKey && !downKey) { + assistanceDirection = 6; + } else if (downKey && !upKey) { + assistanceDirection = 2; + } else { + // see previous comment + return this.noAssistance(); + } + } + // The player goes in diagonal and is corner to corner with the obstacle. + // (but not against a wall, this time) + // The velocity is used to decide. + // This may only happen after an alignment. + // (see "Alignment:" comment) + else if (assistanceRight && assistanceDown) { + if ( + (downKey && !rightKey) || + (downKey === rightKey && assistanceDown > assistanceRight) || + (assistanceDown === assistanceRight && + this.topDownBehavior._yVelocity > 0 && + Math.abs(this.topDownBehavior._xVelocity) < + Math.abs(this.topDownBehavior._yVelocity)) + ) { + assistanceDirection = 2; + } else { + assistanceDirection = 0; + } + } else if (assistanceLeft && assistanceDown) { + if ( + (downKey && !leftKey) || + (downKey === leftKey && assistanceDown > assistanceLeft) || + (assistanceDown === assistanceLeft && + this.topDownBehavior._yVelocity > 0 && + Math.abs(this.topDownBehavior._xVelocity) < + Math.abs(this.topDownBehavior._yVelocity)) + ) { + assistanceDirection = 2; + } else { + assistanceDirection = 4; + } + } else if (assistanceLeft && assistanceUp) { + if ( + (upKey && !leftKey) || + (upKey === leftKey && assistanceUp > assistanceLeft) || + (assistanceUp === assistanceLeft && + this.topDownBehavior._yVelocity < 0 && + Math.abs(this.topDownBehavior._xVelocity) < + Math.abs(this.topDownBehavior._yVelocity)) + ) { + assistanceDirection = 6; + } else { + assistanceDirection = 4; + } + } else if (assistanceRight && assistanceUp) { + if ( + (upKey && !rightKey) || + (upKey === rightKey && assistanceUp > assistanceRight) || + (assistanceUp === assistanceRight && + this.topDownBehavior._yVelocity < 0 && + Math.abs(this.topDownBehavior._xVelocity) < + Math.abs(this.topDownBehavior._yVelocity)) + ) { + assistanceDirection = 6; + } else { + assistanceDirection = 0; + } + } else { + // Slide on the corner of an obstacle to bypass it. + // Every tricky cases are already handled . + if (assistanceLeft) { + assistanceDirection = 4; + } else if (assistanceRight) { + assistanceDirection = 0; + } else if (assistanceUp) { + assistanceDirection = 6; + } else if (assistanceDown) { + assistanceDirection = 2; + } else { + return this.noAssistance(); + } + } + + // Check if there is any obstacle in the way. + // + // There must be no obstacle to go at least + // as far in the direction the player chose + // as the assistance must take to align the player. + // + // Because, if the assistance moves the player by 32 pixels + // before been able to go in the right direction + // and can only move by 4 pixels afterward + // that it'll sound silly. + this.needToCheckBypassWay = + this.needToCheckBypassWay || + assistanceDirection !== this.lastAssistanceDirection; + if ((isBypassX || isBypassY) && !this.needToCheckBypassWay) { + // Don't check again if the player intent stays the same. + // + // Do it, for instance, if an obstacle has moved out of the way + // and the player releases and presses agin the key. + // Because, doing it automatically would seems weird. + if (this.lastAnyObstacle) { + return this.noAssistance(); + } + } else if (isBypassX || isBypassY) { + this.lastAssistanceDirection = assistanceDirection; + this.lastDirection = direction; + + let anyObstacle = false; + // reflection symmetry: y = x + // 0 to 6, 2 to 4, 4 to 2, 6 to 0 + if (direction + assistanceDirection === 6) { + // Because the obstacle may not be a square. + let cornerX = 0; + let cornerY = 0; + if (assistanceDirection === 4 || assistanceDirection === 6) { + cornerX = bypassedObstacleAABB.min[0]; + cornerY = bypassedObstacleAABB.min[1]; + } else { + cornerX = bypassedObstacleAABB.max[0]; + cornerY = bypassedObstacleAABB.max[1]; + } + // / cornerX \ / 0 1 \ / x - cornerX \ + // \ cornerY / + \ 1 0 / * \ y - cornerY / + // + // min and max are preserved by the symmetry. + // The symmetry image is extended to check there is no obstacle before going into the passage. + const searchMinX = + cornerX + + minY - + cornerY + + epsilon + + (assistanceDirection === 6 ? cornerY - maxY : 0); + const searchMaxX = + cornerX + + maxY - + cornerY - + epsilon + + (assistanceDirection === 2 ? cornerY - minY : 0); + const searchMinY = + cornerY + + minX - + cornerX + + epsilon + + (assistanceDirection === 4 ? cornerX - maxX : 0); + const searchMaxY = + cornerY + + maxX - + cornerX - + epsilon + + (assistanceDirection === 0 ? cornerX - minX : 0); + + anyObstacle = this.obstacleManager.anyObstacle( + searchMinX, + searchMaxX, + searchMinY, + searchMaxY, + this.collidingObjects + ); + } + // reflection symmetry: y = -x + // 0 to 2, 2 to 0, 4 to 6, 6 to 4 + else if ((direction + assistanceDirection) % 8 === 2) { + // Because the obstacle may not be a square. + let cornerX = 0; + let cornerY = 0; + if (assistanceDirection === 2 || assistanceDirection === 4) { + cornerX = bypassedObstacleAABB.min[0]; + cornerY = bypassedObstacleAABB.max[1]; + } else { + cornerX = bypassedObstacleAABB.max[0]; + cornerY = bypassedObstacleAABB.min[1]; + } + // / cornerX \ / 0 -1 \ / x - cornerX \ + // \ cornerY / + \ -1 0 / * \ y - cornerY / + // + // min and max are switched by the symmetry. + // The symmetry image is extended to check there is no obstacle before going into the passage. + const searchMinX = + cornerX - + (maxY - cornerY) + + epsilon + + (assistanceDirection === 2 ? minY - cornerY : 0); + const searchMaxX = + cornerX - + (minY - cornerY) - + epsilon + + (assistanceDirection === 6 ? maxY - cornerY : 0); + const searchMinY = + cornerY - + (maxX - cornerX) + + epsilon + + (assistanceDirection === 0 ? minX - cornerX : 0); + const searchMaxY = + cornerY - + (minX - cornerX) - + epsilon + + (assistanceDirection === 4 ? maxX - cornerX : 0); + + anyObstacle = this.obstacleManager.anyObstacle( + searchMinX, + searchMaxX, + searchMinY, + searchMaxY, + this.collidingObjects + ); + } + this.lastAnyObstacle = anyObstacle; + this.needToCheckBypassWay = false; + + if (anyObstacle) { + return this.noAssistance(); + } + } + + this.result.inputDirection = direction; + this.result.assistanceLeft = assistanceLeft > 0; + this.result.assistanceRight = assistanceRight > 0; + this.result.assistanceUp = assistanceUp > 0; + this.result.assistanceDown = assistanceDown > 0; + this.result.isBypassX = isBypassX; + this.result.isBypassY = isBypassY; + this.result.stopMinX = stopMinX; + this.result.stopMinY = stopMinY; + this.result.stopMaxX = stopMaxX; + this.result.stopMaxY = stopMaxY; + + return assistanceDirection; + } + + /** + * @return {integer} + */ + noAssistance = function () { + this.result.isBypassX = false; + this.result.isBypassY = false; + + return -1; + } + + applyCollision = function () { + this.checkCornerStop(); + this.separateFromObstacles(); + // check again because the object can be pushed on the stop limit, + // it won't be detected on the next frame and the alignment won't be applied. + this.checkCornerStop(); + } + + /** + * Check if the object must take a corner. + * + * When the object reach the limit of an obstacle + * and it should take the corner according to the player intent, + * it is aligned right on this limit and the velocity is set in the right direction. + * + * This avoid issues with the inertia. For instance, + * when the object could go between 2 obstacles, + * with it will just fly over the hole because of its inertia. + */ + checkCornerStop = function () { + const objectAABB = this.getHitBoxesAABB(); + const minX = objectAABB.min[0]; + const minY = objectAABB.min[1]; + const object = this.topDownBehavior.owner; + + const direction = this.result.inputDirection; + const leftKey = 3 <= direction && direction <= 5; + const upKey = 5 <= direction && direction <= 7; + + // Alignment: avoid to go too far and kind of drift or oscillate in front of a hole. + if ( + this.result.isBypassX && + ((this.result.assistanceLeft && minX <= this.result.stopMinX) || + (this.result.assistanceRight && minX >= this.result.stopMaxX)) + ) { + this.shift( + -minX + + (this.result.assistanceLeft + ? this.result.stopMinX + : this.result.stopMaxX), + 0 + ); + this.topDownBehavior._yVelocity = + (upKey ? -1 : 1) * + Math.sqrt( + this.topDownBehavior._xVelocity * + this.topDownBehavior._xVelocity + + this.topDownBehavior._yVelocity * + this.topDownBehavior._yVelocity + ); + this.topDownBehavior._xVelocity = 0; + } + if ( + this.result.isBypassY && + ((this.result.assistanceUp && minY <= this.result.stopMinY) || + (this.result.assistanceDown && minY >= this.result.stopMaxY)) + ) { + this.shift( + 0, + -minY + + (this.result.assistanceUp + ? this.result.stopMinY + : this.result.stopMaxY) + ); + this.topDownBehavior._xVelocity = + (leftKey ? -1 : 1) * + Math.sqrt( + this.topDownBehavior._xVelocity * + this.topDownBehavior._xVelocity + + this.topDownBehavior._yVelocity * + this.topDownBehavior._yVelocity + ); + this.topDownBehavior._yVelocity = 0; + } + } + + /** + * Separate from TopDownObstacleRuntimeBehavior instances. + */ + separateFromObstacles = function () { + const object = this.topDownBehavior.owner; + const objectAABB = this.getHitBoxesAABB(); + const minX = objectAABB.min[0]; + const minY = objectAABB.min[1]; + const maxX = objectAABB.max[0]; + const maxY = objectAABB.max[1]; + + // Search the obstacle with the biggest intersection + // to separate from this one first. + // Because smaller collisions may shift the player + // in the wrong direction. + let maxSurface = 0; + /** @type {gdjs.RuntimeBehavior | null} */ + let bestObstacleBehavior = null; + for (var i = 0; i < this.potentialCollidingObjects.length; ++i) { + const obstacleBehavior = this.potentialCollidingObjects[i]; + if (obstacleBehavior.behavior.owner === object) { + continue; + } + + const obstacleAABB = obstacleBehavior.getHitBoxesAABB(); + const obstacleMinX = obstacleAABB.min[0]; + const obstacleMinY = obstacleAABB.min[1]; + const obstacleMaxX = obstacleAABB.max[0]; + const obstacleMaxY = obstacleAABB.max[1]; + + const interMinX = Math.max(minX, obstacleMinX); + const interMinY = Math.max(minY, obstacleMinY); + const interMaxX = Math.min(maxX, obstacleMaxX); + const interMaxY = Math.min(maxY, obstacleMaxY); + + if (interMinX < interMaxX && interMinY < interMaxY) { + const surface = (interMaxX - interMinX) * (interMaxY - interMinY); + if (surface > maxSurface) { + maxSurface = surface; + bestObstacleBehavior = obstacleBehavior; + } + } + } + if (bestObstacleBehavior !== null) { + this.separateFrom(bestObstacleBehavior); + } + for (var i = 0; i < this.potentialCollidingObjects.length; ++i) { + const obstacleBehavior = this.potentialCollidingObjects[i]; + const obstacle = obstacleBehavior.behavior.owner; + if (obstacle === object) { + continue; + } + this.separateFrom(obstacleBehavior); + } + } + + /** + * Separate object and obstacle, only object move. + * @param {Obstacle} obstacleBehavior + */ + separateFrom = function (obstacleBehavior) { + const objectAABB = this.getHitBoxesAABB(); + const minX = objectAABB.min[0]; + const minY = objectAABB.min[1]; + const maxX = objectAABB.max[0]; + const maxY = objectAABB.max[1]; + + const obstacleAABB = obstacleBehavior.getHitBoxesAABB(); + const obstacleMinX = obstacleAABB.min[0]; + const obstacleMinY = obstacleAABB.min[1]; + const obstacleMaxX = obstacleAABB.max[0]; + const obstacleMaxY = obstacleAABB.max[1]; + + const leftDistance = maxX - obstacleMinX; + const upDistance = maxY - obstacleMinY; + const rightDistance = obstacleMaxX - minX; + const downDistance = obstacleMaxY - minY; + const minDistance = Math.min( + leftDistance, + upDistance, + rightDistance, + downDistance + ); + + if (minDistance > 0) { + if (leftDistance === minDistance) { + this.shift(-maxX + obstacleMinX, 0); + } else if (rightDistance === minDistance) { + this.shift(-minX + obstacleMaxX, 0); + } else if (upDistance === minDistance) { + this.shift(0, -maxY + obstacleMinY); + } else if (downDistance === minDistance) { + this.shift(0, -minY + obstacleMaxY); + } + } + } + + /** + * @param {float} deltaX + * @param {float} deltaY + */ + shift(deltaX, deltaY) { + this.transformedPosition[0] += deltaX; + this.transformedPosition[1] += deltaY; + } + + /** + * @return {gdjs.AABB} + */ + getHitBoxesAABB() { + if (!this.hitBoxesAABBUpToDate) { + const hitBoxes = this.topDownBehavior.owner.getHitBoxes(); + + let minX = Number.MAX_VALUE; + let minY = Number.MAX_VALUE; + let maxX = -Number.MAX_VALUE; + let maxY = -Number.MAX_VALUE; + for (let h = 0, lenh = hitBoxes.length; h < lenh; ++h) { + let hitBox = hitBoxes[h]; + for (let p = 0, lenp = hitBox.vertices.length; p < lenp; ++p) { + const point = this.topDownBehavior + ._temporaryPointForTransformations; + // TODO Handle isometry + // if (this.topDownBehavior._basisTransformation) { + // this.topDownBehavior._basisTransformation.toWorld( + // hitBox.vertices[p], + // point + // ); + // } else { + point[0] = hitBox.vertices[p][0]; + point[1] = hitBox.vertices[p][1]; + // } + minX = Math.min(minX, point[0]); + maxX = Math.max(maxX, point[0]); + minY = Math.min(minY, point[1]); + maxY = Math.max(maxY, point[1]); + } + } + this.relativeHitBoxesAABB.min[0] = minX - this.transformedPosition[0]; + this.relativeHitBoxesAABB.min[1] = minY - this.transformedPosition[1]; + this.relativeHitBoxesAABB.max[0] = maxX - this.transformedPosition[0]; + this.relativeHitBoxesAABB.max[1] = maxY - this.transformedPosition[1]; + + this.hitBoxesAABBUpToDate = true; + } + this.absoluteHitBoxesAABB.min[0] = + this.relativeHitBoxesAABB.min[0] + this.transformedPosition[0]; + this.absoluteHitBoxesAABB.min[1] = + this.relativeHitBoxesAABB.min[1] + this.transformedPosition[1]; + this.absoluteHitBoxesAABB.max[0] = + this.relativeHitBoxesAABB.max[0] + this.transformedPosition[0]; + this.absoluteHitBoxesAABB.max[1] = + this.relativeHitBoxesAABB.max[1] + this.transformedPosition[1]; + return this.absoluteHitBoxesAABB; + } + + /** + * Update _potentialCollidingObjects member with platforms near the object. + * @param {float} maxMovementLength + */ + updatePotentialCollidingObjects(maxMovementLength) { + this.obstacleManager.getAllObstaclesAround( + this.getHitBoxesAABB(), + maxMovementLength, + this.potentialCollidingObjects + ); + } +} + + +/** + * TopDownMovementRuntimeBehavior represents a behavior allowing objects to + * follow a path computed to avoid obstacles. + */ +class AssistanceResult { + constructor() { + this.inputDirection = -1; + this.assistanceLeft = false; + this.assistanceRight = false; + this.assistanceUp = false; + this.assistanceDown = false; + this.isBypassX = false; + this.isBypassY = false; + this.stopMinX = 0; + this.stopMinY = 0; + this.stopMaxX = 0; + this.stopMaxY = 0; + } +} + +/** + * Allow to store a behavior in a RBush (spatial data structure). + * Because this duplicates the AABB, this ensures the RBush AABB + * stays the same even if the underlying object is moved + * (in which case the behavior is responsible for removing/adding + * back/updating this BehaviorRBushAABB). + */ +class ObstacleRBushAABB { + /** + * @param {Obstacle} obstacle + */ + constructor(obstacle) { + this.obstacle = obstacle; + this.minX = 0; + this.minY = 0; + this.maxX = 0; + this.maxY = 0; + this.updateAABBFromOwner(); + } + + updateAABBFromOwner() { + const aabb = this.obstacle.getHitBoxesAABB(); + this.minX = aabb.min[0]; + this.minY = aabb.min[1]; + this.maxX = aabb.max[0]; + this.maxY = aabb.max[1]; + } +} + +/** + * Get the obstacle manager of an instance container. + * @param {gdjs.RuntimeInstanceContainer} instanceContainer + * @return {ObstacleManager} + */ +function getManager(instanceContainer) { + if (!instanceContainer.__topDownCornerSlidingExtension) { + instanceContainer.__topDownCornerSlidingExtension = {}; + } + if (!instanceContainer.__topDownCornerSlidingExtension.manager) { + // Create the shared manager if necessary. + instanceContainer.__topDownCornerSlidingExtension.manager = new ObstacleManager(); + } + return instanceContainer.__topDownCornerSlidingExtension.manager; +} + +/** + * An obstacle manager for fast spacial search. + */ +class ObstacleManager { + /** + * Create a manager. + */ + constructor() { + this.obstacleRBush = new rbush(); + } + + /** + * Register an obstacle. + * @param {Obstacle} obstacle + */ + addObstacle(obstacle) { + obstacle.currentRBushAABB.updateAABBFromOwner(); + this.obstacleRBush.insert(obstacle.currentRBushAABB); + } + + /** + * Unregister an obstacle. + * @param {Obstacle} obstacle + */ + removeObstacle(obstacle) { + this.obstacleRBush.remove(obstacle.currentRBushAABB); + } + + /** + * Returns all the boids around the specified boid. + * @param {gdjs.AABB} aabb + * @param {number} maxMovementLength + * @param {Obstacle[]} result the returned array. + * @return {Obstacle[]} An array with all obstacles near the object. + */ + getAllObstaclesAround(aabb, maxMovementLength, result) { + const searchArea = gdjs.staticObject( + ObstacleManager.prototype.getAllObstaclesAround + ); + searchArea.minX = aabb.min[0] - maxMovementLength; + searchArea.minY = aabb.min[1] - maxMovementLength; + searchArea.maxX = aabb.max[0] + maxMovementLength; + searchArea.maxY = aabb.max[1] + maxMovementLength; + /** @type {ObstacleRBushAABB[]} */ + const nearbyObstacles = this.obstacleRBush.search(searchArea); + + result.length = 0; + for (let i = 0; i < nearbyObstacles.length; i++) { + const obstacle = nearbyObstacles[i].obstacle; + result.push(obstacle); + } + + return result; + } + + /** + * Returns true if there is any obstacle intersecting the area. + * @param {number} minX + * @param {number} maxX + * @param {number} minY + * @param {number} maxY + * @param {gdjs.RuntimeObject[]} excluded + * @return {boolean} + */ + anyObstacle( + minX, + maxX, + minY, + maxY, + excluded + ) { + const searchArea = gdjs.staticObject( + ObstacleManager.prototype.anyObstacle + ); + // @ts-ignore + searchArea.minX = minX; + // @ts-ignore + searchArea.minY = minY; + // @ts-ignore + searchArea.maxX = maxX; + // @ts-ignore + searchArea.maxY = maxY; + /** @type {ObstacleRBushAABB[]} */ + const nearbyObstacles = this.obstacleRBush.search(searchArea); + + for (let i = 0; i < nearbyObstacles.length; i++) { + if (!excluded.includes(nearbyObstacles[i].obstacle.behavior.owner)) { + return true; + } + } + return false; + } +} + +/** + * NavMeshPathfindingObstacleRuntimeBehavior represents a behavior allowing objects to be + * considered as a obstacle by objects having Pathfinding Behavior. + */ +class Obstacle { + /** + * + * @param {gdjs.RuntimeInstanceContainer} instanceContainer + * @param {gdjs.RuntimeBehavior} behavior + */ + constructor(instanceContainer, behavior) { + this.oldX = 0; + this.oldY = 0; + this.oldWidth = 0; + this.oldHeight = 0; + this.registeredInManager = false; + this.behavior = behavior; + this.manager = getManager(instanceContainer); + // Note that we can't use getX(), getWidth()... of owner here: + // The owner is not yet fully constructed. + /** @type {gdjs.AABB} */ + this.hitBoxesAABB = { min: [0, 0], max: [0, 0] }; + this.hitBoxesAABBUpToDate = false; + + /** @type {FloatPoint} */ + this.point = [0, 0]; + this.currentRBushAABB = new ObstacleRBushAABB(this); + } + onCreated() { + this.manager.addObstacle(this); + this.registeredInManager = true; + } + onDestroy() { + if (this.manager && this.registeredInManager) { + this.manager.removeObstacle(this); + } + } + doStepPreEvents(instanceContainer) { + var owner = this.behavior.owner; + // Make sure the obstacle is or is not in the obstacles manager. + if (!this.behavior.activated() && this.registeredInManager) { + this.manager.removeObstacle(this); + this.registeredInManager = false; + } + else { + if (this.behavior.activated() && !this.registeredInManager) { + this.manager.addObstacle(this); + this.registeredInManager = true; + } + } + // Track changes in size or position + if (this.oldX !== owner.getX() || + this.oldY !== owner.getY() || + this.oldWidth !== owner.getWidth() || + this.oldHeight !== owner.getHeight()) { + this.hitBoxesAABBUpToDate = false; + if (this.registeredInManager) { + this.manager.removeObstacle(this); + this.manager.addObstacle(this); + } + this.oldX = owner.getX(); + this.oldY = owner.getY(); + this.oldWidth = owner.getWidth(); + this.oldHeight = owner.getHeight(); + } + } + doStepPostEvents(instanceContainer) { } + onActivate() { + if (this.registeredInManager) { + return; + } + this.manager.addObstacle(this); + this.registeredInManager = true; + } + onDeActivate() { + if (!this.registeredInManager) { + return; + } + this.manager.removeObstacle(this); + this.registeredInManager = false; + } + + /** + * @return {gdjs.AABB} + */ + getHitBoxesAABB() { + if (!this.hitBoxesAABBUpToDate) { + const hitBoxes = this.behavior.owner.getHitBoxes(); + + let minX = Number.MAX_VALUE; + let minY = Number.MAX_VALUE; + let maxX = -Number.MAX_VALUE; + let maxY = -Number.MAX_VALUE; + for (let h = 0, lenh = hitBoxes.length; h < lenh; ++h) { + let hitBox = hitBoxes[h]; + for (let p = 0, lenp = hitBox.vertices.length; p < lenp; ++p) { + const point = this.point; + // TODO Handle Isometry + //this._basisTransformation.toWorld(hitBox.vertices[p], point); + point[0] = hitBox.vertices[p][0]; + point[1] = hitBox.vertices[p][1]; + + minX = Math.min(minX, point[0]); + maxX = Math.max(maxX, point[0]); + minY = Math.min(minY, point[1]); + maxY = Math.max(maxY, point[1]); + } + } + this.hitBoxesAABB.min[0] = minX; + this.hitBoxesAABB.min[1] = minY; + this.hitBoxesAABB.max[0] = maxX; + this.hitBoxesAABB.max[1] = maxY; + + this.hitBoxesAABBUpToDate = true; + } + return this.hitBoxesAABB; + } +} + +gdjs.__topDownCornerSlidingExtension = { + CornerSlider, + Obstacle, +}; + +}; +gdjs.evtsExt__TopDownCornerSliding__DefineJavaScriptForTopDown.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__TopDownCornerSliding__DefineJavaScriptForTopDown.userFunc0xd4aa58(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__TopDownCornerSliding__DefineJavaScriptForTopDown.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("TopDownCornerSliding"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("TopDownCornerSliding"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__TopDownCornerSliding__DefineJavaScriptForTopDown.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__TopDownCornerSliding__DefineJavaScriptForTopDown.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__topdowncornersliding__topdowncornerslider.js b/gdjs-evtsext__topdowncornersliding__topdowncornerslider.js new file mode 100644 index 0000000000000000000000000000000000000000..18aba6e5149c2755c3bae405d7d31f4471740476 --- /dev/null +++ b/gdjs-evtsext__topdowncornersliding__topdowncornerslider.js @@ -0,0 +1,208 @@ + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider = gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider || {}; + +/** + * Behavior generated from Top-down corner slider + */ +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider = class TopDownCornerSlider extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.TopDownMovement = behaviorData.TopDownMovement !== undefined ? behaviorData.TopDownMovement : ""; + } + + // Hot-reload: + updateFromBehaviorData(oldBehaviorData, newBehaviorData) { + + if (oldBehaviorData.TopDownMovement !== newBehaviorData.TopDownMovement) + this._behaviorData.TopDownMovement = newBehaviorData.TopDownMovement; + + return true; + } + + // Network sync: + getNetworkSyncData() { + return { + ...super.getNetworkSyncData(), + props: { + + TopDownMovement: this._behaviorData.TopDownMovement, + } + }; + } + updateFromNetworkSyncData(networkSyncData) { + super.updateFromNetworkSyncData(networkSyncData); + + if (networkSyncData.props.TopDownMovement !== undefined) + this._behaviorData.TopDownMovement = networkSyncData.props.TopDownMovement; + } + + // Properties: + + _getTopDownMovement() { + return this._behaviorData.TopDownMovement !== undefined ? this._behaviorData.TopDownMovement : ""; + } + _setTopDownMovement(newValue) { + this._behaviorData.TopDownMovement = newValue; + } +} + +/** + * Shared data generated from Top-down corner slider + */ +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.SharedData = class TopDownCornerSliderSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._TopDownCornerSliding_TopDownCornerSliderSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._TopDownCornerSliding_TopDownCornerSliderSharedData = new gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.SharedData( + initialData + ); + } + return instanceContainer._TopDownCornerSliding_TopDownCornerSliderSharedData; +} + +// Methods: +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.onCreatedContext = {}; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.onCreatedContext.GDObjectObjects1= []; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.onCreatedContext.GDObjectObjects2= []; + + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.onCreatedContext.userFunc0xd22f98 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; + +const object = objects[0]; +const behaviorName = eventsFunctionContext.getBehaviorName("Behavior"); +const behavior = object.getBehavior(behaviorName); + +/** @type {gdjs.TopDownMovementRuntimeBehavior} */ +const topDownBehavior = object.getBehavior(behavior._getTopDownMovement()); + +behavior.__topDownCornerSlidingExtension = { + cornerSlider: new gdjs.__topDownCornerSlidingExtension.CornerSlider(runtimeScene, behavior, topDownBehavior) +}; + +}; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.onCreatedContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +{gdjs.evtsExt__TopDownCornerSliding__DefineJavaScriptForTopDown.func(runtimeScene, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +}} + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.onCreatedContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.onCreatedContext.GDObjectObjects1); +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.onCreatedContext.userFunc0xd22f98(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.onCreated = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "TopDownMovement": this._getTopDownMovement() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("TopDownCornerSliding"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("TopDownCornerSliding"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.onCreatedContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.onCreatedContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.onCreatedContext.GDObjectObjects2.length = 0; + + +return; +} + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider.prototype.doStepPreEvents = function() { + this._onceTriggers.startNewFrame(); +}; + + +gdjs.registerBehavior("TopDownCornerSliding::TopDownCornerSlider", gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSlider.TopDownCornerSlider); diff --git a/gdjs-evtsext__topdowncornersliding__topdowncornersliderobstacle.js b/gdjs-evtsext__topdowncornersliding__topdowncornersliderobstacle.js new file mode 100644 index 0000000000000000000000000000000000000000..256e405b5e174632dbf1178f4521448c0db5efe5 --- /dev/null +++ b/gdjs-evtsext__topdowncornersliding__topdowncornersliderobstacle.js @@ -0,0 +1,598 @@ + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle = gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle || {}; + +/** + * Behavior generated from Top-down corner slider obstacle + */ +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle = class TopDownCornerSliderObstacle extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.SlidingCornerSize = behaviorData.SlidingCornerSize !== undefined ? behaviorData.SlidingCornerSize : Number("0") || 0; + } + + // Hot-reload: + updateFromBehaviorData(oldBehaviorData, newBehaviorData) { + + if (oldBehaviorData.SlidingCornerSize !== newBehaviorData.SlidingCornerSize) + this._behaviorData.SlidingCornerSize = newBehaviorData.SlidingCornerSize; + + return true; + } + + // Network sync: + getNetworkSyncData() { + return { + ...super.getNetworkSyncData(), + props: { + + SlidingCornerSize: this._behaviorData.SlidingCornerSize, + } + }; + } + updateFromNetworkSyncData(networkSyncData) { + super.updateFromNetworkSyncData(networkSyncData); + + if (networkSyncData.props.SlidingCornerSize !== undefined) + this._behaviorData.SlidingCornerSize = networkSyncData.props.SlidingCornerSize; + } + + // Properties: + + _getSlidingCornerSize() { + return this._behaviorData.SlidingCornerSize !== undefined ? this._behaviorData.SlidingCornerSize : Number("0") || 0; + } + _setSlidingCornerSize(newValue) { + this._behaviorData.SlidingCornerSize = newValue; + } +} + +/** + * Shared data generated from Top-down corner slider obstacle + */ +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.SharedData = class TopDownCornerSliderObstacleSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._TopDownCornerSliding_TopDownCornerSliderObstacleSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._TopDownCornerSliding_TopDownCornerSliderObstacleSharedData = new gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.SharedData( + initialData + ); + } + return instanceContainer._TopDownCornerSliding_TopDownCornerSliderObstacleSharedData; +} + +// Methods: +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onCreatedContext = {}; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onCreatedContext.GDObjectObjects1= []; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onCreatedContext.GDObjectObjects2= []; + + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onCreatedContext.userFunc0xd4c3f0 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +const object = objects[0]; +const behaviorName = eventsFunctionContext.getBehaviorName("Behavior"); +const behavior = object.getBehavior(behaviorName); + +const obstacle = new gdjs.__topDownCornerSlidingExtension.Obstacle(runtimeScene, behavior) +behavior.__topDownCornerSlidingExtension = { obstacle }; +obstacle.onCreated(runtimeScene, behavior); + +}; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onCreatedContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + + +} + + +{ + + +let isConditionTrue_0 = false; +{ +{gdjs.evtsExt__TopDownCornerSliding__DefineJavaScriptForTopDown.func(runtimeScene, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +}} + +} + + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onCreatedContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onCreatedContext.GDObjectObjects1); +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onCreatedContext.userFunc0xd4c3f0(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onCreated = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("TopDownCornerSliding"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("TopDownCornerSliding"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onCreatedContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onCreatedContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onCreatedContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.doStepPreEventsContext = {}; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.doStepPreEventsContext.GDObjectObjects1= []; + + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.doStepPreEventsContext.userFunc0xd4c3f0 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +const object = objects[0]; +const behaviorName = eventsFunctionContext.getBehaviorName("Behavior"); +const behavior = object.getBehavior(behaviorName); + +behavior.__topDownCornerSlidingExtension.obstacle.doStepPreEvents(runtimeScene); + +}; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.doStepPreEventsContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.doStepPreEventsContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.doStepPreEventsContext.GDObjectObjects1); +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.doStepPreEventsContext.userFunc0xd4c3f0(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.doStepPreEvents = function(parentEventsFunctionContext) { +this._onceTriggers.startNewFrame(); +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("TopDownCornerSliding"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("TopDownCornerSliding"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.doStepPreEventsContext.GDObjectObjects1.length = 0; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.doStepPreEventsContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.doStepPreEventsContext.GDObjectObjects1.length = 0; + + +return; +} +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onActivateContext = {}; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onActivateContext.GDObjectObjects1= []; + + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onActivateContext.userFunc0xd4c3f0 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +const object = objects[0]; +const behaviorName = eventsFunctionContext.getBehaviorName("Behavior"); +const behavior = object.getBehavior(behaviorName); + +behavior.__topDownCornerSlidingExtension.obstacle.onActivate(runtimeScene); + +}; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onActivateContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onActivateContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onActivateContext.GDObjectObjects1); +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onActivateContext.userFunc0xd4c3f0(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onActivate = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("TopDownCornerSliding"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("TopDownCornerSliding"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onActivateContext.GDObjectObjects1.length = 0; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onActivateContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onActivateContext.GDObjectObjects1.length = 0; + + +return; +} +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDeActivateContext = {}; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDeActivateContext.GDObjectObjects1= []; + + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDeActivateContext.userFunc0xd4c3f0 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +const object = objects[0]; +const behaviorName = eventsFunctionContext.getBehaviorName("Behavior"); +const behavior = object.getBehavior(behaviorName); + +behavior.__topDownCornerSlidingExtension.obstacle.onDeActivate(runtimeScene); + +}; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDeActivateContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDeActivateContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDeActivateContext.GDObjectObjects1); +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDeActivateContext.userFunc0xd4c3f0(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDeActivate = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("TopDownCornerSliding"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("TopDownCornerSliding"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDeActivateContext.GDObjectObjects1.length = 0; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDeActivateContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDeActivateContext.GDObjectObjects1.length = 0; + + +return; +} +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDestroyContext = {}; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDestroyContext.GDObjectObjects1= []; + + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDestroyContext.userFunc0xd4c3f0 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +const object = objects[0]; +const behaviorName = eventsFunctionContext.getBehaviorName("Behavior"); +const behavior = object.getBehavior(behaviorName); + +behavior.__topDownCornerSlidingExtension.obstacle.onDestroy(runtimeScene); + +}; +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDestroyContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDestroyContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDestroyContext.GDObjectObjects1); +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDestroyContext.userFunc0xd4c3f0(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDestroy = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("TopDownCornerSliding"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("TopDownCornerSliding"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDestroyContext.GDObjectObjects1.length = 0; + +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDestroyContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle.prototype.onDestroyContext.GDObjectObjects1.length = 0; + + +return; +} + + +gdjs.registerBehavior("TopDownCornerSliding::TopDownCornerSliderObstacle", gdjs.evtsExt__TopDownCornerSliding__TopDownCornerSliderObstacle.TopDownCornerSliderObstacle); diff --git a/gdjs-evtsext__tween3d__definehelperclasses-func.js b/gdjs-evtsext__tween3d__definehelperclasses-func.js new file mode 100644 index 0000000000000000000000000000000000000000..7f8ea3db7270744f00d258d6baa86525154ab0f5 --- /dev/null +++ b/gdjs-evtsext__tween3d__definehelperclasses-func.js @@ -0,0 +1,317 @@ + +if (typeof gdjs.evtsExt__Tween3D__DefineHelperClasses !== "undefined") { + gdjs.evtsExt__Tween3D__DefineHelperClasses.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Tween3D__DefineHelperClasses = {}; + + +gdjs.evtsExt__Tween3D__DefineHelperClasses.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +if (gdjs.__tween3DExtension) { + return; +} + +class Tint { + /** + * Materials by material `id`. + * @type {Map} + */ + materials; + usageCount = 0; + + /** + * @param materials {Map} + */ + constructor(materials) { + this.materials = materials; + } + + /** + * @param object {gdjs.RuntimeObject3D} + */ + applyTo(object) { + object.get3DRendererObject().traverse((mesh) => { + if (mesh.material) { + const material = mesh.material; + const originalId = material.originalId || material.id; + const tintedMaterial = this.materials.get(originalId); + if (tintedMaterial) { + mesh.material = tintedMaterial; + } + } + }); + } + + /** + * @param tintColor {number} + * @param originalTint {Tint} + */ + setColor(tintColor, originalTint) { + const originalMaterials = originalTint.materials; + for (const [materialId, material] of this.materials) { + const originalColor = originalMaterials.get(materialId).color; + const color = material.color; + color.setHex(tintColor); + color.r *= originalColor.r; + color.g *= originalColor.g; + color.b *= originalColor.b; + } + } + + dispose() { + for (const material of this.materials.values()) { + material.dispose(); + } + } +} + +class TintManager { + /** + * Tints by color hex. + * @type {Map} + */ + tints = new Map(); + /** + * Materials by material `id`. + * @type {Map} + */ + originalTint; + /** + * @type {Array} + */ + recycledTints = []; + + /** + * @param {gdjs.RuntimeObject3D} object + */ + constructor(object) { + const materials = new Map(); + object.get3DRendererObject().traverse((mesh) => { + if (mesh.material && mesh.material.color) { + const material = mesh.material; + materials.set(material.id, material); + } + }); + this.originalTint = new Tint(materials); + } + + /** + * @param {gdjs.RuntimeObject3D} object + * @param {number} color + */ + applyTint(object, color) { + const previousColor = this.getTint(object); + if (color === previousColor) { + return; + } + if (previousColor !== 0xffffff) { + const previousTint = this.tints.get(previousColor); + previousTint.usageCount--; + if (previousTint.usageCount === 0) { + this.tints.delete(previousColor); + this.recycledTints.push(previousTint); + } + } + let tint = color === 0xffffff ? this.originalTint : this.tints.get(color); + if (!tint) { + tint = this.createTint(object, color); + this.tints.set(color, tint); + } + tint.applyTo(object); + tint.usageCount++; + object.__tint3DExtension_tint = color; + } + + /** + * @param {gdjs.RuntimeObject3D} object + * @return {number} + */ + getTint(object) { + return object.__tint3DExtension_tint === undefined ? 0xffffff : object.__tint3DExtension_tint; + } + + /** + * @param {gdjs.RuntimeObject3D} object + * @param {number} color + */ + createTint(object, color) { + let tint; + if (this.recycledTints.length > 0) { + tint = this.recycledTints.pop(); + tint.usageCount = 0; + } + else { + const materials = new Map(); + object.get3DRendererObject().traverse((mesh) => { + if (mesh.material && mesh.material.color) { + const material = mesh.material; + const originalId = material.id; + if (materials.has(originalId)) { + // Meshes can share the same material. + return; + } + const tintedMaterial = mesh.material.clone(); + tintedMaterial.originalId = originalId; + materials.set(originalId, tintedMaterial); + } + }); + tint = new Tint(materials); + } + tint.setColor(color, this.originalTint); + return tint; + } + + dispose() { + for (const tint of this.tints.values()) { + tint.dispose(); + } + this.tints.clear(); + for (const tint of this.recycledTints) { + tint.dispose(); + } + this.recycledTints.length = 0; + } +} + +gdjs.registerObjectDeletedFromSceneCallback(function (runtimeScene, deletedObject) { + const extension = runtimeScene.__tween3DExtension; + if (!extension) { + return; + } + const managers = extension.tintManagers; + const manager = managers.get(deletedObject.getName()); + if (manager) { + manager.applyTint(deletedObject, 0xffffff); + } +}); + + +/** + * @param {number} r + * @param {number} g + * @param {number} b + * @return {number[]} + */ +const rgbToHsl = (r, g, b) => { + r /= 255; + g /= 255; + b /= 255; + let v = Math.max(r, g, b), + c = v - Math.min(r, g, b), + f = 1 - Math.abs(v + v - c - 1); + let h = + c && + (v === r ? (g - b) / c : v === g ? 2 + (b - r) / c : 4 + (r - g) / c); + return [ + Math.round(60 * (h < 0 ? h + 6 : h)), + Math.round((f ? c / f : 0) * 100), + Math.round(((v + v - c) / 2) * 100), + ]; +}; + +/** + * @param {number} h + * @param {number} s + * @param {number} l + * @return {number[]} + */ +const hslToRgb = (h, s, l) => { + h = h %= 360; + if (h < 0) { + h += 360; + } + s = s / 100; + l = l / 100; + const a = s * Math.min(l, 1 - l); + const f = (n = 0, k = (n + h / 30) % 12) => + l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1); + return [ + Math.round(f(0) * 255), + Math.round(f(8) * 255), + Math.round(f(4) * 255), + ]; +}; + +gdjs.__tween3DExtension = { + TintManager, + rgbToHsl, + hslToRgb, +}; + +}; +gdjs.evtsExt__Tween3D__DefineHelperClasses.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Tween3D__DefineHelperClasses.userFunc0xde7588(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Tween3D__DefineHelperClasses.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Tween3D__DefineHelperClasses.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__Tween3D__DefineHelperClasses.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__tween3d__easeexp-func.js b/gdjs-evtsext__tween3d__easeexp-func.js new file mode 100644 index 0000000000000000000000000000000000000000..32fe8a621b7c8b5b7cadd22868308fe6c49f21b4 --- /dev/null +++ b/gdjs-evtsext__tween3d__easeexp-func.js @@ -0,0 +1,89 @@ + +if (typeof gdjs.evtsExt__Tween3D__EaseExp !== "undefined") { + gdjs.evtsExt__Tween3D__EaseExp.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Tween3D__EaseExp = {}; + + +gdjs.evtsExt__Tween3D__EaseExp.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = Math.exp(gdjs.evtTools.tween.ease((typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("Easing") : ""), Math.log((typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("InitialValue")) || 0 : 0)), Math.log((typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("TargetedValue")) || 0 : 0)), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Weighting")) || 0 : 0))); }}} + +} + + +}; + +gdjs.evtsExt__Tween3D__EaseExp.func = function(runtimeScene, Easing, InitialValue, TargetedValue, Weighting, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Easing") return Easing; +if (argName === "InitialValue") return InitialValue; +if (argName === "TargetedValue") return TargetedValue; +if (argName === "Weighting") return Weighting; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Tween3D__EaseExp.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Tween3D__EaseExp.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__tween3d__onfirstsceneloaded-func.js b/gdjs-evtsext__tween3d__onfirstsceneloaded-func.js new file mode 100644 index 0000000000000000000000000000000000000000..ae5a1da6c206dd3ebf3b7c21d50057a8c53e8f7d --- /dev/null +++ b/gdjs-evtsext__tween3d__onfirstsceneloaded-func.js @@ -0,0 +1,90 @@ + +if (typeof gdjs.evtsExt__Tween3D__onFirstSceneLoaded !== "undefined") { + gdjs.evtsExt__Tween3D__onFirstSceneLoaded.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Tween3D__onFirstSceneLoaded = {}; + + +gdjs.evtsExt__Tween3D__onFirstSceneLoaded.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +{gdjs.evtsExt__Tween3D__DefineHelperClasses.func(runtimeScene, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +}} + +} + + +}; + +gdjs.evtsExt__Tween3D__onFirstSceneLoaded.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Tween3D__onFirstSceneLoaded.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__Tween3D__onFirstSceneLoaded.registeredGdjsCallbacks = []; +gdjs.evtsExt__Tween3D__onFirstSceneLoaded.registeredGdjsCallbacks.push((runtimeScene) => { + gdjs.evtsExt__Tween3D__onFirstSceneLoaded.func(runtimeScene, runtimeScene); +}) +gdjs.registerFirstRuntimeSceneLoadedCallback(gdjs.evtsExt__Tween3D__onFirstSceneLoaded.registeredGdjsCallbacks[gdjs.evtsExt__Tween3D__onFirstSceneLoaded.registeredGdjsCallbacks.length - 1]); diff --git a/gdjs-evtsext__tween3d__onsceneunloading-func.js b/gdjs-evtsext__tween3d__onsceneunloading-func.js new file mode 100644 index 0000000000000000000000000000000000000000..663c32fa4cc57dfe8e646232852ba3da59443291 --- /dev/null +++ b/gdjs-evtsext__tween3d__onsceneunloading-func.js @@ -0,0 +1,99 @@ + +if (typeof gdjs.evtsExt__Tween3D__onSceneUnloading !== "undefined") { + gdjs.evtsExt__Tween3D__onSceneUnloading.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Tween3D__onSceneUnloading = {}; + + +gdjs.evtsExt__Tween3D__onSceneUnloading.userFunc0xddea40 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +if (!runtimeScene.__tween3DExtension) { + return; +} +const { tintManagers } = runtimeScene.__tween3DExtension; + +for (const manager of tintManagers.values()) { + manager.dispose(); +} + +}; +gdjs.evtsExt__Tween3D__onSceneUnloading.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Tween3D__onSceneUnloading.userFunc0xddea40(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Tween3D__onSceneUnloading.func = function(runtimeScene, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Tween3D__onSceneUnloading.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__Tween3D__onSceneUnloading.registeredGdjsCallbacks = []; +gdjs.evtsExt__Tween3D__onSceneUnloading.registeredGdjsCallbacks.push((runtimeScene) => { + gdjs.evtsExt__Tween3D__onSceneUnloading.func(runtimeScene, runtimeScene); +}) +gdjs.registerRuntimeSceneUnloadingCallback(gdjs.evtsExt__Tween3D__onSceneUnloading.registeredGdjsCallbacks[gdjs.evtsExt__Tween3D__onSceneUnloading.registeredGdjsCallbacks.length - 1]); diff --git a/gdjs-evtsext__tween3d__rgbmean-func.js b/gdjs-evtsext__tween3d__rgbmean-func.js new file mode 100644 index 0000000000000000000000000000000000000000..6c3c7b4681bbbf7751cbfbb63da04c32c146859c --- /dev/null +++ b/gdjs-evtsext__tween3d__rgbmean-func.js @@ -0,0 +1,106 @@ + +if (typeof gdjs.evtsExt__Tween3D__RgbMean !== "undefined") { + gdjs.evtsExt__Tween3D__RgbMean.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Tween3D__RgbMean = {}; + + +gdjs.evtsExt__Tween3D__RgbMean.userFunc0xdaba78 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +const { rgbToHsl, hslToRgb } = gdjs.__tween3DExtension; + +const [r1, g1, b1] = gdjs.hexNumberToRGBArray(eventsFunctionContext.getArgument("Color1")); +const [r2, g2, b2] = gdjs.hexNumberToRGBArray(eventsFunctionContext.getArgument("Color2")); +const ratio = eventsFunctionContext.getArgument("Ratio"); + +const [h1, s1, l1] = rgbToHsl(r1, g1, b1); +const [h2, s2, l2] = rgbToHsl(r2, g2, b2); + +const h = h1 + ratio * (h2 - h1); +const s = s1 + ratio * (s2 - s1); +const l = l1 + ratio * (l2 - l1); + +const [r, g, b] = hslToRgb(h, s, l); + +eventsFunctionContext.returnValue = gdjs.rgbToHexNumber(r, g, b); + +}; +gdjs.evtsExt__Tween3D__RgbMean.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Tween3D__RgbMean.userFunc0xdaba78(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Tween3D__RgbMean.func = function(runtimeScene, Color1, Color2, Ratio, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Color1") return Color1; +if (argName === "Color2") return Color2; +if (argName === "Ratio") return Ratio; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Tween3D__RgbMean.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Tween3D__RgbMean.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__tween3d__rgbtonumber-func.js b/gdjs-evtsext__tween3d__rgbtonumber-func.js new file mode 100644 index 0000000000000000000000000000000000000000..ed5a57cb420ff4ab7d115b8dc07f7c4f1e167460 --- /dev/null +++ b/gdjs-evtsext__tween3d__rgbtonumber-func.js @@ -0,0 +1,89 @@ + +if (typeof gdjs.evtsExt__Tween3D__RgbToNumber !== "undefined") { + gdjs.evtsExt__Tween3D__RgbToNumber.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Tween3D__RgbToNumber = {}; + + +gdjs.evtsExt__Tween3D__RgbToNumber.userFunc0xddea40 = function GDJSInlineCode(runtimeScene, eventsFunctionContext) { +"use strict"; +eventsFunctionContext.returnValue = gdjs.rgbOrHexStringToNumber(eventsFunctionContext.getArgument("Color")); + +}; +gdjs.evtsExt__Tween3D__RgbToNumber.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +gdjs.evtsExt__Tween3D__RgbToNumber.userFunc0xddea40(runtimeScene, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Tween3D__RgbToNumber.func = function(runtimeScene, Color, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +}, + _objectArraysMap: { +}, + _behaviorNamesMap: { +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Color") return Color; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Tween3D__RgbToNumber.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Tween3D__RgbToNumber.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__tween3d__scalevolume-func.js b/gdjs-evtsext__tween3d__scalevolume-func.js new file mode 100644 index 0000000000000000000000000000000000000000..d9ffa39a81a227e5e403a0c283d7737a1bcac6d7 --- /dev/null +++ b/gdjs-evtsext__tween3d__scalevolume-func.js @@ -0,0 +1,79 @@ + +if (typeof gdjs.evtsExt__Tween3D__ScaleVolume !== "undefined") { + gdjs.evtsExt__Tween3D__ScaleVolume.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Tween3D__ScaleVolume = {}; + + +gdjs.evtsExt__Tween3D__ScaleVolume.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +}; + +gdjs.evtsExt__Tween3D__ScaleVolume.func = function(runtimeScene, Object, Object3D, Scale, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": gdjs.objectsListsToArray(Object) +}, + _behaviorNamesMap: { +"Object3D": Object3D +, "Scale": Scale +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Tween3D__ScaleVolume.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Tween3D__ScaleVolume.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__tween3d__setscalevolume-func.js b/gdjs-evtsext__tween3d__setscalevolume-func.js new file mode 100644 index 0000000000000000000000000000000000000000..6392e94c36dbd78ba51848da008b00463399da54 --- /dev/null +++ b/gdjs-evtsext__tween3d__setscalevolume-func.js @@ -0,0 +1,80 @@ + +if (typeof gdjs.evtsExt__Tween3D__SetScaleVolume !== "undefined") { + gdjs.evtsExt__Tween3D__SetScaleVolume.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Tween3D__SetScaleVolume = {}; + + +gdjs.evtsExt__Tween3D__SetScaleVolume.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +}; + +gdjs.evtsExt__Tween3D__SetScaleVolume.func = function(runtimeScene, Value, Object, Object3D, Scale, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": gdjs.objectsListsToArray(Object) +}, + _behaviorNamesMap: { +"Object3D": Object3D +, "Scale": Scale +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Value") return Value; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Tween3D__SetScaleVolume.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__Tween3D__SetScaleVolume.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__tween3d__setstretchy-func.js b/gdjs-evtsext__tween3d__setstretchy-func.js new file mode 100644 index 0000000000000000000000000000000000000000..f43d5651b4e7154385f2c0cce975973cbc9960c1 --- /dev/null +++ b/gdjs-evtsext__tween3d__setstretchy-func.js @@ -0,0 +1,80 @@ + +if (typeof gdjs.evtsExt__Tween3D__SetStretchY !== "undefined") { + gdjs.evtsExt__Tween3D__SetStretchY.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Tween3D__SetStretchY = {}; + + +gdjs.evtsExt__Tween3D__SetStretchY.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +}; + +gdjs.evtsExt__Tween3D__SetStretchY.func = function(runtimeScene, Value, Object, Object3D, Scale, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": gdjs.objectsListsToArray(Object) +}, + _behaviorNamesMap: { +"Object3D": Object3D +, "Scale": Scale +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Value") return Value; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Tween3D__SetStretchY.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__Tween3D__SetStretchY.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__tween3d__setstretchz-func.js b/gdjs-evtsext__tween3d__setstretchz-func.js new file mode 100644 index 0000000000000000000000000000000000000000..986752d7a85f6400be7f1e28d2efa0b3d618a757 --- /dev/null +++ b/gdjs-evtsext__tween3d__setstretchz-func.js @@ -0,0 +1,80 @@ + +if (typeof gdjs.evtsExt__Tween3D__SetStretchZ !== "undefined") { + gdjs.evtsExt__Tween3D__SetStretchZ.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Tween3D__SetStretchZ = {}; + + +gdjs.evtsExt__Tween3D__SetStretchZ.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +}; + +gdjs.evtsExt__Tween3D__SetStretchZ.func = function(runtimeScene, Value, Object, Object3D, Scale, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": gdjs.objectsListsToArray(Object) +}, + _behaviorNamesMap: { +"Object3D": Object3D +, "Scale": Scale +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Value") return Value; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Tween3D__SetStretchZ.eventsList0(runtimeScene, eventsFunctionContext); + + +return; +} + +gdjs.evtsExt__Tween3D__SetStretchZ.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__tween3d__settint-func.js b/gdjs-evtsext__tween3d__settint-func.js new file mode 100644 index 0000000000000000000000000000000000000000..5eaffd356a5db38a156ec7d9619a81ec65da9924 --- /dev/null +++ b/gdjs-evtsext__tween3d__settint-func.js @@ -0,0 +1,114 @@ + +if (typeof gdjs.evtsExt__Tween3D__SetTint !== "undefined") { + gdjs.evtsExt__Tween3D__SetTint.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Tween3D__SetTint = {}; +gdjs.evtsExt__Tween3D__SetTint.GDObjectObjects1= []; + + +gdjs.evtsExt__Tween3D__SetTint.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +const color = gdjs.rgbOrHexStringToNumber(eventsFunctionContext.getArgument("Color") || "255; 255;255"); + +if (!runtimeScene.__tween3DExtension) { + runtimeScene.__tween3DExtension = { + tintManagers: new Map() + }; +} +const { tintManagers } = runtimeScene.__tween3DExtension; +for (const object of objects) { + let manager = tintManagers.get(object.getName()); + if (!manager) { + const { TintManager } = gdjs.__tween3DExtension; + manager = new TintManager(object); + tintManagers.set(object.getName(), manager); + } + manager.applyTint(object, color); +} + +}; +gdjs.evtsExt__Tween3D__SetTint.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__SetTint.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__Tween3D__SetTint.GDObjectObjects1); +gdjs.evtsExt__Tween3D__SetTint.userFunc0xde7588(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Tween3D__SetTint.func = function(runtimeScene, Object, Object3D, Color, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": gdjs.objectsListsToArray(Object) +}, + _behaviorNamesMap: { +"Object3D": Object3D +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Color") return Color; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + +gdjs.evtsExt__Tween3D__SetTint.GDObjectObjects1.length = 0; + +gdjs.evtsExt__Tween3D__SetTint.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__SetTint.GDObjectObjects1.length = 0; + + +return; +} + +gdjs.evtsExt__Tween3D__SetTint.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__tween3d__settintnumber-func.js b/gdjs-evtsext__tween3d__settintnumber-func.js new file mode 100644 index 0000000000000000000000000000000000000000..f79fe7a65463a17cb4955fef4a16708a065920e7 --- /dev/null +++ b/gdjs-evtsext__tween3d__settintnumber-func.js @@ -0,0 +1,114 @@ + +if (typeof gdjs.evtsExt__Tween3D__SetTintNumber !== "undefined") { + gdjs.evtsExt__Tween3D__SetTintNumber.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Tween3D__SetTintNumber = {}; +gdjs.evtsExt__Tween3D__SetTintNumber.GDObjectObjects1= []; + + +gdjs.evtsExt__Tween3D__SetTintNumber.userFunc0xde7588 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +const color = eventsFunctionContext.getArgument("Color"); + +if (!runtimeScene.__tween3DExtension) { + runtimeScene.__tween3DExtension = { + tintManagers: new Map() + }; +} +const { tintManagers } = runtimeScene.__tween3DExtension; +for (const object of objects) { + let manager = tintManagers.get(object.getName()); + if (!manager) { + const { TintManager } = gdjs.__tween3DExtension; + manager = new TintManager(object); + tintManagers.set(object.getName(), manager); + } + manager.applyTint(object, color); +} + +}; +gdjs.evtsExt__Tween3D__SetTintNumber.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__SetTintNumber.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__Tween3D__SetTintNumber.GDObjectObjects1); +gdjs.evtsExt__Tween3D__SetTintNumber.userFunc0xde7588(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Tween3D__SetTintNumber.func = function(runtimeScene, Object, Object3D, Color, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": gdjs.objectsListsToArray(Object) +}, + _behaviorNamesMap: { +"Object3D": Object3D +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Color") return Color; + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + +gdjs.evtsExt__Tween3D__SetTintNumber.GDObjectObjects1.length = 0; + +gdjs.evtsExt__Tween3D__SetTintNumber.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__SetTintNumber.GDObjectObjects1.length = 0; + + +return; +} + +gdjs.evtsExt__Tween3D__SetTintNumber.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__tween3d__stretchy-func.js b/gdjs-evtsext__tween3d__stretchy-func.js new file mode 100644 index 0000000000000000000000000000000000000000..91076e85adb0fdafcd59c698a65ab4bc30666ee2 --- /dev/null +++ b/gdjs-evtsext__tween3d__stretchy-func.js @@ -0,0 +1,79 @@ + +if (typeof gdjs.evtsExt__Tween3D__StretchY !== "undefined") { + gdjs.evtsExt__Tween3D__StretchY.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Tween3D__StretchY = {}; + + +gdjs.evtsExt__Tween3D__StretchY.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +}; + +gdjs.evtsExt__Tween3D__StretchY.func = function(runtimeScene, Object, Object3D, Scale, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": gdjs.objectsListsToArray(Object) +}, + _behaviorNamesMap: { +"Object3D": Object3D +, "Scale": Scale +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Tween3D__StretchY.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Tween3D__StretchY.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__tween3d__stretchz-func.js b/gdjs-evtsext__tween3d__stretchz-func.js new file mode 100644 index 0000000000000000000000000000000000000000..d3102cd3a35df359c2d579099ac3f30fea0d7566 --- /dev/null +++ b/gdjs-evtsext__tween3d__stretchz-func.js @@ -0,0 +1,79 @@ + +if (typeof gdjs.evtsExt__Tween3D__StretchZ !== "undefined") { + gdjs.evtsExt__Tween3D__StretchZ.registeredGdjsCallbacks.forEach(callback => + gdjs._unregisterCallback(callback) + ); +} + +gdjs.evtsExt__Tween3D__StretchZ = {}; + + +gdjs.evtsExt__Tween3D__StretchZ.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +}; + +gdjs.evtsExt__Tween3D__StretchZ.func = function(runtimeScene, Object, Object3D, Scale, parentEventsFunctionContext) { +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": gdjs.objectsListsToArray(Object) +}, + _behaviorNamesMap: { +"Object3D": Object3D +, "Scale": Scale +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return runtimeScene.getOnceTriggers(); } +}; + + +gdjs.evtsExt__Tween3D__StretchZ.eventsList0(runtimeScene, eventsFunctionContext); + + +return Number(eventsFunctionContext.returnValue) || 0; +} + +gdjs.evtsExt__Tween3D__StretchZ.registeredGdjsCallbacks = []; \ No newline at end of file diff --git a/gdjs-evtsext__tween3d__tween3d.js b/gdjs-evtsext__tween3d__tween3d.js new file mode 100644 index 0000000000000000000000000000000000000000..97263f876b6bb79c29584d900562c736e4f7fda3 --- /dev/null +++ b/gdjs-evtsext__tween3d__tween3d.js @@ -0,0 +1,5020 @@ + +gdjs.evtsExt__Tween3D__Tween3D = gdjs.evtsExt__Tween3D__Tween3D || {}; + +/** + * Behavior generated from Advanced 3D tween + */ +gdjs.evtsExt__Tween3D__Tween3D.Tween3D = class Tween3D extends gdjs.RuntimeBehavior { + constructor(instanceContainer, behaviorData, owner) { + super(instanceContainer, behaviorData, owner); + this._runtimeScene = instanceContainer; + + this._onceTriggers = new gdjs.OnceTriggers(); + this._behaviorData = {}; + this._sharedData = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.getSharedData( + instanceContainer, + behaviorData.name + ); + + this._behaviorData.Object3D = behaviorData.Object3D !== undefined ? behaviorData.Object3D : ""; + this._behaviorData.Scale = behaviorData.Scale !== undefined ? behaviorData.Scale : ""; + this._behaviorData.Tween = behaviorData.Tween !== undefined ? behaviorData.Tween : ""; + } + + // Hot-reload: + updateFromBehaviorData(oldBehaviorData, newBehaviorData) { + + if (oldBehaviorData.Object3D !== newBehaviorData.Object3D) + this._behaviorData.Object3D = newBehaviorData.Object3D; + if (oldBehaviorData.Scale !== newBehaviorData.Scale) + this._behaviorData.Scale = newBehaviorData.Scale; + if (oldBehaviorData.Tween !== newBehaviorData.Tween) + this._behaviorData.Tween = newBehaviorData.Tween; + + return true; + } + + // Network sync: + getNetworkSyncData() { + return { + ...super.getNetworkSyncData(), + props: { + + Object3D: this._behaviorData.Object3D, + Scale: this._behaviorData.Scale, + Tween: this._behaviorData.Tween, + } + }; + } + updateFromNetworkSyncData(networkSyncData) { + super.updateFromNetworkSyncData(networkSyncData); + + if (networkSyncData.props.Object3D !== undefined) + this._behaviorData.Object3D = networkSyncData.props.Object3D; + if (networkSyncData.props.Scale !== undefined) + this._behaviorData.Scale = networkSyncData.props.Scale; + if (networkSyncData.props.Tween !== undefined) + this._behaviorData.Tween = networkSyncData.props.Tween; + } + + // Properties: + + _getObject3D() { + return this._behaviorData.Object3D !== undefined ? this._behaviorData.Object3D : ""; + } + _setObject3D(newValue) { + this._behaviorData.Object3D = newValue; + } + _getScale() { + return this._behaviorData.Scale !== undefined ? this._behaviorData.Scale : ""; + } + _setScale(newValue) { + this._behaviorData.Scale = newValue; + } + _getTween() { + return this._behaviorData.Tween !== undefined ? this._behaviorData.Tween : ""; + } + _setTween(newValue) { + this._behaviorData.Tween = newValue; + } +} + +/** + * Shared data generated from Advanced 3D tween + */ +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.SharedData = class Tween3DSharedData { + constructor(sharedData) { + + } + + // Shared properties: + +} + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.getSharedData = function(instanceContainer, behaviorName) { + if (!instanceContainer._Tween3D_Tween3DSharedData) { + const initialData = instanceContainer.getInitialSharedDataForBehavior( + behaviorName + ); + instanceContainer._Tween3D_Tween3DSharedData = new gdjs.evtsExt__Tween3D__Tween3D.Tween3D.SharedData( + initialData + ); + } + return instanceContainer._Tween3D_Tween3DSharedData; +} + +// Methods: +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.onCreatedContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.onCreatedContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.onCreatedContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.onCreatedContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +{gdjs.evtsExt__Tween3D__DefineHelperClasses.func(runtimeScene, (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.onCreated = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.onCreatedContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.onCreatedContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.onCreatedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.onCreatedContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.GDObjectObjects1); +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = (( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).getScaleZ()) / Math.sqrt((( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleX()) * (( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleY())); }}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZ = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchZContext.GDObjectObjects2.length = 0; + + +return Number(eventsFunctionContext.returnValue) || 0; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = ((typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Value")) || 0 : 0) > 0); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1); +{runtimeScene.getScene().getVariables().get("_Tween3D").getChild("Volume").setNumber((( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).ScaleVolume((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)))); +}{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).setScaleZ(Math.pow(gdjs.evtTools.variable.getVariableNumber(runtimeScene.getScene().getVariables().get("_Tween3D").getChild("Volume")) * (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Value")) || 0 : 0) * (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Value")) || 0 : 0), 1 / 3)); +} +}{runtimeScene.getScene().getVariables().get("_Tween3D").getChild("SurfaceRatio").setNumber(Math.sqrt((gdjs.evtTools.variable.getVariableNumber(runtimeScene.getScene().getVariables().get("_Tween3D").getChild("Volume")) / (( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).getScaleZ())) / ((( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleX()) * (( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleY())))); +}{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).setScaleX(gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleX() * (gdjs.evtTools.variable.getVariableNumber(runtimeScene.getScene().getVariables().get("_Tween3D").getChild("SurfaceRatio")))); +} +}{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).setScaleY(gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleY() * (gdjs.evtTools.variable.getVariableNumber(runtimeScene.getScene().getVariables().get("_Tween3D").getChild("SurfaceRatio")))); +} +}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZ = function(Value, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Value") return Value; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchZContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.GDObjectObjects1); +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = (( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleY()) / Math.sqrt((( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleX()) * (( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).getScaleZ())); }}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchY = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.StretchYContext.GDObjectObjects2.length = 0; + + +return Number(eventsFunctionContext.returnValue) || 0; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = ((typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Value")) || 0 : 0) > 0); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1); +{runtimeScene.getScene().getVariables().get("_Tween3D").getChild("Volume").setNumber((( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).ScaleVolume((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)))); +}{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).setScaleY(Math.pow(gdjs.evtTools.variable.getVariableNumber(runtimeScene.getScene().getVariables().get("_Tween3D").getChild("Volume")) * (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Value")) || 0 : 0) * (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Value")) || 0 : 0), 1 / 3)); +} +}{runtimeScene.getScene().getVariables().get("_Tween3D").getChild("SurfaceRatio").setNumber(Math.sqrt((gdjs.evtTools.variable.getVariableNumber(runtimeScene.getScene().getVariables().get("_Tween3D").getChild("Volume")) / (( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).getScaleZ())) / ((( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleX()) * (( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleY())))); +}{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).setScaleX(gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleX() * (gdjs.evtTools.variable.getVariableNumber(runtimeScene.getScene().getVariables().get("_Tween3D").getChild("SurfaceRatio")))); +} +}{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).setScaleZ(gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).getScaleZ() * (gdjs.evtTools.variable.getVariableNumber(runtimeScene.getScene().getVariables().get("_Tween3D").getChild("SurfaceRatio")))); +} +}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchY = function(Value, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Value") return Value; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetStretchYContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.GDObjectObjects1); +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = (( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleX()) * (( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleY()) * (( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).getScaleZ()); }}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolume = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ScaleVolumeContext.GDObjectObjects2.length = 0; + + +return Number(eventsFunctionContext.returnValue) || 0; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +{isConditionTrue_0 = ((typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Value")) || 0 : 0) > 0); +} +if (isConditionTrue_0) { +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1); +{runtimeScene.getScene().getVariables().get("_Tween3D").getChild("Ratio").setNumber(Math.pow((typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Value")) || 0 : 0) / (( gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1.length === 0 ) ? 0 :gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1[0].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).ScaleVolume((typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined))), 1 / 3)); +}{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).setScaleZ(gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Object3D")).getScaleZ() * (gdjs.evtTools.variable.getVariableNumber(runtimeScene.getScene().getVariables().get("_Tween3D").getChild("Ratio")))); +} +}{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).setScaleY(gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleY() * (gdjs.evtTools.variable.getVariableNumber(runtimeScene.getScene().getVariables().get("_Tween3D").getChild("Ratio")))); +} +}{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).setScaleX(gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Scale")).getScaleX() * (gdjs.evtTools.variable.getVariableNumber(runtimeScene.getScene().getVariables().get("_Tween3D").getChild("Ratio")))); +} +}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolume = function(Value, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "Value") return Value; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.SetScaleVolumeContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TintContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TintContext.GDObjectObjects1= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TintContext.userFunc0xcd02d8 = function GDJSInlineCode(runtimeScene, objects, eventsFunctionContext) { +"use strict"; +if (!runtimeScene.__tween3DExtension) { + runtimeScene.__tween3DExtension = { + tintManagers: new Map() + }; +} +const { tintManagers } = runtimeScene.__tween3DExtension; +if (objects.length === 0) { + eventsFunctionContext.returnValue = 0xffffff; +} +else { + const object = objects[0]; + let manager = tintManagers.get(object.getName()); + if (!manager) { + const { TintManager } = gdjs.__tween3DExtension; + manager = new TintManager(object); + tintManagers.set(object.getName(), manager); + } + eventsFunctionContext.returnValue = manager.getTint(object); +} + +}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TintContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TintContext.GDObjectObjects1); + +var objects = []; +objects.push.apply(objects,gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TintContext.GDObjectObjects1); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TintContext.userFunc0xcd02d8(runtimeScene, objects, typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined); + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.Tint = function(parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TintContext.GDObjectObjects1.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TintContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TintContext.GDObjectObjects1.length = 0; + + +return Number(eventsFunctionContext.returnValue) || 0; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchZContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchZContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchZContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchZContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchZContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchZContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchZContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).StartTween((typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("TweenIdentifier") : ""), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("TargetedValue")) || 0 : 0), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Duration")) || 0 : 0), (typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("Easing") : ""), "StretchZ", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchZ = function(TweenIdentifier, TargetedValue, Duration, Easing, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "TweenIdentifier") return TweenIdentifier; +if (argName === "TargetedValue") return TargetedValue; +if (argName === "Duration") return Duration; +if (argName === "Easing") return Easing; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchZContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchZContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchZContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchZContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchZContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchYContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchYContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchYContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchYContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchYContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchYContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchYContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).StartTween((typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("TweenIdentifier") : ""), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("TargetedValue")) || 0 : 0), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Duration")) || 0 : 0), (typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("Easing") : ""), "StretchY", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchY = function(TweenIdentifier, TargetedValue, Duration, Easing, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "TweenIdentifier") return TweenIdentifier; +if (argName === "TargetedValue") return TargetedValue; +if (argName === "Duration") return Duration; +if (argName === "Easing") return Easing; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchYContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchYContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchYContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchYContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenStretchYContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenScaleVolumeContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenScaleVolumeContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenScaleVolumeContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenScaleVolumeContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenScaleVolumeContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenScaleVolumeContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenScaleVolumeContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).StartTween((typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("TweenIdentifier") : ""), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("TargetedValue")) || 0 : 0), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Duration")) || 0 : 0), (typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("Easing") : ""), "ScaleVolume", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenScaleVolume = function(TweenIdentifier, TargetedValue, Duration, Easing, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "TweenIdentifier") return TweenIdentifier; +if (argName === "TargetedValue") return TargetedValue; +if (argName === "Duration") return Duration; +if (argName === "Easing") return Easing; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenScaleVolumeContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenScaleVolumeContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenScaleVolumeContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenScaleVolumeContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenScaleVolumeContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenTintContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenTintContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenTintContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenTintContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenTintContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenTintContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenTintContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior")).StartTween(eventsFunctionContext.getArgument("TweenIdentifier"), gdjs.evtsExt__Tween3D__RgbToNumber.func(runtimeScene, eventsFunctionContext.getArgument("TargetedValue"), (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)), eventsFunctionContext.getArgument("Duration"), eventsFunctionContext.getArgument("Easing"), "Tint", (typeof eventsFunctionContext !== 'undefined' ? eventsFunctionContext : undefined)); +} +}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenTint = function(TweenIdentifier, TargetedValue, Duration, Easing, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "TweenIdentifier") return TweenIdentifier; +if (argName === "TargetedValue") return TargetedValue; +if (argName === "Duration") return Duration; +if (argName === "Easing") return Easing; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenTintContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenTintContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenTintContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenTintContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenTintContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenPositionZContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenPositionZContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenPositionZContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenPositionZContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenPositionZContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenPositionZContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenPositionZContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween")).addObjectPositionZTween2(eventsFunctionContext.getBehaviorName("Object3D"), (typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("TweenIdentifier") : ""), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("TargetedValue")) || 0 : 0), (typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("Easing") : ""), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Duration")) || 0 : 0), false); +} +}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenPositionZ = function(TweenIdentifier, TargetedValue, Duration, Easing, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "TweenIdentifier") return TweenIdentifier; +if (argName === "TargetedValue") return TargetedValue; +if (argName === "Duration") return Duration; +if (argName === "Easing") return Easing; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenPositionZContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenPositionZContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenPositionZContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenPositionZContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenPositionZContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenDepthContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenDepthContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenDepthContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenDepthContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenDepthContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenDepthContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenDepthContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween")).addObjectDepthTween2(eventsFunctionContext.getBehaviorName("Object3D"), (typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("TweenIdentifier") : ""), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("TargetedValue")) || 0 : 0), (typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("Easing") : ""), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Duration")) || 0 : 0), false); +} +}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenDepth = function(TweenIdentifier, TargetedValue, Duration, Easing, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "TweenIdentifier") return TweenIdentifier; +if (argName === "TargetedValue") return TargetedValue; +if (argName === "Duration") return Duration; +if (argName === "Easing") return Easing; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenDepthContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenDepthContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenDepthContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenDepthContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenDepthContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationXContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationXContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationXContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationXContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationXContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationXContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationXContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween")).addObjectRotationXTween(eventsFunctionContext.getBehaviorName("Object3D"), (typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("TweenIdentifier") : ""), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("TargetedValue")) || 0 : 0), (typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("Easing") : ""), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Duration")) || 0 : 0), false); +} +}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationX = function(TweenIdentifier, TargetedValue, Duration, Easing, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "TweenIdentifier") return TweenIdentifier; +if (argName === "TargetedValue") return TargetedValue; +if (argName === "Duration") return Duration; +if (argName === "Easing") return Easing; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationXContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationXContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationXContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationXContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationXContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationYContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationYContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationYContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationYContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + + +let isConditionTrue_0 = false; +{ +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationYContext.GDObjectObjects1); +{for(var i = 0, len = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationYContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationYContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Tween")).addObjectRotationYTween(eventsFunctionContext.getBehaviorName("Object3D"), (typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("TweenIdentifier") : ""), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("TargetedValue")) || 0 : 0), (typeof eventsFunctionContext !== 'undefined' ? "" + eventsFunctionContext.getArgument("Easing") : ""), (typeof eventsFunctionContext !== 'undefined' ? Number(eventsFunctionContext.getArgument("Duration")) || 0 : 0), false); +} +}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationY = function(TweenIdentifier, TargetedValue, Duration, Easing, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "TweenIdentifier") return TweenIdentifier; +if (argName === "TargetedValue") return TargetedValue; +if (argName === "Duration") return Duration; +if (argName === "Easing") return Easing; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationYContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationYContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationYContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationYContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.TweenRotationYContext.GDObjectObjects2.length = 0; + + +return; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.doStepPreEventsContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.doStepPreEventsContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.doStepPreEventsContext.GDObjectObjects2= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.doStepPreEventsContext.GDObjectObjects3= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.doStepPreEventsContext.GDObjectObjects4= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.doStepPreEventsContext.GDObjectObjects5= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.doStepPreEventsContext.mapOfGDgdjs_9546evtsExt_9595_9595Tween3D_9595_9595Tween3D_9546Tween3D_9546prototype_9546doStepPreEventsContext_9546GDObjectObjects3Objects = Hashtable.newFrom({"Object": gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.doStepPreEventsContext.GDObjectObjects3}); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.doStepPreEventsContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.doStepPreEventsContext.GDObjectObjects3, gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.doStepPreEventsContext.GDObjectObjects4); + + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.doStepPreEventsContext.GDObjectObjects4.length;i= 1 ) { + isConditionTrue_0 = true; + gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.HasFinishedContext.GDObjectObjects1[k] = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.HasFinishedContext.GDObjectObjects1[i]; + ++k; + } +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.HasFinishedContext.GDObjectObjects1.length = k; +if (isConditionTrue_0) { +{if (typeof eventsFunctionContext !== 'undefined') { eventsFunctionContext.returnValue = true; }}} + +} + + +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.HasFinished = function(TweenIdentifier, parentEventsFunctionContext) { + +var that = this; +var runtimeScene = this._runtimeScene; +var thisObjectList = [this.owner]; +var Object = Hashtable.newFrom({Object: thisObjectList}); +var Behavior = this.name; +var eventsFunctionContext = { + _objectsMap: { +"Object": Object +}, + _objectArraysMap: { +"Object": thisObjectList +}, + _behaviorNamesMap: { +"Behavior": Behavior +, "Object3D": this._getObject3D() +, "Scale": this._getScale() +, "Tween": this._getTween() +}, + globalVariablesForExtension: runtimeScene.getGame().getVariablesForExtension("Tween3D"), + sceneVariablesForExtension: runtimeScene.getScene().getVariablesForExtension("Tween3D"), + localVariables: [], + getObjects: function(objectName) { + return eventsFunctionContext._objectArraysMap[objectName] || []; + }, + getObjectsLists: function(objectName) { + return eventsFunctionContext._objectsMap[objectName] || null; + }, + getBehaviorName: function(behaviorName) { + return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName; + }, + createObject: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + if (objectsList) { + const object = parentEventsFunctionContext ? + parentEventsFunctionContext.createObject(objectsList.firstKey()) : + runtimeScene.createObject(objectsList.firstKey()); + if (object) { + objectsList.get(objectsList.firstKey()).push(object); + eventsFunctionContext._objectArraysMap[objectName].push(object); + } + return object; } + return null; + }, + getInstancesCountOnScene: function(objectName) { + const objectsList = eventsFunctionContext._objectsMap[objectName]; + let count = 0; + if (objectsList) { + for(const objectName in objectsList.items) + count += parentEventsFunctionContext ? +parentEventsFunctionContext.getInstancesCountOnScene(objectName) : + runtimeScene.getInstancesCountOnScene(objectName); + } + return count; + }, + getLayer: function(layerName) { + return runtimeScene.getLayer(layerName); + }, + getArgument: function(argName) { +if (argName === "TweenIdentifier") return TweenIdentifier; + return ""; + }, + getOnceTriggers: function() { return that._onceTriggers; } +}; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.HasFinishedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.HasFinishedContext.GDObjectObjects2.length = 0; + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.HasFinishedContext.eventsList0(runtimeScene, eventsFunctionContext); +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.HasFinishedContext.GDObjectObjects1.length = 0; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.HasFinishedContext.GDObjectObjects2.length = 0; + + +return !!eventsFunctionContext.returnValue; +} +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ProgressContext = {}; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ProgressContext.GDObjectObjects1= []; +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ProgressContext.GDObjectObjects2= []; + + +gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ProgressContext.eventsList0 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ProgressContext.GDObjectObjects1); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Tween3D__Tween3D.Tween3D.prototype.ProgressContext.GDObjectObjects1.length;i= (gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects2[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getScaleMinTweenDuration()) ) { + isConditionTrue_0 = true; + gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects2[k] = gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects2[i]; + ++k; + } +} +gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects2.length = k; +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects2 */ +{for(var i = 0, len = gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects2.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects2[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setScaleMin((gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects2[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getScaleMinTweenTarget())); +} +}} + +} + + +};gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.eventsList1 = function(runtimeScene, eventsFunctionContext) { + +{ + +/* Reuse gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects1 */ + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects1.length;i= (gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getScaleMaxTweenDuration()) ) { + isConditionTrue_0 = true; + gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects1[k] = gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects1[i]; + ++k; + } +} +gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects1.length = k; +if (isConditionTrue_0) { +/* Reuse gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects1 */ +{for(var i = 0, len = gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects1.length ;i < len;++i) { + gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._setScaleMin((gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects1[i].getBehavior(eventsFunctionContext.getBehaviorName("Behavior"))._getScaleMinTweenTarget())); +} +}} + +} + + +};gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.eventsList2 = function(runtimeScene, eventsFunctionContext) { + +{ + +gdjs.copyArray(eventsFunctionContext.getObjects("Object"), gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects2); + +let isConditionTrue_0 = false; +isConditionTrue_0 = false; +for (var i = 0, k = 0, l = gdjs.evtsExt__Tween3D__Wobble.Wobble.prototype.doStepPreEventsContext.GDObjectObjects2.length;ih.error("Can't play an audio file: "+e),onloaderror:(u,e)=>h.error("Error while loading an audio file: "+e)},d=u=>u>1?1:u<0?0:u;class g{constructor(e,s,t,o){this._id=null;this._oncePlay=[];this._onPlay=[];this._howl=e,this._initialVolume=d(s),this._loop=t,this._rate=o}isLoaded(){return this._howl.state()==="loaded"}play(){if(this.isLoaded()){const e=this._howl.play(this._id===null?"__default":this._id);this._id=e,this._howl.volume(this._initialVolume,e),this._howl.loop(this._loop,e),this._howl.rate(a.HowlerSoundManager.clampRate(this._rate),e),this._onPlay.forEach(s=>{this.on("play",s),s(e)}),this._oncePlay.forEach(s=>s(e)),this._onPlay=[],this._oncePlay=[]}else this._howl.once("load",()=>this.play());return this}pause(){return this._id!==null&&this._howl.pause(this._id),this}stop(){return this._id!==null&&this._howl.stop(this._id),this}playing(){return(this._id!==null?this._howl.playing(this._id):!0)||!this.isLoaded()}paused(){return!this.playing()}stopped(){return this.paused()&&this.getSeek()===0}getRate(){return this._rate}setRate(e){return this._rate=e,this._id!==null&&(e=a.HowlerSoundManager.clampRate(e),this._howl.rate(e,this._id)),this}getLoop(){return this._loop}setLoop(e){return this._loop=e,this._id!==null&&this._howl.loop(e,this._id),this}getVolume(){return this._id===null?this._initialVolume:this._howl.volume(this._id)}setVolume(e){return this._initialVolume=d(e),this._id!==null&&this._howl.volume(this._initialVolume,this._id),this}getMute(){return this._id===null?!1:this._howl.mute(this._id)}setMute(e){return this._id!==null&&this._howl.mute(e,this._id),this}getSeek(){return this._id===null?0:this._howl.seek(this._id)}setSeek(e){return this._id!==null&&this._howl.seek(e,this._id),this}getSpatialPosition(e){return this._id===null?0:this._howl.pos(this._id)[e==="x"?0:e==="y"?1:2]}setSpatialPosition(e,s,t){return this._id!==null&&this._howl.pos(e,s,t,this._id),this}fade(e,s,t){return this._id!==null&&this._howl.fade(d(e),d(s),t,this._id),this}on(e,s){return e==="play"?this._id===null?this._onPlay.push(s):this._howl.on(e,s,this._id):this._id===null?this.once("play",()=>this.on(e,s)):this._howl.on(e,s,this._id),this}once(e,s){return e==="play"?this._id===null?this._oncePlay.push(s):this.playing()?s(this._id):this._howl.once(e,s,this._id):this._id===null?this.once("play",()=>this.once(e,s)):this._howl.once(e,s,this._id),this}off(e,s){return this._id!==null&&this._howl.off(e,s,this._id),this}}a.HowlerSound=g;class p{constructor(e){this._loadedMusics=new a.ResourceCache;this._loadedSounds=new a.ResourceCache;this._availableResources={};this._globalVolume=100;this._sounds={};this._musics={};this._freeSounds=[];this._freeMusics=[];this._pausedSounds=[];this._paused=!1;this._getAudioResource=e=>{const s=this._resourceLoader.getResource(e);return s&&this.getResourceKinds().includes(s.kind)?s:{file:e,kind:"audio",metadata:"",name:e}};this._resourceLoader=e;const s=this;document.addEventListener("deviceready",function(){document.addEventListener("pause",function(){const t=s._freeSounds.concat(s._freeMusics);for(let o in s._sounds)s._sounds.hasOwnProperty(o)&&t.push(s._sounds[o]);for(let o in s._musics)s._musics.hasOwnProperty(o)&&t.push(s._musics[o]);for(let o=0;o4?4:e<.5?.5:e}_storeSoundInArray(e,s){for(let t=0,o=e.length;t{this._paused&&(i.pause(),this._pausedSounds.push(i))}),i.play()}playSoundOnChannel(e,s,t,o,i){this._sounds[s]&&this._sounds[s].stop();const l=this.createHowlerSound(e,!1,o/100,t,i);this._sounds[s]=l,l.once("play",()=>{this._paused&&(l.pause(),this._pausedSounds.push(l))}),l.play()}getSoundOnChannel(e){return this._sounds[e]||null}playMusic(e,s,t,o){const i=this.createHowlerSound(e,!0,t/100,s,o);this._storeSoundInArray(this._freeMusics,i),i.once("play",()=>{this._paused&&(i.pause(),this._pausedSounds.push(i))}),i.play()}playMusicOnChannel(e,s,t,o,i){this._musics[s]&&this._musics[s].stop();const l=this.createHowlerSound(e,!0,o/100,t,i);this._musics[s]=l,l.once("play",()=>{this._paused&&(l.pause(),this._pausedSounds.push(l))}),l.play()}getMusicOnChannel(e){return this._musics[e]||null}setGlobalVolume(e){this._globalVolume=e,this._globalVolume>100&&(this._globalVolume=100),this._globalVolume<0&&(this._globalVolume=0),Howler.volume(this._globalVolume/100)}getGlobalVolume(){return this._globalVolume}clearAll(){Howler.stop(),this._freeSounds.length=0,this._freeMusics.length=0,this._sounds={},this._musics={},this._pausedSounds.length=0}async processResource(e){}async loadResource(e){const s=this._resourceLoader.getResource(e);if(!s){h.warn('Unable to find audio for resource "'+e+'".');return}if(s.file){if(this._availableResources[s.name])return;this._availableResources[s.name]=s}const t=(i,l)=>new Promise((r,n)=>{const _=l?this._loadedMusics:this._loadedSounds;_[i]=new Howl(Object.assign({},c,{src:[this._resourceLoader.getFullUrl(i)],onload:r,onloaderror:(y,w)=>n(w),html5:l,xhr:{withCredentials:this._resourceLoader.checkIfCredentialsRequired(i)},volume:0}))}),o=s.file;if(s.preloadAsMusic)try{await t(o,!0)}catch(i){h.warn("There was an error while preloading an audio file: "+i)}if(s.preloadAsSound)try{await t(o,!1)}catch(i){h.warn("There was an error while preloading an audio file: "+i)}else if(s.preloadInCache||!s.preloadAsMusic)try{await new Promise((i,l)=>{const r=new XMLHttpRequest;r.withCredentials=this._resourceLoader.checkIfCredentialsRequired(o),r.addEventListener("load",i),r.addEventListener("error",n=>l("XHR error: "+o)),r.addEventListener("abort",n=>l("XHR abort: "+o)),r.open("GET",this._resourceLoader.getFullUrl(o)),r.send()})}catch(i){h.warn("There was an error while preloading an audio file: "+i)}}dispose(){this.unloadAll()}}a.HowlerSoundManager=p,a.SoundManager=p})(gdjs||(gdjs={})); +//# sourceMappingURL=howler-sound-manager.js.map diff --git a/howler-sound-manager/howler.min.js b/howler-sound-manager/howler.min.js new file mode 100644 index 0000000000000000000000000000000000000000..c03115066ec33ea643bced02ec89a7aac150ee2a --- /dev/null +++ b/howler-sound-manager/howler.min.js @@ -0,0 +1,3 @@ +/*! howler.js v2.2.3 | (c) 2013-2020, James Simpson of GoldFire Studios | MIT License | howlerjs.com */ +/* Modified for GDevelop by reverting commit 0323af9b843351cacc47893aed8e65cd8ba3b0cb to fix https://github.com/goldfire/howler.js/issues/1603 */ +!function(){"use strict";var e=function(){this.init()};e.prototype={init:function(){var e=this||n;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=!1,e.usingWebAudio=!0,e.autoSuspend=!0,e.ctx=null,e.autoUnlock=!0,e._setup(),e},volume:function(e){var o=this||n;if(e=parseFloat(e),o.ctx||_(),void 0!==e&&e>=0&&e<=1){if(o._volume=e,o._muted)return o;o.usingWebAudio&&o.masterGain.gain.setValueAtTime(e,n.ctx.currentTime);for(var t=0;t=0;o--)e._howls[o].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,_()),e},codecs:function(e){return(this||n)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||n;if(e.state=e.ctx?e.ctx.state||"suspended":"suspended",e._autoSuspend(),!e.usingWebAudio)if("undefined"!=typeof Audio)try{var o=new Audio;void 0===o.oncanplaythrough&&(e._canPlayEvent="canplay")}catch(n){e.noAudio=!0}else e.noAudio=!0;try{var o=new Audio;o.muted&&(e.noAudio=!0)}catch(e){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||n,o=null;try{o="undefined"!=typeof Audio?new Audio:null}catch(n){return e}if(!o||"function"!=typeof o.canPlayType)return e;var t=o.canPlayType("audio/mpeg;").replace(/^no$/,""),r=e._navigator?e._navigator.userAgent:"",a=r.match(/OPR\/([0-6].)/g),u=a&&parseInt(a[0].split("/")[1],10)<33,d=-1!==r.indexOf("Safari")&&-1===r.indexOf("Chrome"),i=r.match(/Version\/(.*?) /),_=d&&i&&parseInt(i[1],10)<15;return e._codecs={mp3:!(u||!t&&!o.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!t,opus:!!o.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(o.canPlayType('audio/wav; codecs="1"')||o.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!o.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!o.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(o.canPlayType("audio/x-m4a;")||o.canPlayType("audio/m4a;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(o.canPlayType("audio/x-m4b;")||o.canPlayType("audio/m4b;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(o.canPlayType("audio/x-mp4;")||o.canPlayType("audio/mp4;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!o.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(o.canPlayType("audio/x-flac;")||o.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||n;if(!e._audioUnlocked&&e.ctx){e._audioUnlocked=!1,e.autoUnlock=!1,e._mobileUnloaded||44100===e.ctx.sampleRate||(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var o=function(n){for(;e._html5AudioPool.length0?d._seek:t._sprite[e][0]/1e3),s=Math.max(0,(t._sprite[e][0]+t._sprite[e][1])/1e3-_),l=1e3*s/Math.abs(d._rate),c=t._sprite[e][0]/1e3,f=(t._sprite[e][0]+t._sprite[e][1])/1e3;d._sprite=e,d._ended=!1;var p=function(){d._paused=!1,d._seek=_,d._start=c,d._stop=f,d._loop=!(!d._loop&&!t._sprite[e][2])};if(_>=f)return void t._ended(d);var m=d._node;if(t._webAudio){var v=function(){t._playLock=!1,p(),t._refreshBuffer(d);var e=d._muted||t._muted?0:d._volume;m.gain.setValueAtTime(e,n.ctx.currentTime),d._playStart=n.ctx.currentTime,void 0===m.bufferSource.start?d._loop?m.bufferSource.noteGrainOn(0,_,86400):m.bufferSource.noteGrainOn(0,_,s):d._loop?m.bufferSource.start(0,_,86400):m.bufferSource.start(0,_,s),l!==1/0&&(t._endTimers[d._id]=setTimeout(t._ended.bind(t,d),l)),o||setTimeout(function(){t._emit("play",d._id),t._loadQueue()},0)};"running"===n.state&&"interrupted"!==n.ctx.state?v():(t._playLock=!0,t.once("resume",v),t._clearTimer(d._id))}else{var h=function(){m.currentTime=_,m.muted=d._muted||t._muted||n._muted||m.muted,m.volume=d._volume*n.volume(),m.playbackRate=d._rate;try{var r=m.play();if(r&&"undefined"!=typeof Promise&&(r instanceof Promise||"function"==typeof r.then)?(t._playLock=!0,p(),r.then(function(){t._playLock=!1,m._unlocked=!0,o||(t._emit("play",d._id),t._loadQueue())}).catch(function(){t._playLock=!1,t._emit("playerror",d._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),d._ended=!0,d._paused=!0})):o||(t._playLock=!1,p(),t._emit("play",d._id),t._loadQueue()),m.playbackRate=d._rate,m.paused)return void t._emit("playerror",d._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==e||d._loop?t._endTimers[d._id]=setTimeout(t._ended.bind(t,d),l):(t._endTimers[d._id]=function(){t._ended(d),m.removeEventListener("ended",t._endTimers[d._id],!1)},m.addEventListener("ended",t._endTimers[d._id],!1))}catch(e){t._emit("playerror",d._id,e)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===m.src&&(m.src=t._src,m.load());var y=window&&window.ejecta||!m.readyState&&n._navigator.isCocoonJS;if(m.readyState>=3||y)h();else{t._playLock=!0,t._state="loading";var g=function(){t._state="loaded",h(),m.removeEventListener(n._canPlayEvent,g,!1)};m.addEventListener(n._canPlayEvent,g,!1),t._clearTimer(d._id)}}return d._id},pause:function(e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"pause",action:function(){n.pause(e)}}),n;for(var o=n._getSoundIds(e),t=0;t=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else r.length>=2&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var a;if(!(void 0!==e&&e>=0&&e<=1))return a=o?t._soundById(o):t._sounds[0],a?a._volume:0;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"volume",action:function(){t.volume.apply(t,r)}}),t;void 0===o&&(t._volume=e),o=t._getSoundIds(o);for(var u=0;u0?t/_:t),l=Date.now();e._fadeTo=o,e._interval=setInterval(function(){var r=(Date.now()-l)/t;l=Date.now(),d+=i*r,d=Math.round(100*d)/100,d=i<0?Math.max(o,d):Math.min(o,d),u._webAudio?e._volume=d:u.volume(d,e._id,!0),a&&(u._volume=d),(on&&d>=o)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,u.volume(o,e._id),u._emit("fade",e._id))},s)},_stopFade:function(e){var o=this,t=o._soundById(e);return t&&t._interval&&(o._webAudio&&t._node.gain.cancelScheduledValues(n.ctx.currentTime),clearInterval(t._interval),t._interval=null,o.volume(t._fadeTo,e),t._fadeTo=null,o._emit("fade",e)),o},loop:function(){var e,n,o,t=this,r=arguments;if(0===r.length)return t._loop;if(1===r.length){if("boolean"!=typeof r[0])return!!(o=t._soundById(parseInt(r[0],10)))&&o._loop;e=r[0],t._loop=e}else 2===r.length&&(e=r[0],n=parseInt(r[1],10));for(var a=t._getSoundIds(n),u=0;u=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var d;if("number"!=typeof e)return d=t._soundById(o),d?d._rate:t._rate;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"rate",action:function(){t.rate.apply(t,r)}}),t;void 0===o&&(t._rate=e),o=t._getSoundIds(o);for(var i=0;i=0?o=parseInt(r[0],10):t._sounds.length&&(o=t._sounds[0]._id,e=parseFloat(r[0]))}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));if(void 0===o)return 0;if("number"==typeof e&&("loaded"!==t._state||t._playLock))return t._queue.push({event:"seek",action:function(){t.seek.apply(t,r)}}),t;var d=t._soundById(o);if(d){if(!("number"==typeof e&&e>=0)){if(t._webAudio){var i=t.playing(o)?n.ctx.currentTime-d._playStart:0,_=d._rateSeek?d._rateSeek-d._seek:0;return d._seek+(_+i*Math.abs(d._rate))}return d._node.currentTime}var s=t.playing(o);s&&t.pause(o,!0),d._seek=e,d._ended=!1,t._clearTimer(o),t._webAudio||!d._node||isNaN(d._node.duration)||(d._node.currentTime=e);var l=function(){t._emit("seek",o),s&&t.play(o,!0)};if(s&&!t._webAudio){var c=function(){t._playLock?setTimeout(c,0):l()};setTimeout(c,0)}else l()}return t},playing:function(e){var n=this;if("number"==typeof e){var o=n._soundById(e);return!!o&&!o._paused}for(var t=0;t=0&&n._howls.splice(a,1);var u=!0;for(t=0;t=0){u=!1;break}return r&&u&&delete r[e._src],n.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,n,o,t){var r=this,a=r["_on"+e];return"function"==typeof n&&a.push(t?{id:o,fn:n,once:t}:{id:o,fn:n}),r},off:function(e,n,o){var t=this,r=t["_on"+e],a=0;if("number"==typeof n&&(o=n,n=null),n||o)for(a=0;a=0;a--)r[a].id&&r[a].id!==n&&"load"!==e||(setTimeout(function(e){e.call(this,n,o)}.bind(t,r[a].fn),0),r[a].once&&t.off(e,r[a].fn,r[a].id));return t._loadQueue(e),t},_loadQueue:function(e){var n=this;if(n._queue.length>0){var o=n._queue[0];o.event===e&&(n._queue.shift(),n._loadQueue()),e||o.action()}return n},_ended:function(e){var o=this,t=e._sprite;if(!o._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime=0;t--){if(o<=n)return;e._sounds[t]._ended&&(e._webAudio&&e._sounds[t]._node&&e._sounds[t]._node.disconnect(0),e._sounds.splice(t,1),o--)}}},_getSoundIds:function(e){var n=this;if(void 0===e){for(var o=[],t=0;t=0;if(n._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),t))try{e.bufferSource.buffer=n._scratchBuffer}catch(e){}return e.bufferSource=null,o},_clearSound:function(e){/MSIE |Trident\//.test(n._navigator&&n._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var t=function(e){this._parent=e,this.init()};t.prototype={init:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,o._sounds.push(e),e.create(),e},create:function(){var e=this,o=e._parent,t=n._muted||e._muted||e._parent._muted?0:e._volume;return o._webAudio?(e._node=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),e._node.gain.setValueAtTime(t,n.ctx.currentTime),e._node.paused=!0,e._node.connect(n.masterGain)):n.noAudio||(e._node=n._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(n._canPlayEvent,e._loadFn,!1),e._endFn=e._endListener.bind(e),e._node.addEventListener("ended",e._endFn,!1),e._node.src=o._src,e._node.preload=!0===o._preload?"auto":o._preload,e._node.volume=t*n.volume(),e._node.load()),e},reset:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this,o=e._parent;o._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(o._sprite).length&&(o._sprite={__default:[0,1e3*o._duration]}),"loaded"!==o._state&&(o._state="loaded",o._emit("load"),o._loadQueue()),e._node.removeEventListener(n._canPlayEvent,e._loadFn,!1)},_endListener:function(){var e=this,n=e._parent;n._duration===1/0&&(n._duration=Math.ceil(10*e._node.duration)/10,n._sprite.__default[1]===1/0&&(n._sprite.__default[1]=1e3*n._duration),n._ended(e)),e._node.removeEventListener("ended",e._endFn,!1)}};var r={},a=function(e){var n=e._src;if(r[n])return e._duration=r[n].duration,void i(e);if(/^data:[^;]+;base64,/.test(n)){for(var o=atob(n.split(",")[1]),t=new Uint8Array(o.length),a=0;a0?(r[o._src]=e,i(o,e)):t()};"undefined"!=typeof Promise&&1===n.ctx.decodeAudioData.length?n.ctx.decodeAudioData(e).then(a).catch(t):n.ctx.decodeAudioData(e,a,t)},i=function(e,n){n&&!e._duration&&(e._duration=n.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},_=function(){if(n.usingWebAudio){try{"undefined"!=typeof AudioContext?n.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?n.ctx=new webkitAudioContext:n.usingWebAudio=!1}catch(e){n.usingWebAudio=!1}n.ctx||(n.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(n._navigator&&n._navigator.platform),o=n._navigator&&n._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),t=o?parseInt(o[1],10):null;if(e&&t&&t<9){var r=/safari/.test(n._navigator&&n._navigator.userAgent.toLowerCase());n._navigator&&!r&&(n.usingWebAudio=!1)}n.usingWebAudio&&(n.masterGain=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),n.masterGain.gain.setValueAtTime(n._muted?0:n._volume,n.ctx.currentTime),n.masterGain.connect(n.ctx.destination)),n._setup()}};"function"==typeof define&&define.amd&&define([],function(){return{Howler:n,Howl:o}}),"undefined"!=typeof exports&&(exports.Howler=n,exports.Howl=o),"undefined"!=typeof global?(global.HowlerGlobal=e,global.Howler=n,global.Howl=o,global.Sound=t):"undefined"!=typeof window&&(window.HowlerGlobal=e,window.Howler=n,window.Howl=o,window.Sound=t)}(); diff --git a/index.html b/index.html index b0c4b3666032a737f3903db53e6a8a9272483e28..dab3add305e6603a8ccae523e1b407625ada3c9e 100644 --- a/index.html +++ b/index.html @@ -1,19 +1,243 @@ - + - - - - My static Space - - - -
-

Welcome to your static Space!

-

You can modify this app directly by editing index.html in the Files and versions tab.

-

- Also don't forget to check the - Spaces documentation. -

-
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/inputmanager.js b/inputmanager.js new file mode 100644 index 0000000000000000000000000000000000000000..4e8d1bc167ba01661aaf26bbffc4d62d48d0560d --- /dev/null +++ b/inputmanager.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){const o=class{constructor(){this._lastPressedKey=0;this._cursorX=0;this._cursorY=0;this._mouseX=0;this._mouseY=0;this._isMouseInsideCanvas=!0;this._mouseWheelDelta=0;this._touches={firstKey:()=>{for(const e in this._mouseOrTouches.items)if(e!=="1")return e;return null}};this._startedTouches=[];this._endedTouches=[];this._touchSimulateMouse=!0;this._lastStartedTouchIndex=0;this._lastEndedTouchIndex=0;this._pressedKeys=new Hashtable,this._releasedKeys=new Hashtable,this._pressedMouseButtons=new Array(5),this._releasedMouseButtons=new Array(5),this._mouseOrTouches=new Hashtable}_getLocationAwareKeyCode(e,s){return s?96<=e&&e<=105?e:e+1e3*s:o._DEFAULT_LEFT_VARIANT_KEYS.indexOf(e)!==-1?e+1e3:e}onKeyPressed(e,s){const t=this._getLocationAwareKeyCode(e,s);this._pressedKeys.put(t,!0),this._lastPressedKey=t}onKeyReleased(e,s){const t=this._getLocationAwareKeyCode(e,s);this._pressedKeys.put(t,!1),this._releasedKeys.put(t,!0)}getLastPressedKey(){return this._lastPressedKey}isKeyPressed(e){return this._pressedKeys.containsKey(e)&&this._pressedKeys.get(e)}wasKeyReleased(e){return this._releasedKeys.containsKey(e)&&this._releasedKeys.get(e)}anyKeyPressed(){for(const e in this._pressedKeys.items)if(this._pressedKeys.items.hasOwnProperty(e)&&this._pressedKeys.items[e])return!0;return!1}anyKeyReleased(){for(const e in this._releasedKeys.items)if(this._releasedKeys.items.hasOwnProperty(e)&&this._releasedKeys.items[e])return!0;return!1}onMouseMove(e,s){this._setCursorPosition(e,s),this._mouseX=e,this._mouseY=s,this.isMouseButtonPressed(o.MOUSE_LEFT_BUTTON)&&this._moveTouch(o.MOUSE_TOUCH_ID,this.getCursorX(),this.getCursorY())}_setCursorPosition(e,s){this._cursorX=e,this._cursorY=s}getCursorX(){return this._cursorX}getCursorY(){return this._cursorY}getMouseX(){return this._mouseX}getMouseY(){return this._mouseY}onMouseLeave(){this._isMouseInsideCanvas=!1}onMouseEnter(){this._isMouseInsideCanvas=!0}isMouseInsideCanvas(){return this._isMouseInsideCanvas}onMouseButtonPressed(e){this._setMouseButtonPressed(e),e===o.MOUSE_LEFT_BUTTON&&this._addTouch(o.MOUSE_TOUCH_ID,this.getCursorX(),this.getCursorY())}_setMouseButtonPressed(e){this._pressedMouseButtons[e]=!0,this._releasedMouseButtons[e]=!1}onMouseButtonReleased(e){this._setMouseButtonReleased(e),e===o.MOUSE_LEFT_BUTTON&&this._removeTouch(o.MOUSE_TOUCH_ID)}_setMouseButtonReleased(e){this._pressedMouseButtons[e]=!1,this._releasedMouseButtons[e]=!0}isMouseButtonPressed(e){return this._pressedMouseButtons[e]!==void 0&&this._pressedMouseButtons[e]}isMouseButtonReleased(e){return this._releasedMouseButtons[e]!==void 0&&this._releasedMouseButtons[e]}onMouseWheel(e){this._mouseWheelDelta=e}getMouseWheelDelta(){return this._mouseWheelDelta}getTouchX(e){return this._mouseOrTouches.containsKey(e)?this._mouseOrTouches.get(e).x:0}getTouchY(e){return this._mouseOrTouches.containsKey(e)?this._mouseOrTouches.get(e).y:0}hasTouchEnded(e){return this._mouseOrTouches.containsKey(e)?this._mouseOrTouches.get(e).justEnded:!1}getAllTouchIdentifiers(){o._allTouchIds.length=0;for(const e in this._mouseOrTouches.items)this._mouseOrTouches.items.hasOwnProperty(e)&&o._allTouchIds.push(parseInt(e,10));return o._allTouchIds}onTouchStart(e,s,t){this._addTouch(this.getPublicTouchIdentifier(e),s,t),this._touchSimulateMouse&&(this._setCursorPosition(s,t),this._setMouseButtonPressed(o.MOUSE_LEFT_BUTTON))}_addTouch(e,s,t){this._endedTouches.includes(e)||(this._startedTouches.push(e),this._mouseOrTouches.put(e,{x:s,y:t,justEnded:!1}))}onTouchMove(e,s,t){this._moveTouch(this.getPublicTouchIdentifier(e),s,t),this._touchSimulateMouse&&this._setCursorPosition(s,t)}_moveTouch(e,s,t){const u=this._mouseOrTouches.get(e);!u||(u.x=s,u.y=t)}onTouchEnd(e){this._removeTouch(this.getPublicTouchIdentifier(e)),this._touchSimulateMouse&&this._setMouseButtonReleased(o.MOUSE_LEFT_BUTTON)}onTouchCancel(e){this.onTouchEnd(e)}_removeTouch(e){this._endedTouches.push(e),this._mouseOrTouches.containsKey(e)&&(this._mouseOrTouches.get(e).justEnded=!0)}getPublicTouchIdentifier(e){return e+2}getStartedTouchIdentifiers(){return this._startedTouches}popStartedTouch(){const e=this._startedTouches[this._lastStartedTouchIndex];return this._lastStartedTouchIndex++,e}popEndedTouch(){const e=this._endedTouches[this._lastEndedTouchIndex];return this._lastEndedTouchIndex++,e}touchSimulateMouse(e){e===void 0&&(e=!0),this._touchSimulateMouse=e}isSimulatingMouseWithTouch(){return this._touchSimulateMouse}onFrameEnded(){for(const e in this._mouseOrTouches.items)this._mouseOrTouches.items.hasOwnProperty(e)&&this._mouseOrTouches.items[e].justEnded&&this._mouseOrTouches.remove(e);this._startedTouches.length=0,this._endedTouches.length=0,this._releasedKeys.clear(),this._releasedMouseButtons.length=0,this._mouseWheelDelta=0,this._lastStartedTouchIndex=0,this._lastEndedTouchIndex=0}isScrollingUp(){return this.getMouseWheelDelta()>0}isScrollingDown(){return this.getMouseWheelDelta()<0}clearAllPressedKeys(){this._pressedKeys.clear()}};let r=o;r.MOUSE_LEFT_BUTTON=0,r.MOUSE_RIGHT_BUTTON=1,r.MOUSE_MIDDLE_BUTTON=2,r.MOUSE_BACK_BUTTON=3,r.MOUSE_FORWARD_BUTTON=4,r.MOUSE_TOUCH_ID=1,r._DEFAULT_LEFT_VARIANT_KEYS=[16,17,18,91],r._allTouchIds=[],i.InputManager=r})(gdjs||(gdjs={})); +//# sourceMappingURL=inputmanager.js.map diff --git a/jsonmanager.js b/jsonmanager.js new file mode 100644 index 0000000000000000000000000000000000000000..1669e7b4833e5850f370b15a3368d666c2b2f9fd --- /dev/null +++ b/jsonmanager.js @@ -0,0 +1,2 @@ +var gdjs;(function(c){const l=new c.Logger("JSON Manager"),i=["json","tilemap","tileset"];class u{constructor(s){this._loadedJsons=new c.ResourceCache;this._callbacks=new c.ResourceCache;this._getJsonResource=s=>{const r=this._resourceLoader.getResource(s);return r&&this.getResourceKinds().includes(r.kind)?r:null};this._resourceLoader=s}getResourceKinds(){return i}async loadResource(s){const r=this._resourceLoader.getResource(s);if(!r){l.warn('Unable to find json for resource "'+s+'".');return}if(!r.disablePreload)try{await this.loadJsonAsync(r.name)}catch(e){l.error(`Error while preloading json resource ${r.name}:`,e)}}loadJsonAsync(s){const r=this;return new Promise((e,t)=>{r.loadJson(s,(o,n)=>{o&&t(o.message),e(n)})})}async processResource(s){}loadJson(s,r){const e=this._getJsonResource(s);if(!e){r(new Error(`Can't find resource with name: "`+s+'" (or is not a json resource).'),null);return}if(this._loadedJsons.get(e)){r(null,this._loadedJsons.get(e));return}{const n=this._callbacks.get(e);if(n){n.push(r);return}else this._callbacks.set(e,[r])}const t=this,o=new XMLHttpRequest;o.responseType="json",o.withCredentials=this._resourceLoader.checkIfCredentialsRequired(e.file),o.open("GET",this._resourceLoader.getFullUrl(e.file)),o.onload=function(){const n=t._callbacks.get(e);if(!!n){if(o.status!==200){for(const a of n)a(new Error("HTTP error: "+o.status+"("+o.statusText+")"),null);t._callbacks.delete(e);return}t._loadedJsons.set(e,o.response);for(const a of n)a(null,o.response);t._callbacks.delete(e)}},o.onerror=function(){const n=t._callbacks.get(e);if(!!n){for(const a of n)a(new Error("Network error"),null);t._callbacks.delete(e)}},o.onabort=function(){const n=t._callbacks.get(e);if(!!n){for(const a of n)a(new Error("Request aborted"),null);t._callbacks.delete(e)}},o.send()}isJsonLoaded(s){return!!this._loadedJsons.getFromName(s)}getLoadedJson(s){return this._loadedJsons.getFromName(s)||null}dispose(){this._loadedJsons.clear(),this._callbacks.clear()}}c.JsonManager=u})(gdjs||(gdjs={})); +//# sourceMappingURL=jsonmanager.js.map diff --git a/layer.js b/layer.js new file mode 100644 index 0000000000000000000000000000000000000000..d92bd6c1c942d53eb2c5ae3c222bd59f198d1eaf --- /dev/null +++ b/layer.js @@ -0,0 +1,2 @@ +var gdjs;(function(h){class c extends h.RuntimeLayer{constructor(t,e){super(t,e);this._cameraRotation=0;this._zoomFactor=1;this._cameraZ=0;this._isCameraZDirty=!0;this._defaultCameraBehavior===h.RuntimeLayerDefaultCameraBehavior.TOP_LEFT_ANCHORED_IF_NEVER_MOVED?(this._cameraX=this._runtimeScene.getViewportOriginX(),this._cameraY=this._runtimeScene.getViewportOriginY()):(this._cameraX=(this._runtimeScene.getInitialUnrotatedViewportMinX()+this._runtimeScene.getInitialUnrotatedViewportMaxX())/2,this._cameraY=(this._runtimeScene.getInitialUnrotatedViewportMinY()+this._runtimeScene.getInitialUnrotatedViewportMaxY())/2),this.getCameraType()===h.RuntimeLayerCameraType.ORTHOGRAPHIC&&(this._cameraZ=(this._initialCamera3DFarPlaneDistance+this._initialCamera3DNearPlaneDistance)/2),this._renderer.onCreated()}onGameResolutionResized(t,e){this._defaultCameraBehavior===h.RuntimeLayerDefaultCameraBehavior.TOP_LEFT_ANCHORED_IF_NEVER_MOVED&&Math.abs(this._cameraX-t)<1&&Math.abs(this._cameraY-e)<1&&this._zoomFactor===1&&(this._cameraX+=this._runtimeScene.getViewportOriginX()-t,this._cameraY+=this._runtimeScene.getViewportOriginY()-e),this._renderer.updatePosition(),this._renderer.updateResolution()}getCameraX(t){return this._forceDimensionUpdate(),this._cameraX}getCameraY(t){return this._forceDimensionUpdate(),this._cameraY}setCameraX(t,e){this._forceDimensionUpdate(),this._cameraX=t,this._renderer.updatePosition()}setCameraY(t,e){this._forceDimensionUpdate(),this._cameraY=t,this._renderer.updatePosition()}getCameraWidth(t){return this.getWidth()/this._zoomFactor}getCameraHeight(t){return this.getHeight()/this._zoomFactor}setCameraZoom(t,e){this._zoomFactor=t,this._isCameraZDirty=!0,this._renderer.updatePosition()}getCameraZoom(t){return this._zoomFactor}setCameraZ(t,e,i){if(e){const r=h.toRad(e),a=Math.min(Number.MAX_SAFE_INTEGER,.5*this.getHeight()/(t*Math.tan(.5*r)));a>0&&(this._zoomFactor=a)}this._cameraZ=t,this._isCameraZDirty=!1,this._renderer.updatePosition()}getCameraZ(t,e){return!this._isCameraZDirty||!t?this._cameraZ:.5*this.getHeight()/this.getCameraZoom()/Math.tan(.5*h.toRad(t))}getCameraRotation(t){return this._cameraRotation}setCameraRotation(t,e){this._cameraRotation=t,this._renderer.updatePosition()}convertCoords(t,e,i=0,r){let a=r||[0,0];if(this._renderer.isCameraRotatedIn3D())return this._renderer.transformTo3DWorld(t,e,0,i,r);t-=this.getRuntimeScene()._cachedGameResolutionWidth/2,e-=this.getRuntimeScene()._cachedGameResolutionHeight/2,t/=Math.abs(this._zoomFactor),e/=Math.abs(this._zoomFactor);const n=this._cameraRotation/180*Math.PI,s=t,o=Math.cos(n),m=Math.sin(n);return t=o*t-m*e,e=m*s+o*e,a[0]=t+this.getCameraX(i),a[1]=e+this.getCameraY(i),a}applyLayerInverseTransformation(t,e,i,r){t-=this._runtimeScene.getViewportOriginX(),e-=this._runtimeScene.getViewportOriginY(),t/=Math.abs(this._zoomFactor),e/=Math.abs(this._zoomFactor);const a=this._cameraRotation/180*Math.PI,n=t,s=Math.cos(a),o=Math.sin(a);return t=s*t-o*e,e=o*n+s*e,r[0]=t+this.getCameraX(i),r[1]=e+this.getCameraY(i),r}convertInverseCoords(t,e,i=0,r){let a=r||[0,0];t-=this.getCameraX(i),e-=this.getCameraY(i);const n=this._cameraRotation/180*Math.PI,s=t,o=Math.cos(-n),m=Math.sin(-n);return t=o*t-m*e,e=m*s+o*e,t*=Math.abs(this._zoomFactor),e*=Math.abs(this._zoomFactor),a[0]=t+this.getRuntimeScene()._cachedGameResolutionWidth/2,a[1]=e+this.getRuntimeScene()._cachedGameResolutionHeight/2,a}applyLayerTransformation(t,e,i,r){t-=this.getCameraX(i),e-=this.getCameraY(i);const a=this._cameraRotation/180*Math.PI,n=t,s=Math.cos(-a),o=Math.sin(-a);return t=s*t-o*e,e=o*n+s*e,t*=Math.abs(this._zoomFactor),e*=Math.abs(this._zoomFactor),t+=this._runtimeScene.getViewportOriginX(),e+=this._runtimeScene.getViewportOriginY(),r[0]=t,r[1]=e,r}_forceDimensionUpdate(){this._runtimeScene.getViewportWidth()}}h.Layer=c})(gdjs||(gdjs={})); +//# sourceMappingURL=layer.js.map diff --git a/libs/jshashtable.js b/libs/jshashtable.js new file mode 100644 index 0000000000000000000000000000000000000000..efef5628915d5e2c9ab9104d37bc6ea558d03436 --- /dev/null +++ b/libs/jshashtable.js @@ -0,0 +1,2 @@ +class Hashtable{constructor(){this.items={}}static newFrom(t){const s=new Hashtable;return s.items=t,s}put(t,s){this.items[t]=s}get(t){return this.items[t]}containsKey(t){return this.items.hasOwnProperty(t)}remove(t){delete this.items[t]}firstKey(){for(const t in this.items)if(this.items.hasOwnProperty(t))return t;return null}keys(t){t.length=0;for(const s in this.items)this.items.hasOwnProperty(s)&&t.push(s)}values(t){t.length=0;for(const s in this.items)this.items.hasOwnProperty(s)&&t.push(this.items[s])}clear(){for(const t in this.items)this.items.hasOwnProperty(t)&&delete this.items[t]}} +//# sourceMappingURL=jshashtable.js.map diff --git a/libs/rbush.js b/libs/rbush.js new file mode 100644 index 0000000000000000000000000000000000000000..96c70f1a4354b80801296c905a69cfc1d81adf96 --- /dev/null +++ b/libs/rbush.js @@ -0,0 +1,624 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.rbush = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 0) { + if (insertPath[level].children.length > this._maxEntries) { + this._split(insertPath, level); + level--; + } else break; + } + + // adjust bboxes along the insertion path + this._adjustParentBBoxes(bbox, insertPath, level); + }, + + // split overflowed node into two + _split: function (insertPath, level) { + + var node = insertPath[level], + M = node.children.length, + m = this._minEntries; + + this._chooseSplitAxis(node, m, M); + + var splitIndex = this._chooseSplitIndex(node, m, M); + + var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex)); + newNode.height = node.height; + newNode.leaf = node.leaf; + + calcBBox(node, this.toBBox); + calcBBox(newNode, this.toBBox); + + if (level) insertPath[level - 1].children.push(newNode); + else this._splitRoot(node, newNode); + }, + + _splitRoot: function (node, newNode) { + // split root node + this.data = createNode([node, newNode]); + this.data.height = node.height + 1; + this.data.leaf = false; + calcBBox(this.data, this.toBBox); + }, + + _chooseSplitIndex: function (node, m, M) { + + var i, bbox1, bbox2, overlap, area, minOverlap, minArea, index; + + minOverlap = minArea = Infinity; + + for (i = m; i <= M - m; i++) { + bbox1 = distBBox(node, 0, i, this.toBBox); + bbox2 = distBBox(node, i, M, this.toBBox); + + overlap = intersectionArea(bbox1, bbox2); + area = bboxArea(bbox1) + bboxArea(bbox2); + + // choose distribution with minimum overlap + if (overlap < minOverlap) { + minOverlap = overlap; + index = i; + + minArea = area < minArea ? area : minArea; + + } else if (overlap === minOverlap) { + // otherwise choose distribution with minimum area + if (area < minArea) { + minArea = area; + index = i; + } + } + } + + return index; + }, + + // sorts node children by the best axis for split + _chooseSplitAxis: function (node, m, M) { + + var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, + compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, + xMargin = this._allDistMargin(node, m, M, compareMinX), + yMargin = this._allDistMargin(node, m, M, compareMinY); + + // if total distributions margin value is minimal for x, sort by minX, + // otherwise it's already sorted by minY + if (xMargin < yMargin) node.children.sort(compareMinX); + }, + + // total margin of all possible split distributions where each node is at least m full + _allDistMargin: function (node, m, M, compare) { + + node.children.sort(compare); + + var toBBox = this.toBBox, + leftBBox = distBBox(node, 0, m, toBBox), + rightBBox = distBBox(node, M - m, M, toBBox), + margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), + i, child; + + for (i = m; i < M - m; i++) { + child = node.children[i]; + extend(leftBBox, node.leaf ? toBBox(child) : child); + margin += bboxMargin(leftBBox); + } + + for (i = M - m - 1; i >= m; i--) { + child = node.children[i]; + extend(rightBBox, node.leaf ? toBBox(child) : child); + margin += bboxMargin(rightBBox); + } + + return margin; + }, + + _adjustParentBBoxes: function (bbox, path, level) { + // adjust bboxes along the given tree path + for (var i = level; i >= 0; i--) { + extend(path[i], bbox); + } + }, + + _condense: function (path) { + // go through the path, removing empty nodes and updating bboxes + for (var i = path.length - 1, siblings; i >= 0; i--) { + if (path[i].children.length === 0) { + if (i > 0) { + siblings = path[i - 1].children; + siblings.splice(siblings.indexOf(path[i]), 1); + + } else this.clear(); + + } else calcBBox(path[i], this.toBBox); + } + }, + + _initFormat: function (format) { + // data format (minX, minY, maxX, maxY accessors) + + // uses eval-type function compilation instead of just accepting a toBBox function + // because the algorithms are very sensitive to sorting functions performance, + // so they should be dead simple and without inner calls + + var compareArr = ['return a', ' - b', ';']; + + this.compareMinX = new Function('a', 'b', compareArr.join(format[0])); + this.compareMinY = new Function('a', 'b', compareArr.join(format[1])); + + this.toBBox = new Function('a', + 'return {minX: a' + format[0] + + ', minY: a' + format[1] + + ', maxX: a' + format[2] + + ', maxY: a' + format[3] + '};'); + } +}; + +function findItem(item, items, equalsFn) { + if (!equalsFn) return items.indexOf(item); + + for (var i = 0; i < items.length; i++) { + if (equalsFn(item, items[i])) return i; + } + return -1; +} + +// calculate node's bbox from bboxes of its children +function calcBBox(node, toBBox) { + distBBox(node, 0, node.children.length, toBBox, node); +} + +// min bounding rectangle of node children from k to p-1 +function distBBox(node, k, p, toBBox, destNode) { + if (!destNode) destNode = createNode(null); + destNode.minX = Infinity; + destNode.minY = Infinity; + destNode.maxX = -Infinity; + destNode.maxY = -Infinity; + + for (var i = k, child; i < p; i++) { + child = node.children[i]; + extend(destNode, node.leaf ? toBBox(child) : child); + } + + return destNode; +} + +function extend(a, b) { + a.minX = Math.min(a.minX, b.minX); + a.minY = Math.min(a.minY, b.minY); + a.maxX = Math.max(a.maxX, b.maxX); + a.maxY = Math.max(a.maxY, b.maxY); + return a; +} + +function compareNodeMinX(a, b) { return a.minX - b.minX; } +function compareNodeMinY(a, b) { return a.minY - b.minY; } + +function bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); } +function bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); } + +function enlargedArea(a, b) { + return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) * + (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY)); +} + +function intersectionArea(a, b) { + var minX = Math.max(a.minX, b.minX), + minY = Math.max(a.minY, b.minY), + maxX = Math.min(a.maxX, b.maxX), + maxY = Math.min(a.maxY, b.maxY); + + return Math.max(0, maxX - minX) * + Math.max(0, maxY - minY); +} + +function contains(a, b) { + return a.minX <= b.minX && + a.minY <= b.minY && + b.maxX <= a.maxX && + b.maxY <= a.maxY; +} + +function intersects(a, b) { + return b.minX <= a.maxX && + b.minY <= a.maxY && + b.maxX >= a.minX && + b.maxY >= a.minY; +} + +function createNode(children) { + return { + children: children, + height: 1, + leaf: true, + minX: Infinity, + minY: Infinity, + maxX: -Infinity, + maxY: -Infinity + }; +} + +// sort an array so that items come in groups of n unsorted items, with groups sorted between each other; +// combines selection algorithm with binary divide & conquer approach + +function multiSelect(arr, left, right, n, compare) { + var stack = [left, right], + mid; + + while (stack.length) { + right = stack.pop(); + left = stack.pop(); + + if (right - left <= n) continue; + + mid = left + Math.ceil((right - left) / n / 2) * n; + quickselect(arr, mid, left, right, compare); + + stack.push(left, mid, mid, right); + } +} + +},{"quickselect":2}],2:[function(require,module,exports){ +'use strict'; + +module.exports = partialSort; + +// Floyd-Rivest selection algorithm: +// Rearrange items so that all items in the [left, k] range are smaller than all items in (k, right]; +// The k-th element will have the (k - left + 1)th smallest value in [left, right] + +function partialSort(arr, k, left, right, compare) { + + while (right > left) { + if (right - left > 600) { + var n = right - left + 1; + var m = k - left + 1; + var z = Math.log(n); + var s = 0.5 * Math.exp(2 * z / 3); + var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1); + var newLeft = Math.max(left, Math.floor(k - m * s / n + sd)); + var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd)); + partialSort(arr, k, newLeft, newRight, compare); + } + + var t = arr[k]; + var i = left; + var j = right; + + swap(arr, left, k); + if (compare(arr[right], t) > 0) swap(arr, left, right); + + while (i < j) { + swap(arr, i, j); + i++; + j--; + while (compare(arr[i], t) < 0) i++; + while (compare(arr[j], t) > 0) j--; + } + + if (compare(arr[left], t) === 0) swap(arr, left, j); + else { + j++; + swap(arr, j, right); + } + + if (j <= k) left = j + 1; + if (k <= j) right = j - 1; + } +} + +function swap(arr, i, j) { + var tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; +} + +function defaultCompare(a, b) { + return a < b ? -1 : a > b ? 1 : 0; +} + +},{}]},{},[1])(1) +}); diff --git a/logger.js b/logger.js new file mode 100644 index 0000000000000000000000000000000000000000..98a4cf6e41f41ef05af09989f7d8b9683b5c7e2f --- /dev/null +++ b/logger.js @@ -0,0 +1,2 @@ +var gdjs;(function(l){const g={info:console.log,warning:console.warn,error:console.error};class i{constructor(){this.discardedConsoleGroups=new Set}discardGroup(o){this.discardedConsoleGroups.add(o)}enableGroup(o){this.discardedConsoleGroups.delete(o)}log(o,n,u="info",p=!0){if(this.discardedConsoleGroups.has(o))return;(g[u]||g.info)(`[${o}] ${n}`)}}const s=new i;let r=s;function t(e){return e.reduce((o,n)=>o+n.toString(),"")}class a{constructor(o){this.group=o}log(...o){r.log(this.group,t(o),"info")}info(...o){r.log(this.group,t(o),"info")}warn(...o){r.log(this.group,t(o),"warning")}error(...o){r.log(this.group,t(o),"error")}static getDefaultConsoleLoggerOutput(){return s}static getLoggerOutput(){return r}static setLoggerOutput(o){r=o}}l.Logger=a})(gdjs||(gdjs={})); +//# sourceMappingURL=logger.js.map diff --git a/manifest.webmanifest b/manifest.webmanifest new file mode 100644 index 0000000000000000000000000000000000000000..7f8e0c37605643676323a704c2efc7b9c05f1a27 --- /dev/null +++ b/manifest.webmanifest @@ -0,0 +1,12 @@ +{ + "name": "Zealous Support (3d bomber bunny)", + "short_name": "Zealous Support (3d bomber bunny)", + "id": "com.example", + "description": "This is a game example to show how to do a Bomberman clone with GDevelop. The source can be found directly in GDevelop in the examples list.\n\nControls are:\n\n- arrows and RShift\n- ESDF and LShift\n- IJKL and H\n- 8456 and 0\n- or gamepads\n\nAsset sources:\n\n- Bunnies, bombs and rocks are from Quaternius\n- Cabbages and walls are from Kenney", + "orientation": "landscape", + "start_url": "./index.html", + "display": "standalone", + "background_color": "black", + "categories": ["games", "entertainment"], + "icons": [] +} \ No newline at end of file diff --git a/object-capabilities/AnimatableBehavior.js b/object-capabilities/AnimatableBehavior.js new file mode 100644 index 0000000000000000000000000000000000000000..1e9b71c444d7ffc09fc55c348b4c2e28c3491ccc --- /dev/null +++ b/object-capabilities/AnimatableBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(t){class a extends t.RuntimeBehavior{constructor(e,i,n){super(e,i,n);this.object=n}usesLifecycleFunction(){return!1}updateFromBehaviorData(e,i){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(e){}doStepPostEvents(e){}getAnimationIndex(){return this.object.getAnimationIndex()}setAnimationIndex(e){this.object.setAnimationIndex(e)}getAnimationName(){return this.object.getAnimationName()}setAnimationName(e){this.object.setAnimationName(e)}hasAnimationEnded(){return this.object.hasAnimationEnded()}isAnimationPaused(){return this.object.isAnimationPaused()}pauseAnimation(){this.object.pauseAnimation()}resumeAnimation(){this.object.resumeAnimation()}getAnimationSpeedScale(){return this.object.getAnimationSpeedScale()}setAnimationSpeedScale(e){this.object.setAnimationSpeedScale(e)}getAnimationElapsedTime(){return this.object.getAnimationElapsedTime()}setAnimationElapsedTime(e){this.object.setAnimationElapsedTime(e)}getAnimationDuration(){return this.object.getAnimationDuration()}}t.AnimatableBehavior=a,t.registerBehavior("AnimatableCapability::AnimatableBehavior",t.AnimatableBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=AnimatableBehavior.js.map diff --git a/object-capabilities/EffectBehavior.js b/object-capabilities/EffectBehavior.js new file mode 100644 index 0000000000000000000000000000000000000000..0c6caf751f4740459b270e5066c5c9625dad4799 --- /dev/null +++ b/object-capabilities/EffectBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(n){class r extends n.RuntimeBehavior{constructor(e,t,a){super(e,t,a);this.object=a}usesLifecycleFunction(){return!1}updateFromBehaviorData(e,t){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(e){}doStepPostEvents(e){}setEffectDoubleParameter(e,t,a){return this.object.setEffectDoubleParameter(e,t,a)}setEffectStringParameter(e,t,a){return this.object.setEffectStringParameter(e,t,a)}setEffectBooleanParameter(e,t,a){return this.object.setEffectBooleanParameter(e,t,a)}enableEffect(e,t){this.object.enableEffect(e,t)}isEffectEnabled(e){return this.object.isEffectEnabled(e)}}n.EffectBehavior=r,n.registerBehavior("EffectCapability::EffectBehavior",n.EffectBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=EffectBehavior.js.map diff --git a/object-capabilities/FlippableBehavior.js b/object-capabilities/FlippableBehavior.js new file mode 100644 index 0000000000000000000000000000000000000000..d66137193d1b6928ec372b092df4c18fc89ce6ea --- /dev/null +++ b/object-capabilities/FlippableBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){class a extends i.RuntimeBehavior{constructor(e,t,o){super(e,t,o);this.object=o}usesLifecycleFunction(){return!1}updateFromBehaviorData(e,t){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(e){}doStepPostEvents(e){}flipX(e){this.object.flipX(e)}flipY(e){this.object.flipY(e)}isFlippedX(){return this.object.isFlippedX()}isFlippedY(){return this.object.isFlippedY()}}i.FlippableBehavior=a,i.registerBehavior("FlippableCapability::FlippableBehavior",i.FlippableBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=FlippableBehavior.js.map diff --git a/object-capabilities/OpacityBehavior.js b/object-capabilities/OpacityBehavior.js new file mode 100644 index 0000000000000000000000000000000000000000..dac793937645b7aa83f7baeb374171b8d20645c8 --- /dev/null +++ b/object-capabilities/OpacityBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(e){class n extends e.RuntimeBehavior{constructor(t,a,i){super(t,a,i);this.object=i}usesLifecycleFunction(){return!1}updateFromBehaviorData(t,a){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(t){}doStepPostEvents(t){}setOpacity(t){this.object.setOpacity(t)}getOpacity(){return this.object.getOpacity()}}e.OpacityBehavior=n,e.registerBehavior("OpacityCapability::OpacityBehavior",e.OpacityBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=OpacityBehavior.js.map diff --git a/object-capabilities/ResizableBehavior.js b/object-capabilities/ResizableBehavior.js new file mode 100644 index 0000000000000000000000000000000000000000..941b522a5841e065fdee9fb863fc70b3ef96e134 --- /dev/null +++ b/object-capabilities/ResizableBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){class o extends i.RuntimeBehavior{constructor(e,t,a){super(e,t,a);this.object=a}usesLifecycleFunction(){return!1}updateFromBehaviorData(e,t){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(e){}doStepPostEvents(e){}setWidth(e){this.object.setWidth(e)}setHeight(e){this.object.setHeight(e)}setSize(e,t){this.object.setSize(e,t)}getWidth(){return this.object.getWidth()}getHeight(){return this.object.getHeight()}}i.ResizableBehavior=o,i.registerBehavior("ResizableCapability::ResizableBehavior",i.ResizableBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=ResizableBehavior.js.map diff --git a/object-capabilities/ScalableBehavior.js b/object-capabilities/ScalableBehavior.js new file mode 100644 index 0000000000000000000000000000000000000000..b11bb21b49c1a003766a4ad9e9379dc38cb14f0d --- /dev/null +++ b/object-capabilities/ScalableBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(t){class o extends t.RuntimeBehavior{constructor(e,a,l){super(e,a,l);this.object=l}usesLifecycleFunction(){return!1}updateFromBehaviorData(e,a){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(e){}doStepPostEvents(e){}setScale(e){this.object.setScale(e)}setScaleX(e){this.object.setScaleX(e)}setScaleY(e){this.object.setScaleY(e)}getScale(){return this.object.getScale()}getScaleY(){return this.object.getScaleY()}getScaleX(){return this.object.getScaleX()}}t.ScalableBehavior=o,t.registerBehavior("ScalableCapability::ScalableBehavior",t.ScalableBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=ScalableBehavior.js.map diff --git a/object-capabilities/TextContainerBehavior.js b/object-capabilities/TextContainerBehavior.js new file mode 100644 index 0000000000000000000000000000000000000000..127373e430511ccc8c982d6469170a1179a0aeb1 --- /dev/null +++ b/object-capabilities/TextContainerBehavior.js @@ -0,0 +1,2 @@ +var gdjs;(function(t){class a extends t.RuntimeBehavior{constructor(e,n,i){super(e,n,i);this.object=i}usesLifecycleFunction(){return!1}updateFromBehaviorData(e,n){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(e){}doStepPostEvents(e){}getText(){return this.object.getText()}setText(e){this.object.setText(e)}}t.TextContainerBehavior=a,t.registerBehavior("TextContainerCapability::TextContainerBehavior",t.TextContainerBehavior)})(gdjs||(gdjs={})); +//# sourceMappingURL=TextContainerBehavior.js.map diff --git a/oncetriggers.js b/oncetriggers.js new file mode 100644 index 0000000000000000000000000000000000000000..d8dab5bd8b59e521f8c868c73fe4a35909e1d98f --- /dev/null +++ b/oncetriggers.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){class r{constructor(){this._onceTriggers={};this._lastFrameOnceTrigger={}}startNewFrame(){for(const e in this._lastFrameOnceTrigger)this._lastFrameOnceTrigger.hasOwnProperty(e)&&delete this._lastFrameOnceTrigger[e];for(const e in this._onceTriggers)this._onceTriggers.hasOwnProperty(e)&&(this._lastFrameOnceTrigger[e]=this._onceTriggers[e],delete this._onceTriggers[e])}triggerOnce(e){return this._onceTriggers[e]=!0,!this._lastFrameOnceTrigger.hasOwnProperty(e)}}i.OnceTriggers=r})(gdjs||(gdjs={})); +//# sourceMappingURL=oncetriggers.js.map diff --git a/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js b/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js new file mode 100644 index 0000000000000000000000000000000000000000..fe271d96830d22df4dbfb516dcbae576f97bae11 --- /dev/null +++ b/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js @@ -0,0 +1,2 @@ +var gdjs;(function(r){class a{constructor(e,t,i){this._isContainerDirty=!0;this._debugDraw=null;this._debugDrawContainer=null;this._object=e,this._instanceContainer=t,this._pixiContainer=new PIXI.Container,this._debugDrawRenderedObjectsPoints={},this._pixiContainer.sortableChildren=!0,this._debugDraw=null;const n=i.getLayer("");n&&n.getRenderer().addRendererObject(this._pixiContainer,e.getZOrder())}reinitialize(e,t){this._object=e,this._isContainerDirty=!0;const i=t.getLayer("");i&&i.getRenderer().addRendererObject(this._pixiContainer,e.getZOrder())}getRendererObject(){return this._pixiContainer}get3DRendererObject(){return null}_updatePIXIContainer(){const e=this._object.getScaleX(),t=this._object.getScaleY(),i=this._object.getOpacity();this._pixiContainer.pivot.x=this._object.getUnscaledCenterX(),this._pixiContainer.pivot.y=this._object.getUnscaledCenterY(),this._pixiContainer.position.x=this._object.getX()+this._pixiContainer.pivot.x*Math.abs(e),this._pixiContainer.position.y=this._object.getY()+this._pixiContainer.pivot.y*Math.abs(t),this._pixiContainer.rotation=r.toRad(this._object.angle),this._pixiContainer.scale.x=e*(this._object.isFlippedX()?-1:1),this._pixiContainer.scale.y=t*(this._object.isFlippedY()?-1:1),this._pixiContainer.visible=!this._object.hidden,this._pixiContainer.alpha=i/255,this._isContainerDirty=!1}ensureUpToDate(){this._isContainerDirty&&this._updatePIXIContainer()}update(){this._isContainerDirty=!0}updateX(){const e=this._object.getScaleX();this._pixiContainer.position.x=this._object.x+this._pixiContainer.pivot.x*Math.abs(e)}updateY(){const e=this._object.getScaleY();this._pixiContainer.position.y=this._object.y+this._pixiContainer.pivot.y*Math.abs(e)}updateAngle(){this._pixiContainer.rotation=r.toRad(this._object.angle)}updateOpacity(){const e=this._object.getOpacity();this._pixiContainer.alpha=e/255}updateVisibility(){this._pixiContainer.visible=!this._object.hidden}getPIXIContainer(){return this._pixiContainer}getPIXIRenderer(){return null}setLayerIndex(e,t){const i=e.getRenderer();let n=i.getRendererObject();e.isLightingLayer()&&(n=i.getLightingSprite()),!!n&&this._pixiContainer.children.indexOf(n)!==t&&(this._pixiContainer.removeChild(n),this._pixiContainer.addChildAt(n,t))}static getAnimationFrameTextureManager(e){return r.SpriteRuntimeObjectPixiRenderer.getAnimationFrameTextureManager(e)}}r.CustomRuntimeObject2DPixiRenderer=a,r.CustomRuntimeObject2DRenderer=r.CustomRuntimeObject2DPixiRenderer})(gdjs||(gdjs={})); +//# sourceMappingURL=CustomRuntimeObject2DPixiRenderer.js.map diff --git a/pixi-renderers/DebuggerPixiRenderer.js b/pixi-renderers/DebuggerPixiRenderer.js new file mode 100644 index 0000000000000000000000000000000000000000..9189a2e40968930021aad0fe773c35094fb8eddf --- /dev/null +++ b/pixi-renderers/DebuggerPixiRenderer.js @@ -0,0 +1,2 @@ +var gdjs;(function(g){class R{constructor(d){this._debugDraw=null;this._debugDrawContainer=null;this._instanceContainer=d,this._debugDrawRenderedObjectsPoints={},this._debugDraw=null}getRendererObject(){return this._debugDrawContainer}renderDebugDraw(d,h,P,_){const p=this._instanceContainer.getRenderer().getRendererObject();(!this._debugDraw||!this._debugDrawContainer)&&(this._debugDrawContainer=new PIXI.Container,this._debugDraw=new PIXI.Graphics,this._debugDrawContainer.addChild(this._debugDraw),p&&p.addChild(this._debugDrawContainer));const t=this._debugDraw;for(let r in this._debugDrawRenderedObjectsPoints)this._debugDrawRenderedObjectsPoints[r].wasRendered=!1;const u=(r,e,n,c,i)=>{t.line.color=n,t.fill.color=n,t.drawCircle(c,i,3),P&&(r[e]||(r[e]=new PIXI.Text(e,{fill:n,fontSize:12}),this._debugDrawContainer.addChild(r[e])),r[e].position.set(c,i))};t.clear(),t.beginFill(),t.alpha=.8,t.lineStyle(2,255,1);const l=[0,0];for(let r=0;r{s=n.applyLayerTransformation(s[0],s[1],0,l),b.push(s[0]),b.push(s[1])}),t.fill.alpha=0,t.line.alpha=.5,t.line.color=16711680,t.drawPolygon(b)}t.fill.alpha=.3;const D=n.applyLayerTransformation(e.getCenterXInScene(),e.getCenterYInScene(),0,l);u(o.points,"Center",16776960,D[0],D[1]);const f=n.applyLayerTransformation(e.getX(),e.getY(),0,l);if(u(o.points,"Position",16711680,f[0],f[1]),e instanceof g.SpriteRuntimeObject){let a=e.getPointPosition("origin");(Math.abs(a[0]-f[0])>=1||Math.abs(a[1]-f[1])>=1)&&(a=n.applyLayerTransformation(a[0],a[1],0,l),u(o.points,"Origin",16711680,a[0],a[1]))}if(_&&e instanceof g.SpriteRuntimeObject){const a=e._animator.getCurrentFrame();if(!a)continue;for(const b in a.points.items){let s=e.getPointPosition(b);s=n.applyLayerTransformation(s[0],s[1],0,l),u(o.points,b,255,s[0],s[1])}}}for(const r in this._debugDrawRenderedObjectsPoints){const e=this._debugDrawRenderedObjectsPoints[r];if(e.wasRendered)continue;const n=e.points;for(const c in n)this._debugDrawContainer.removeChild(n[c])}t.endFill()}clearDebugDraw(){if(this._debugDraw&&this._debugDraw.clear(),this._debugDrawContainer){this._debugDrawContainer.destroy({children:!0});const d=this._instanceContainer.getRenderer().getRendererObject();d&&d.removeChild(this._debugDrawContainer)}this._debugDraw=null,this._debugDrawContainer=null,this._debugDrawRenderedObjectsPoints={}}}g.DebuggerPixiRenderer=R,g.DebuggerRenderer=g.DebuggerPixiRenderer})(gdjs||(gdjs={})); +//# sourceMappingURL=DebuggerPixiRenderer.js.map diff --git a/pixi-renderers/ThreeAddons.js b/pixi-renderers/ThreeAddons.js new file mode 100644 index 0000000000000000000000000000000000000000..93f0c869c5278f2c3d7e4a60da8d7ed659fb6bc9 --- /dev/null +++ b/pixi-renderers/ThreeAddons.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).THREE_ADDONS={},e.THREE)}(this,(function(e,t){"use strict";function r(e,r){if(r===t.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(r===t.TriangleFanDrawMode||r===t.TriangleStripDrawMode){let n=e.getIndex();if(null===n){const t=[],r=e.getAttribute("position");if(void 0===r)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e=2.0 are supported.")));const u=new J(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&void 0===l[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}u.setExtensions(i),u.setPlugins(l),u.parse(r,n)}parseAsync(e,t){const r=this;return new Promise((function(n,s){r.parse(e,t,n,s)}))}}function s(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const o={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class i{constructor(e){this.parser=e,this.name=o.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,n=t.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class A{constructor(e){this.parser=e,this.name=o.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,n=r.json,s=n.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],i=n.images[o.source];let a=r.textureLoader;if(i.uri){const e=r.options.manager.getHandler(i.uri);null!==e&&(a=e)}return this.detectSupport().then((function(s){if(s)return r.loadTextureImage(e,o.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class T{constructor(e){this.parser=e,this.name=o.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,n=r.json,s=n.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],i=n.images[o.source];let a=r.textureLoader;if(i.uri){const e=r.options.manager.getHandler(i.uri);null!==e&&(a=e)}return this.detectSupport().then((function(s){if(s)return r.loadTextureImage(e,o.source,a);if(n.extensionsRequired&&n.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class b{constructor(e){this.name=o.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const e=r.extensions[this.name],n=this.parser.getDependency("buffer",e.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return n.then((function(t){const r=e.byteOffset||0,n=e.byteLength||0,o=e.count,i=e.byteStride,a=new Uint8Array(t,r,n);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(o,i,a,e.mode,e.filter).then((function(e){return e.buffer})):s.ready.then((function(){const t=new ArrayBuffer(o*i);return s.decodeGltfBuffer(new Uint8Array(t),o,i,a,e.mode,e.filter),t}))}))}return null}}class w{constructor(e){this.name=o.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const r=this.parser.json,n=r.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const s=r.meshes[n.mesh];for(const e of s.primitives)if(e.mode!==N.TRIANGLES&&e.mode!==N.TRIANGLE_STRIP&&e.mode!==N.TRIANGLE_FAN&&void 0!==e.mode)return null;const o=n.extensions[this.name].attributes,i=[],a={};for(const e in o)i.push(this.parser.getDependency("accessor",o[e]).then((t=>(a[e]=t,a[e]))));return i.length<1?null:(i.push(this.parser.createNodeMesh(e)),Promise.all(i).then((e=>{const r=e.pop(),n=r.isGroup?r.children:[r],s=e[0].count,o=[];for(const e of n){const r=new t.Matrix4,n=new t.Vector3,i=new t.Quaternion,l=new t.Vector3(1,1,1),c=new t.InstancedMesh(e.geometry,e.material,s);for(let e=0;e-1,i=o?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||n||o&&i<98?this.textureLoader=new t.TextureLoader(this.options.manager):this.textureLoader=new t.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new t.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,n=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){const o={scene:t[0][n.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:n.asset,parser:r,userData:{}};return X(s,o,n),V(o,n),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(o)}))).then((function(){e(o)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,n=t.length;r{const r=this.associations.get(e);null!=r&&this.associations.set(t,r);for(const[r,n]of e.children.entries())s(n,t.children[r])};return s(r,n),n.name+="_instance_"+e.uses[t]++,n}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r=2&&m.setY(t,h[e*i+1]),i>=3&&m.setZ(t,h[e*i+2]),i>=4&&m.setW(t,h[e*i+3]),i>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return m}))}loadTexture(e){const t=this.json,r=this.options,n=t.textures[e].source,s=t.images[n];let o=this.textureLoader;if(s.uri){const e=r.manager.getHandler(s.uri);null!==e&&(o=e)}return this.loadTextureImage(e,n,o)}loadTextureImage(e,r,n){const s=this,o=this.json,i=o.textures[e],a=o.images[r],l=(a.uri||a.bufferView)+":"+i.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(r,n).then((function(r){r.flipY=!1,r.name=i.name||a.name||"",""===r.name&&"string"==typeof a.uri&&!1===a.uri.startsWith("data:image/")&&(r.name=a.uri);const n=(o.samplers||{})[i.sampler]||{};return r.magFilter=F[n.magFilter]||t.LinearFilter,r.minFilter=F[n.minFilter]||t.LinearMipmapLinearFilter,r.wrapS=I[n.wrapS]||t.RepeatWrapping,r.wrapT=I[n.wrapT]||t.RepeatWrapping,s.associations.set(r,{textures:e}),r})).catch((function(){return null}));return this.textureCache[l]=c,c}loadImageSource(e,r){const n=this,s=this.json,o=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const i=s.images[e],a=self.URL||self.webkitURL;let l=i.uri||"",c=!1;if(void 0!==i.bufferView)l=n.getDependency("bufferView",i.bufferView).then((function(e){c=!0;const t=new Blob([e],{type:i.mimeType});return l=a.createObjectURL(t),l}));else if(void 0===i.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then((function(e){return new Promise((function(n,s){let i=n;!0===r.isImageBitmapLoader&&(i=function(e){const r=new t.Texture(e);r.needsUpdate=!0,n(r)}),r.load(t.LoaderUtils.resolveURL(e,o.path),i,void 0,s)}))})).then((function(e){var t;return!0===c&&a.revokeObjectURL(l),e.userData.mimeType=i.mimeType||((t=i.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),e}));return this.sourceCache[e]=u,u}assignTexture(e,t,r,n){const s=this;return this.getDependency("texture",r.index).then((function(i){if(!i)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((i=i.clone()).channel=r.texCoord),s.extensions[o.KHR_TEXTURE_TRANSFORM]){const e=void 0!==r.extensions?r.extensions[o.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=s.associations.get(i);i=s.extensions[o.KHR_TEXTURE_TRANSFORM].extendTexture(i,e),s.associations.set(i,t)}}return void 0!==n&&(i.colorSpace=n),e[t]=i,i}))}assignFinalMaterial(e){const r=e.geometry;let n=e.material;const s=void 0===r.attributes.tangent,o=void 0!==r.attributes.color,i=void 0===r.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let r=this.cache.get(e);r||(r=new t.PointsMaterial,t.Material.prototype.copy.call(r,n),r.color.copy(n.color),r.map=n.map,r.sizeAttenuation=!1,this.cache.add(e,r)),n=r}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let r=this.cache.get(e);r||(r=new t.LineBasicMaterial,t.Material.prototype.copy.call(r,n),r.color.copy(n.color),r.map=n.map,this.cache.add(e,r)),n=r}if(s||o||i){let e="ClonedMaterial:"+n.uuid+":";s&&(e+="derivative-tangents:"),o&&(e+="vertex-colors:"),i&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),o&&(t.vertexColors=!0),i&&(t.flatShading=!0),s&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return t.MeshStandardMaterial}loadMaterial(e){const r=this,n=this.json,s=this.extensions,i=n.materials[e];let a;const l={},c=[];if((i.extensions||{})[o.KHR_MATERIALS_UNLIT]){const e=s[o.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(l,i,r))}else{const n=i.pbrMetallicRoughness||{};if(l.color=new t.Color(1,1,1),l.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;l.color.setRGB(e[0],e[1],e[2],t.LinearSRGBColorSpace),l.opacity=e[3]}void 0!==n.baseColorTexture&&c.push(r.assignTexture(l,"map",n.baseColorTexture,t.SRGBColorSpace)),l.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,l.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(c.push(r.assignTexture(l,"metalnessMap",n.metallicRoughnessTexture)),c.push(r.assignTexture(l,"roughnessMap",n.metallicRoughnessTexture))),a=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),c.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,l)}))))}!0===i.doubleSided&&(l.side=t.DoubleSide);const u=i.alphaMode||z;if(u===j?(l.transparent=!0,l.depthWrite=!1):(l.transparent=!1,u===W&&(l.alphaTest=void 0!==i.alphaCutoff?i.alphaCutoff:.5)),void 0!==i.normalTexture&&a!==t.MeshBasicMaterial&&(c.push(r.assignTexture(l,"normalMap",i.normalTexture)),l.normalScale=new t.Vector2(1,1),void 0!==i.normalTexture.scale)){const e=i.normalTexture.scale;l.normalScale.set(e,e)}if(void 0!==i.occlusionTexture&&a!==t.MeshBasicMaterial&&(c.push(r.assignTexture(l,"aoMap",i.occlusionTexture)),void 0!==i.occlusionTexture.strength&&(l.aoMapIntensity=i.occlusionTexture.strength)),void 0!==i.emissiveFactor&&a!==t.MeshBasicMaterial){const e=i.emissiveFactor;l.emissive=(new t.Color).setRGB(e[0],e[1],e[2],t.LinearSRGBColorSpace)}return void 0!==i.emissiveTexture&&a!==t.MeshBasicMaterial&&c.push(r.assignTexture(l,"emissiveMap",i.emissiveTexture,t.SRGBColorSpace)),Promise.all(c).then((function(){const t=new a(l);return i.name&&(t.name=i.name),V(t,i),r.associations.set(t,{materials:e}),i.extensions&&X(s,t,i),t}))}createUniqueName(e){const r=t.PropertyBinding.sanitizeNodeName(e||"");return r in this.nodeNamesUsed?r+"_"+ ++this.nodeNamesUsed[r]:(this.nodeNamesUsed[r]=0,r)}loadGeometries(e){const r=this,n=this.extensions,s=this.primitiveCache;function i(e){return n[o.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,r).then((function(t){return _(t,e,r)}))}const a=[];for(let n=0,l=e.length;n0&&K(f,i),f.name=n.createUniqueName(i.name||"mesh_"+e),V(f,i),d.extensions&&X(o,f,d),n.assignFinalMaterial(f),u.push(f)}for(let t=0,r=u.length;t1?new t.Group:1===r.length?r[0]:new t.Object3D,a!==r[0])for(let e=0,t=r.length;e{const r=new Map;for(const[e,n]of s.associations)(e instanceof t.Material||e instanceof t.Texture)&&r.set(e,n);return e.traverse((e=>{const t=s.associations.get(e);null!=t&&r.set(e,t)})),r})(o),o}))}_createAnimationTracks(e,r,n,s,o){const i=[],a=e.name?e.name:e.uuid,l=[];let c;switch(G[o.path]===G.weights?e.traverse((function(e){e.morphTargetInfluences&&l.push(e.name?e.name:e.uuid)})):l.push(a),G[o.path]){case G.weights:c=t.NumberKeyframeTrack;break;case G.rotation:c=t.QuaternionKeyframeTrack;break;case G.position:case G.scale:c=t.VectorKeyframeTrack;break;default:if(1===n.itemSize)c=t.NumberKeyframeTrack;else c=t.VectorKeyframeTrack}const u=void 0!==s.interpolation?k[s.interpolation]:t.InterpolateLinear,h=this._getArrayFromAccessor(n);for(let e=0,t=l.length;e{this.parse(e,r,s)}),n,s)}parse(e,r,n=(()=>{})){this.decodeDracoFile(e,r,null,null,t.SRGBColorSpace).catch(n)}decodeDracoFile(e,r,n,s,o=t.LinearSRGBColorSpace,i=(()=>{})){const a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:o};return this.decodeGeometry(e,a).then(r).catch(i)}decodeGeometry(e,t){const r=JSON.stringify(t);if($.has(e)){const t=$.get(e);if(t.key===r)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n;const s=this.workerNextTaskID++,o=e.byteLength,i=this._getWorker(s,o).then((r=>(n=r,new Promise(((r,o)=>{n._callbacks[s]={resolve:r,reject:o},n.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return i.catch((()=>!0)).then((()=>{n&&s&&this._releaseTask(n,s)})),$.set(e,{key:r,promise:i}),i}_createGeometry(e){const r=new t.BufferGeometry;e.index&&r.setIndex(new t.BufferAttribute(e.index.array,1));for(let n=0;n{n.load(e,t,void 0,r)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const n=te.toString(),s=["/* draco decoder */",r,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([s]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.lengtht._taskLoad?-1:1}));const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e{const t=e.draco,i=new t.Decoder;try{const e=function(e,t,n,s){const o=s.attributeIDs,i=s.attributeTypes;let a,l;const c=t.GetEncodedGeometryType(n);if(c===e.TRIANGULAR_MESH)a=new e.Mesh,l=t.DecodeArrayToMesh(n,n.byteLength,a);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,l=t.DecodeArrayToPointCloud(n,n.byteLength,a)}if(!l.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const u={index:null,attributes:[]};for(const n in o){const l=self[i[n]];let c,h;if(s.useUniqueIDs)h=o[n],c=t.GetAttributeByUniqueId(a,h);else{if(h=t.GetAttributeId(a,e[o[n]]),-1===h)continue;c=t.GetAttribute(a,h)}const d=r(e,t,a,n,l,c);"color"===n&&(d.vertexColorSpace=s.vertexColorSpace),u.attributes.push(d)}c===e.TRIANGULAR_MESH&&(u.index=function(e,t,r){const n=r.num_faces(),s=3*n,o=4*s,i=e._malloc(o);t.GetTrianglesUInt32Array(r,o,i);const a=new Uint32Array(e.HEAPF32.buffer,i,s).slice();return e._free(i),{array:a,itemSize:1}}(e,t,a));return e.destroy(a),u}(t,i,new Int8Array(n),o),a=e.attributes.map((e=>e.array.buffer));e.index&&a.push(e.index.array.buffer),self.postMessage({type:"decode",id:s.id,geometry:e},a)}catch(e){console.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}finally{t.destroy(i)}}))}}}function re(e,r,n={}){const s=new t.Vector3,o=new t.Quaternion,i=new t.Vector3,a=new t.Matrix4,l=new t.Matrix4,c=new t.Matrix4;n.preserveMatrix=void 0===n.preserveMatrix||n.preserveMatrix,n.preservePosition=void 0===n.preservePosition||n.preservePosition,n.preserveHipPosition=void 0!==n.preserveHipPosition&&n.preserveHipPosition,n.useTargetMatrix=void 0!==n.useTargetMatrix&&n.useTargetMatrix,n.hip=void 0!==n.hip?n.hip:"hip",n.names=n.names||{};const u=r.isObject3D?r.skeleton.bones:se(r),h=e.isObject3D?e.skeleton.bones:se(e);let d,f,m,p,g;if(e.isObject3D?e.skeleton.pose():(n.useTargetMatrix=!0,n.preserveMatrix=!1),n.preservePosition){g=[];for(let e=0;e end && e.g > 0.8281 && e.r == 0.0 ) ) break;\n\t\t\t}\n\n\t\t\t// We correct the previous (-0.25, -0.125) offset we applied:\n\t\t\ttexcoord.x += 0.25 * resolution.x;\n\n\t\t\t// The searches are bias by 1, so adjust the coords accordingly:\n\t\t\ttexcoord.x += resolution.x;\n\n\t\t\t// Disambiguate the length added by the last step:\n\t\t\ttexcoord.x += 2.0 * resolution.x; // Undo last step\n\t\t\ttexcoord.x -= resolution.x * SMAASearchLength(searchTex, e, 0.0, 0.5);\n\n\t\t\treturn texcoord.x;\n\t\t}\n\n\t\tfloat SMAASearchXRight( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {\n\t\t\tvec2 e = vec2( 0.0, 1.0 );\n\n\t\t\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for\n\t\t\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;\n\t\t\t\ttexcoord += vec2( 2.0, 0.0 ) * resolution;\n\t\t\t\tif ( ! ( texcoord.x < end && e.g > 0.8281 && e.r == 0.0 ) ) break;\n\t\t\t}\n\n\t\t\ttexcoord.x -= 0.25 * resolution.x;\n\t\t\ttexcoord.x -= resolution.x;\n\t\t\ttexcoord.x -= 2.0 * resolution.x;\n\t\t\ttexcoord.x += resolution.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );\n\n\t\t\treturn texcoord.x;\n\t\t}\n\n\t\tfloat SMAASearchYUp( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {\n\t\t\tvec2 e = vec2( 1.0, 0.0 );\n\n\t\t\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for\n\t\t\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;\n\t\t\t\ttexcoord += vec2( 0.0, 2.0 ) * resolution; // WebGL port note: Changed sign\n\t\t\t\tif ( ! ( texcoord.y > end && e.r > 0.8281 && e.g == 0.0 ) ) break;\n\t\t\t}\n\n\t\t\ttexcoord.y -= 0.25 * resolution.y; // WebGL port note: Changed sign\n\t\t\ttexcoord.y -= resolution.y; // WebGL port note: Changed sign\n\t\t\ttexcoord.y -= 2.0 * resolution.y; // WebGL port note: Changed sign\n\t\t\ttexcoord.y += resolution.y * SMAASearchLength( searchTex, e.gr, 0.0, 0.5 ); // WebGL port note: Changed sign\n\n\t\t\treturn texcoord.y;\n\t\t}\n\n\t\tfloat SMAASearchYDown( sampler2D edgesTex, sampler2D searchTex, vec2 texcoord, float end ) {\n\t\t\tvec2 e = vec2( 1.0, 0.0 );\n\n\t\t\tfor ( int i = 0; i < SMAA_MAX_SEARCH_STEPS; i ++ ) { // WebGL port note: Changed while to for\n\t\t\t\te = texture2D( edgesTex, texcoord, 0.0 ).rg;\n\t\t\t\ttexcoord -= vec2( 0.0, 2.0 ) * resolution; // WebGL port note: Changed sign\n\t\t\t\tif ( ! ( texcoord.y < end && e.r > 0.8281 && e.g == 0.0 ) ) break;\n\t\t\t}\n\n\t\t\ttexcoord.y += 0.25 * resolution.y; // WebGL port note: Changed sign\n\t\t\ttexcoord.y += resolution.y; // WebGL port note: Changed sign\n\t\t\ttexcoord.y += 2.0 * resolution.y; // WebGL port note: Changed sign\n\t\t\ttexcoord.y -= resolution.y * SMAASearchLength( searchTex, e.gr, 0.5, 0.5 ); // WebGL port note: Changed sign\n\n\t\t\treturn texcoord.y;\n\t\t}\n\n\t\tvec2 SMAAArea( sampler2D areaTex, vec2 dist, float e1, float e2, float offset ) {\n\t\t\t// Rounding prevents precision errors of bilinear filtering:\n\t\t\tvec2 texcoord = float( SMAA_AREATEX_MAX_DISTANCE ) * round( 4.0 * vec2( e1, e2 ) ) + dist;\n\n\t\t\t// We do a scale and bias for mapping to texel space:\n\t\t\ttexcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + ( 0.5 * SMAA_AREATEX_PIXEL_SIZE );\n\n\t\t\t// Move to proper place, according to the subpixel offset:\n\t\t\ttexcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;\n\n\t\t\treturn texture2D( areaTex, texcoord, 0.0 ).rg;\n\t\t}\n\n\t\tvec4 SMAABlendingWeightCalculationPS( vec2 texcoord, vec2 pixcoord, vec4 offset[ 3 ], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices ) {\n\t\t\tvec4 weights = vec4( 0.0, 0.0, 0.0, 0.0 );\n\n\t\t\tvec2 e = texture2D( edgesTex, texcoord ).rg;\n\n\t\t\tif ( e.g > 0.0 ) { // Edge at north\n\t\t\t\tvec2 d;\n\n\t\t\t\t// Find the distance to the left:\n\t\t\t\tvec2 coords;\n\t\t\t\tcoords.x = SMAASearchXLeft( edgesTex, searchTex, offset[ 0 ].xy, offset[ 2 ].x );\n\t\t\t\tcoords.y = offset[ 1 ].y; // offset[1].y = texcoord.y - 0.25 * resolution.y (@CROSSING_OFFSET)\n\t\t\t\td.x = coords.x;\n\n\t\t\t\t// Now fetch the left crossing edges, two at a time using bilinear\n\t\t\t\t// filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to\n\t\t\t\t// discern what value each edge has:\n\t\t\t\tfloat e1 = texture2D( edgesTex, coords, 0.0 ).r;\n\n\t\t\t\t// Find the distance to the right:\n\t\t\t\tcoords.x = SMAASearchXRight( edgesTex, searchTex, offset[ 0 ].zw, offset[ 2 ].y );\n\t\t\t\td.y = coords.x;\n\n\t\t\t\t// We want the distances to be in pixel units (doing this here allow to\n\t\t\t\t// better interleave arithmetic and memory accesses):\n\t\t\t\td = d / resolution.x - pixcoord.x;\n\n\t\t\t\t// SMAAArea below needs a sqrt, as the areas texture is compressed\n\t\t\t\t// quadratically:\n\t\t\t\tvec2 sqrt_d = sqrt( abs( d ) );\n\n\t\t\t\t// Fetch the right crossing edges:\n\t\t\t\tcoords.y -= 1.0 * resolution.y; // WebGL port note: Added\n\t\t\t\tfloat e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 1, 0 ) ).r;\n\n\t\t\t\t// Ok, we know how this pattern looks like, now it is time for getting\n\t\t\t\t// the actual area:\n\t\t\t\tweights.rg = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.y ) );\n\t\t\t}\n\n\t\t\tif ( e.r > 0.0 ) { // Edge at west\n\t\t\t\tvec2 d;\n\n\t\t\t\t// Find the distance to the top:\n\t\t\t\tvec2 coords;\n\n\t\t\t\tcoords.y = SMAASearchYUp( edgesTex, searchTex, offset[ 1 ].xy, offset[ 2 ].z );\n\t\t\t\tcoords.x = offset[ 0 ].x; // offset[1].x = texcoord.x - 0.25 * resolution.x;\n\t\t\t\td.x = coords.y;\n\n\t\t\t\t// Fetch the top crossing edges:\n\t\t\t\tfloat e1 = texture2D( edgesTex, coords, 0.0 ).g;\n\n\t\t\t\t// Find the distance to the bottom:\n\t\t\t\tcoords.y = SMAASearchYDown( edgesTex, searchTex, offset[ 1 ].zw, offset[ 2 ].w );\n\t\t\t\td.y = coords.y;\n\n\t\t\t\t// We want the distances to be in pixel units:\n\t\t\t\td = d / resolution.y - pixcoord.y;\n\n\t\t\t\t// SMAAArea below needs a sqrt, as the areas texture is compressed\n\t\t\t\t// quadratically:\n\t\t\t\tvec2 sqrt_d = sqrt( abs( d ) );\n\n\t\t\t\t// Fetch the bottom crossing edges:\n\t\t\t\tcoords.y -= 1.0 * resolution.y; // WebGL port note: Added\n\t\t\t\tfloat e2 = SMAASampleLevelZeroOffset( edgesTex, coords, ivec2( 0, 1 ) ).g;\n\n\t\t\t\t// Get the area for this direction:\n\t\t\t\tweights.ba = SMAAArea( areaTex, sqrt_d, e1, e2, float( subsampleIndices.x ) );\n\t\t\t}\n\n\t\t\treturn weights;\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = SMAABlendingWeightCalculationPS( vUv, vPixcoord, vOffset, tDiffuse, tArea, tSearch, ivec4( 0.0 ) );\n\n\t\t}"},ve={name:"SMAABlendShader",uniforms:{tDiffuse:{value:null},tColor:{value:null},resolution:{value:new t.Vector2(1/1024,1/512)}},vertexShader:"\n\n\t\tuniform vec2 resolution;\n\n\t\tvarying vec2 vUv;\n\t\tvarying vec4 vOffset[ 2 ];\n\n\t\tvoid SMAANeighborhoodBlendingVS( vec2 texcoord ) {\n\t\t\tvOffset[ 0 ] = texcoord.xyxy + resolution.xyxy * vec4( -1.0, 0.0, 0.0, 1.0 ); // WebGL port note: Changed sign in W component\n\t\t\tvOffset[ 1 ] = texcoord.xyxy + resolution.xyxy * vec4( 1.0, 0.0, 0.0, -1.0 ); // WebGL port note: Changed sign in W component\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tSMAANeighborhoodBlendingVS( vUv );\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform sampler2D tColor;\n\t\tuniform vec2 resolution;\n\n\t\tvarying vec2 vUv;\n\t\tvarying vec4 vOffset[ 2 ];\n\n\t\tvec4 SMAANeighborhoodBlendingPS( vec2 texcoord, vec4 offset[ 2 ], sampler2D colorTex, sampler2D blendTex ) {\n\t\t\t// Fetch the blending weights for current pixel:\n\t\t\tvec4 a;\n\t\t\ta.xz = texture2D( blendTex, texcoord ).xz;\n\t\t\ta.y = texture2D( blendTex, offset[ 1 ].zw ).g;\n\t\t\ta.w = texture2D( blendTex, offset[ 1 ].xy ).a;\n\n\t\t\t// Is there any blending weight with a value greater than 0.0?\n\t\t\tif ( dot(a, vec4( 1.0, 1.0, 1.0, 1.0 )) < 1e-5 ) {\n\t\t\t\treturn texture2D( colorTex, texcoord, 0.0 );\n\t\t\t} else {\n\t\t\t\t// Up to 4 lines can be crossing a pixel (one through each edge). We\n\t\t\t\t// favor blending by choosing the line with the maximum weight for each\n\t\t\t\t// direction:\n\t\t\t\tvec2 offset;\n\t\t\t\toffset.x = a.a > a.b ? a.a : -a.b; // left vs. right\n\t\t\t\toffset.y = a.g > a.r ? -a.g : a.r; // top vs. bottom // WebGL port note: Changed signs\n\n\t\t\t\t// Then we go in the direction that has the maximum weight:\n\t\t\t\tif ( abs( offset.x ) > abs( offset.y )) { // horizontal vs. vertical\n\t\t\t\t\toffset.y = 0.0;\n\t\t\t\t} else {\n\t\t\t\t\toffset.x = 0.0;\n\t\t\t\t}\n\n\t\t\t\t// Fetch the opposite color and lerp by hand:\n\t\t\t\tvec4 C = texture2D( colorTex, texcoord, 0.0 );\n\t\t\t\ttexcoord += sign( offset ) * resolution;\n\t\t\t\tvec4 Cop = texture2D( colorTex, texcoord, 0.0 );\n\t\t\t\tfloat s = abs( offset.x ) > abs( offset.y ) ? abs( offset.x ) : abs( offset.y );\n\n\t\t\t\t// WebGL port note: Added gamma correction\n\t\t\t\tC.xyz = pow(C.xyz, vec3(2.2));\n\t\t\t\tCop.xyz = pow(Cop.xyz, vec3(2.2));\n\t\t\t\tvec4 mixed = mix(C, Cop, s);\n\t\t\t\tmixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));\n\n\t\t\t\treturn mixed;\n\t\t\t}\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = SMAANeighborhoodBlendingPS( vUv, vOffset, tColor, tDiffuse );\n\n\t\t}"};const Ae={name:"OutputShader",uniforms:{tDiffuse:{value:null},toneMappingExposure:{value:1}},vertexShader:"\n\t\tprecision highp float;\n\n\t\tuniform mat4 modelViewMatrix;\n\t\tuniform mat4 projectionMatrix;\n\n\t\tattribute vec3 position;\n\t\tattribute vec2 uv;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\t\n\t\tprecision highp float;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\t#include \n\t\t#include \n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t// tone mapping\n\n\t\t\t#ifdef LINEAR_TONE_MAPPING\n\n\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = OptimizedCineonToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\n\t\t\t#elif defined( AGX_TONE_MAPPING )\n\n\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\n\t\t\t#endif\n\n\t\t\t// color space\n\n\t\t\t#ifdef SRGB_TRANSFER\n\n\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\n\t\t\t#endif\n\n\t\t}"};const Te={name:"LuminosityHighPassShader",shaderID:"luminosityHighPass",uniforms:{tDiffuse:{value:null},luminosityThreshold:{value:1},smoothWidth:{value:1},defaultColor:{value:new t.Color(0)},defaultOpacity:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform vec3 defaultColor;\n\t\tuniform float defaultOpacity;\n\t\tuniform float luminosityThreshold;\n\t\tuniform float smoothWidth;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\n\t\t\tvec3 luma = vec3( 0.299, 0.587, 0.114 );\n\n\t\t\tfloat v = dot( texel.xyz, luma );\n\n\t\t\tvec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );\n\n\t\t\tfloat alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );\n\n\t\t\tgl_FragColor = mix( outputColor, texel, alpha );\n\n\t\t}"};class be extends le{constructor(e,r,n,s){super(),this.strength=void 0!==r?r:1,this.radius=n,this.threshold=s,this.resolution=void 0!==e?new t.Vector2(e.x,e.y):new t.Vector2(256,256),this.clearColor=new t.Color(0,0,0),this.renderTargetsHorizontal=[],this.renderTargetsVertical=[],this.nMips=5;let o=Math.round(this.resolution.x/2),i=Math.round(this.resolution.y/2);this.renderTargetBright=new t.WebGLRenderTarget(o,i,{type:t.HalfFloatType}),this.renderTargetBright.texture.name="UnrealBloomPass.bright",this.renderTargetBright.texture.generateMipmaps=!1;for(let e=0;e\n\t\t\t\tvarying vec2 vUv;\n\t\t\t\tuniform sampler2D colorTexture;\n\t\t\t\tuniform vec2 invSize;\n\t\t\t\tuniform vec2 direction;\n\t\t\t\tuniform float gaussianCoefficients[KERNEL_RADIUS];\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tfloat weightSum = gaussianCoefficients[0];\n\t\t\t\t\tvec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;\n\t\t\t\t\tfor( int i = 1; i < KERNEL_RADIUS; i ++ ) {\n\t\t\t\t\t\tfloat x = float(i);\n\t\t\t\t\t\tfloat w = gaussianCoefficients[i];\n\t\t\t\t\t\tvec2 uvOffset = direction * invSize * x;\n\t\t\t\t\t\tvec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;\n\t\t\t\t\t\tvec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;\n\t\t\t\t\t\tdiffuseSum += (sample1 + sample2) * w;\n\t\t\t\t\t\tweightSum += 2.0 * w;\n\t\t\t\t\t}\n\t\t\t\t\tgl_FragColor = vec4(diffuseSum/weightSum, 1.0);\n\t\t\t\t}"})}getCompositeMaterial(e){return new t.ShaderMaterial({defines:{NUM_MIPS:e},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:"varying vec2 vUv;\n\t\t\t\tvoid main() {\n\t\t\t\t\tvUv = uv;\n\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t}",fragmentShader:"varying vec2 vUv;\n\t\t\t\tuniform sampler2D blurTexture1;\n\t\t\t\tuniform sampler2D blurTexture2;\n\t\t\t\tuniform sampler2D blurTexture3;\n\t\t\t\tuniform sampler2D blurTexture4;\n\t\t\t\tuniform sampler2D blurTexture5;\n\t\t\t\tuniform float bloomStrength;\n\t\t\t\tuniform float bloomRadius;\n\t\t\t\tuniform float bloomFactors[NUM_MIPS];\n\t\t\t\tuniform vec3 bloomTintColors[NUM_MIPS];\n\n\t\t\t\tfloat lerpBloomFactor(const in float factor) {\n\t\t\t\t\tfloat mirrorFactor = 1.2 - factor;\n\t\t\t\t\treturn mix(factor, mirrorFactor, bloomRadius);\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +\n\t\t\t\t\t\tlerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );\n\t\t\t\t}"})}}be.BlurDirectionX=new t.Vector2(1,0),be.BlurDirectionY=new t.Vector2(0,1);const we={name:"BrightnessContrastShader",uniforms:{tDiffuse:{value:null},brightness:{value:0},contrast:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float brightness;\n\t\tuniform float contrast;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\tgl_FragColor.rgb += brightness;\n\n\t\t\tif (contrast > 0.0) {\n\t\t\t\tgl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;\n\t\t\t} else {\n\t\t\t\tgl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;\n\t\t\t}\n\n\t\t}"},Me={name:"HueSaturationShader",uniforms:{tDiffuse:{value:null},hue:{value:0},saturation:{value:0}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float hue;\n\t\tuniform float saturation;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t// hue\n\t\t\tfloat angle = hue * 3.14159265;\n\t\t\tfloat s = sin(angle), c = cos(angle);\n\t\t\tvec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;\n\t\t\tfloat len = length(gl_FragColor.rgb);\n\t\t\tgl_FragColor.rgb = vec3(\n\t\t\t\tdot(gl_FragColor.rgb, weights.xyz),\n\t\t\t\tdot(gl_FragColor.rgb, weights.zxy),\n\t\t\t\tdot(gl_FragColor.rgb, weights.yzx)\n\t\t\t);\n\n\t\t\t// saturation\n\t\t\tfloat average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;\n\t\t\tif (saturation > 0.0) {\n\t\t\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));\n\t\t\t} else {\n\t\t\t\tgl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);\n\t\t\t}\n\n\t\t}"},Se={name:"ExposureShader",uniforms:{tDiffuse:{value:null},exposure:{value:1}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform float exposure;\n\n\t\tuniform sampler2D tDiffuse;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\t\t\tgl_FragColor.rgb *= exposure;\n\n\t\t}"};e.BrightnessContrastShader=we,e.DRACOLoader=ee,e.EffectComposer=class{constructor(e,r){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),void 0===r){const n=e.getSize(new t.Vector2);this._width=n.width,this._height=n.height,(r=new t.WebGLRenderTarget(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:t.HalfFloatType})).texture.name="EffectComposer.rt1"}else this._width=r.width,this._height=r.height;this.renderTarget1=r,this.renderTarget2=r.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new fe(ae),this.copyPass.material.blending=t.NoBlending,this.clock=new t.Clock}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);-1!==t&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t>>0,$jscomp.propertyToPolyfillSymbol[l]=$jscomp.IS_SYMBOL_NATIVE? +$jscomp.global.Symbol(l):$jscomp.POLYFILL_PREFIX+k+"$"+l),$jscomp.defineProperty(p,$jscomp.propertyToPolyfillSymbol[l],{configurable:!0,writable:!0,value:n})))}; +$jscomp.polyfill("Promise",function(h){function n(){this.batch_=null}function k(f){return f instanceof l?f:new l(function(q,u){q(f)})}if(h&&(!($jscomp.FORCE_POLYFILL_PROMISE||$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION&&"undefined"===typeof $jscomp.global.PromiseRejectionEvent)||!$jscomp.global.Promise||-1===$jscomp.global.Promise.toString().indexOf("[native code]")))return h;n.prototype.asyncExecute=function(f){if(null==this.batch_){this.batch_=[];var q=this;this.asyncExecuteFunction(function(){q.executeBatch_()})}this.batch_.push(f)}; +var p=$jscomp.global.setTimeout;n.prototype.asyncExecuteFunction=function(f){p(f,0)};n.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var f=this.batch_;this.batch_=[];for(var q=0;q=y}},"es6","es3"); +$jscomp.polyfill("Array.prototype.copyWithin",function(h){function n(k){k=Number(k);return Infinity===k||-Infinity===k?k:k|0}return h?h:function(k,p,l){var y=this.length;k=n(k);p=n(p);l=void 0===l?y:n(l);k=0>k?Math.max(y+k,0):Math.min(k,y);p=0>p?Math.max(y+p,0):Math.min(p,y);l=0>l?Math.max(y+l,0):Math.min(l,y);if(kp;)--l in this?this[--k]=this[l]:delete this[--k];return this}},"es6","es3"); +$jscomp.typedArrayCopyWithin=function(h){return h?h:Array.prototype.copyWithin};$jscomp.polyfill("Int8Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint8Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint8ClampedArray.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Int16Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5"); +$jscomp.polyfill("Uint16Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Int32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Uint32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Float32Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5");$jscomp.polyfill("Float64Array.prototype.copyWithin",$jscomp.typedArrayCopyWithin,"es6","es5"); +var DracoDecoderModule=function(){var h="undefined"!==typeof document&&document.currentScript?document.currentScript.src:void 0;"undefined"!==typeof __filename&&(h=h||__filename);return function(n){function k(e){return a.locateFile?a.locateFile(e,U):U+e}function p(e,b){if(e){var c=ia;var d=e+b;for(b=e;c[b]&&!(b>=d);)++b;if(16g?d+=String.fromCharCode(g):(g-=65536,d+=String.fromCharCode(55296|g>>10,56320|g&1023))}}else d+=String.fromCharCode(g)}c=d}}else c="";return c}function l(){var e=ja.buffer;a.HEAP8=W=new Int8Array(e);a.HEAP16=new Int16Array(e);a.HEAP32=ca=new Int32Array(e);a.HEAPU8=ia=new Uint8Array(e);a.HEAPU16=new Uint16Array(e);a.HEAPU32=Y=new Uint32Array(e);a.HEAPF32=new Float32Array(e);a.HEAPF64=new Float64Array(e)}function y(e){if(a.onAbort)a.onAbort(e); +e="Aborted("+e+")";da(e);sa=!0;e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info.");ka(e);throw e;}function f(e){try{if(e==P&&ea)return new Uint8Array(ea);if(ma)return ma(e);throw"both async and sync fetching of the wasm failed";}catch(b){y(b)}}function q(){if(!ea&&(ta||fa)){if("function"==typeof fetch&&!P.startsWith("file://"))return fetch(P,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+P+"'";return e.arrayBuffer()}).catch(function(){return f(P)}); +if(na)return new Promise(function(e,b){na(P,function(c){e(new Uint8Array(c))},b)})}return Promise.resolve().then(function(){return f(P)})}function u(e){for(;0>2]=b};this.get_type=function(){return Y[this.ptr+4>>2]};this.set_destructor=function(b){Y[this.ptr+8>>2]=b};this.get_destructor=function(){return Y[this.ptr+8>>2]};this.set_refcount=function(b){ca[this.ptr>>2]=b};this.set_caught=function(b){W[this.ptr+ +12>>0]=b?1:0};this.get_caught=function(){return 0!=W[this.ptr+12>>0]};this.set_rethrown=function(b){W[this.ptr+13>>0]=b?1:0};this.get_rethrown=function(){return 0!=W[this.ptr+13>>0]};this.init=function(b,c){this.set_adjusted_ptr(0);this.set_type(b);this.set_destructor(c);this.set_refcount(0);this.set_caught(!1);this.set_rethrown(!1)};this.add_ref=function(){ca[this.ptr>>2]+=1};this.release_ref=function(){var b=ca[this.ptr>>2];ca[this.ptr>>2]=b-1;return 1===b};this.set_adjusted_ptr=function(b){Y[this.ptr+ +16>>2]=b};this.get_adjusted_ptr=function(){return Y[this.ptr+16>>2]};this.get_exception_ptr=function(){if(ua(this.get_type()))return Y[this.excPtr>>2];var b=this.get_adjusted_ptr();return 0!==b?b:this.excPtr}}function F(){function e(){if(!la&&(la=!0,a.calledRun=!0,!sa)){va=!0;u(oa);wa(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;)xa.unshift(a.postRun.shift());u(xa)}}if(!(0=d?b++:2047>=d?b+=2:55296<=d&&57343>= +d?(b+=4,++c):b+=3}b=Array(b+1);c=0;d=b.length;if(0=t){var aa=e.charCodeAt(++g);t=65536+((t&1023)<<10)|aa&1023}if(127>=t){if(c>=d)break;b[c++]=t}else{if(2047>=t){if(c+1>=d)break;b[c++]=192|t>>6}else{if(65535>=t){if(c+2>=d)break;b[c++]=224|t>>12}else{if(c+3>=d)break;b[c++]=240|t>>18;b[c++]=128|t>>12&63}b[c++]=128|t>>6&63}b[c++]=128|t&63}}b[c]=0}e=r.alloc(b,W);r.copy(b,W,e);return e}return e}function Z(e){if("object"=== +typeof e){var b=r.alloc(e,W);r.copy(e,W,b);return b}return e}function X(){throw"cannot construct a VoidPtr, no constructor in IDL";}function S(){this.ptr=za();w(S)[this.ptr]=this}function Q(){this.ptr=Aa();w(Q)[this.ptr]=this}function V(){this.ptr=Ba();w(V)[this.ptr]=this}function x(){this.ptr=Ca();w(x)[this.ptr]=this}function D(){this.ptr=Da();w(D)[this.ptr]=this}function G(){this.ptr=Ea();w(G)[this.ptr]=this}function H(){this.ptr=Fa();w(H)[this.ptr]=this}function E(){this.ptr=Ga();w(E)[this.ptr]= +this}function T(){this.ptr=Ha();w(T)[this.ptr]=this}function C(){throw"cannot construct a Status, no constructor in IDL";}function I(){this.ptr=Ia();w(I)[this.ptr]=this}function J(){this.ptr=Ja();w(J)[this.ptr]=this}function K(){this.ptr=Ka();w(K)[this.ptr]=this}function L(){this.ptr=La();w(L)[this.ptr]=this}function M(){this.ptr=Ma();w(M)[this.ptr]=this}function N(){this.ptr=Na();w(N)[this.ptr]=this}function O(){this.ptr=Oa();w(O)[this.ptr]=this}function z(){this.ptr=Pa();w(z)[this.ptr]=this}function m(){this.ptr= +Qa();w(m)[this.ptr]=this}n=void 0===n?{}:n;var a="undefined"!=typeof n?n:{},wa,ka;a.ready=new Promise(function(e,b){wa=e;ka=b});var Ra=!1,Sa=!1;a.onRuntimeInitialized=function(){Ra=!0;if(Sa&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.onModuleParsed=function(){Sa=!0;if(Ra&&"function"===typeof a.onModuleLoaded)a.onModuleLoaded(a)};a.isVersionSupported=function(e){if("string"!==typeof e)return!1;e=e.split(".");return 2>e.length||3=e[1]?!0:0!=e[0]||10< +e[1]?!1:!0};var Ta=Object.assign({},a),ta="object"==typeof window,fa="function"==typeof importScripts,Ua="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,U="";if(Ua){var Va=require("fs"),pa=require("path");U=fa?pa.dirname(U)+"/":__dirname+"/";var Wa=function(e,b){e=e.startsWith("file://")?new URL(e):pa.normalize(e);return Va.readFileSync(e,b?void 0:"utf8")};var ma=function(e){e=Wa(e,!0);e.buffer||(e=new Uint8Array(e));return e};var na=function(e, +b,c){e=e.startsWith("file://")?new URL(e):pa.normalize(e);Va.readFile(e,function(d,g){d?c(d):b(g.buffer)})};1>>=0;if(2147483648=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,e+100663296);var g=Math;d=Math.max(e,d);g=g.min.call(g,2147483648,d+(65536-d%65536)%65536);a:{d=ja.buffer;try{ja.grow(g-d.byteLength+65535>>>16);l();var t=1;break a}catch(aa){}t=void 0}if(t)return!0}return!1}};(function(){function e(g,t){a.asm=g.exports;ja=a.asm.e;l();oa.unshift(a.asm.f);ba--;a.monitorRunDependencies&&a.monitorRunDependencies(ba);0==ba&&(null!==qa&&(clearInterval(qa),qa=null),ha&&(g=ha,ha=null,g()))}function b(g){e(g.instance)} +function c(g){return q().then(function(t){return WebAssembly.instantiate(t,d)}).then(function(t){return t}).then(g,function(t){da("failed to asynchronously prepare wasm: "+t);y(t)})}var d={a:qd};ba++;a.monitorRunDependencies&&a.monitorRunDependencies(ba);if(a.instantiateWasm)try{return a.instantiateWasm(d,e)}catch(g){da("Module.instantiateWasm callback failed with error: "+g),ka(g)}(function(){return ea||"function"!=typeof WebAssembly.instantiateStreaming||P.startsWith("data:application/octet-stream;base64,")|| +P.startsWith("file://")||Ua||"function"!=typeof fetch?c(b):fetch(P,{credentials:"same-origin"}).then(function(g){return WebAssembly.instantiateStreaming(g,d).then(b,function(t){da("wasm streaming compile failed: "+t);da("falling back to ArrayBuffer instantiation");return c(b)})})})().catch(ka);return{}})();var Xa=a._emscripten_bind_VoidPtr___destroy___0=function(){return(Xa=a._emscripten_bind_VoidPtr___destroy___0=a.asm.h).apply(null,arguments)},za=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0= +function(){return(za=a._emscripten_bind_DecoderBuffer_DecoderBuffer_0=a.asm.i).apply(null,arguments)},Ya=a._emscripten_bind_DecoderBuffer_Init_2=function(){return(Ya=a._emscripten_bind_DecoderBuffer_Init_2=a.asm.j).apply(null,arguments)},Za=a._emscripten_bind_DecoderBuffer___destroy___0=function(){return(Za=a._emscripten_bind_DecoderBuffer___destroy___0=a.asm.k).apply(null,arguments)},Aa=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0=function(){return(Aa=a._emscripten_bind_AttributeTransformData_AttributeTransformData_0= +a.asm.l).apply(null,arguments)},$a=a._emscripten_bind_AttributeTransformData_transform_type_0=function(){return($a=a._emscripten_bind_AttributeTransformData_transform_type_0=a.asm.m).apply(null,arguments)},ab=a._emscripten_bind_AttributeTransformData___destroy___0=function(){return(ab=a._emscripten_bind_AttributeTransformData___destroy___0=a.asm.n).apply(null,arguments)},Ba=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0=function(){return(Ba=a._emscripten_bind_GeometryAttribute_GeometryAttribute_0= +a.asm.o).apply(null,arguments)},bb=a._emscripten_bind_GeometryAttribute___destroy___0=function(){return(bb=a._emscripten_bind_GeometryAttribute___destroy___0=a.asm.p).apply(null,arguments)},Ca=a._emscripten_bind_PointAttribute_PointAttribute_0=function(){return(Ca=a._emscripten_bind_PointAttribute_PointAttribute_0=a.asm.q).apply(null,arguments)},cb=a._emscripten_bind_PointAttribute_size_0=function(){return(cb=a._emscripten_bind_PointAttribute_size_0=a.asm.r).apply(null,arguments)},db=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0= +function(){return(db=a._emscripten_bind_PointAttribute_GetAttributeTransformData_0=a.asm.s).apply(null,arguments)},eb=a._emscripten_bind_PointAttribute_attribute_type_0=function(){return(eb=a._emscripten_bind_PointAttribute_attribute_type_0=a.asm.t).apply(null,arguments)},fb=a._emscripten_bind_PointAttribute_data_type_0=function(){return(fb=a._emscripten_bind_PointAttribute_data_type_0=a.asm.u).apply(null,arguments)},gb=a._emscripten_bind_PointAttribute_num_components_0=function(){return(gb=a._emscripten_bind_PointAttribute_num_components_0= +a.asm.v).apply(null,arguments)},hb=a._emscripten_bind_PointAttribute_normalized_0=function(){return(hb=a._emscripten_bind_PointAttribute_normalized_0=a.asm.w).apply(null,arguments)},ib=a._emscripten_bind_PointAttribute_byte_stride_0=function(){return(ib=a._emscripten_bind_PointAttribute_byte_stride_0=a.asm.x).apply(null,arguments)},jb=a._emscripten_bind_PointAttribute_byte_offset_0=function(){return(jb=a._emscripten_bind_PointAttribute_byte_offset_0=a.asm.y).apply(null,arguments)},kb=a._emscripten_bind_PointAttribute_unique_id_0= +function(){return(kb=a._emscripten_bind_PointAttribute_unique_id_0=a.asm.z).apply(null,arguments)},lb=a._emscripten_bind_PointAttribute___destroy___0=function(){return(lb=a._emscripten_bind_PointAttribute___destroy___0=a.asm.A).apply(null,arguments)},Da=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=function(){return(Da=a._emscripten_bind_AttributeQuantizationTransform_AttributeQuantizationTransform_0=a.asm.B).apply(null,arguments)},mb=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1= +function(){return(mb=a._emscripten_bind_AttributeQuantizationTransform_InitFromAttribute_1=a.asm.C).apply(null,arguments)},nb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=function(){return(nb=a._emscripten_bind_AttributeQuantizationTransform_quantization_bits_0=a.asm.D).apply(null,arguments)},ob=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=function(){return(ob=a._emscripten_bind_AttributeQuantizationTransform_min_value_1=a.asm.E).apply(null,arguments)},pb= +a._emscripten_bind_AttributeQuantizationTransform_range_0=function(){return(pb=a._emscripten_bind_AttributeQuantizationTransform_range_0=a.asm.F).apply(null,arguments)},qb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0=function(){return(qb=a._emscripten_bind_AttributeQuantizationTransform___destroy___0=a.asm.G).apply(null,arguments)},Ea=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0=function(){return(Ea=a._emscripten_bind_AttributeOctahedronTransform_AttributeOctahedronTransform_0= +a.asm.H).apply(null,arguments)},rb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=function(){return(rb=a._emscripten_bind_AttributeOctahedronTransform_InitFromAttribute_1=a.asm.I).apply(null,arguments)},sb=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=function(){return(sb=a._emscripten_bind_AttributeOctahedronTransform_quantization_bits_0=a.asm.J).apply(null,arguments)},tb=a._emscripten_bind_AttributeOctahedronTransform___destroy___0=function(){return(tb= +a._emscripten_bind_AttributeOctahedronTransform___destroy___0=a.asm.K).apply(null,arguments)},Fa=a._emscripten_bind_PointCloud_PointCloud_0=function(){return(Fa=a._emscripten_bind_PointCloud_PointCloud_0=a.asm.L).apply(null,arguments)},ub=a._emscripten_bind_PointCloud_num_attributes_0=function(){return(ub=a._emscripten_bind_PointCloud_num_attributes_0=a.asm.M).apply(null,arguments)},vb=a._emscripten_bind_PointCloud_num_points_0=function(){return(vb=a._emscripten_bind_PointCloud_num_points_0=a.asm.N).apply(null, +arguments)},wb=a._emscripten_bind_PointCloud___destroy___0=function(){return(wb=a._emscripten_bind_PointCloud___destroy___0=a.asm.O).apply(null,arguments)},Ga=a._emscripten_bind_Mesh_Mesh_0=function(){return(Ga=a._emscripten_bind_Mesh_Mesh_0=a.asm.P).apply(null,arguments)},xb=a._emscripten_bind_Mesh_num_faces_0=function(){return(xb=a._emscripten_bind_Mesh_num_faces_0=a.asm.Q).apply(null,arguments)},yb=a._emscripten_bind_Mesh_num_attributes_0=function(){return(yb=a._emscripten_bind_Mesh_num_attributes_0= +a.asm.R).apply(null,arguments)},zb=a._emscripten_bind_Mesh_num_points_0=function(){return(zb=a._emscripten_bind_Mesh_num_points_0=a.asm.S).apply(null,arguments)},Ab=a._emscripten_bind_Mesh___destroy___0=function(){return(Ab=a._emscripten_bind_Mesh___destroy___0=a.asm.T).apply(null,arguments)},Ha=a._emscripten_bind_Metadata_Metadata_0=function(){return(Ha=a._emscripten_bind_Metadata_Metadata_0=a.asm.U).apply(null,arguments)},Bb=a._emscripten_bind_Metadata___destroy___0=function(){return(Bb=a._emscripten_bind_Metadata___destroy___0= +a.asm.V).apply(null,arguments)},Cb=a._emscripten_bind_Status_code_0=function(){return(Cb=a._emscripten_bind_Status_code_0=a.asm.W).apply(null,arguments)},Db=a._emscripten_bind_Status_ok_0=function(){return(Db=a._emscripten_bind_Status_ok_0=a.asm.X).apply(null,arguments)},Eb=a._emscripten_bind_Status_error_msg_0=function(){return(Eb=a._emscripten_bind_Status_error_msg_0=a.asm.Y).apply(null,arguments)},Fb=a._emscripten_bind_Status___destroy___0=function(){return(Fb=a._emscripten_bind_Status___destroy___0= +a.asm.Z).apply(null,arguments)},Ia=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=function(){return(Ia=a._emscripten_bind_DracoFloat32Array_DracoFloat32Array_0=a.asm._).apply(null,arguments)},Gb=a._emscripten_bind_DracoFloat32Array_GetValue_1=function(){return(Gb=a._emscripten_bind_DracoFloat32Array_GetValue_1=a.asm.$).apply(null,arguments)},Hb=a._emscripten_bind_DracoFloat32Array_size_0=function(){return(Hb=a._emscripten_bind_DracoFloat32Array_size_0=a.asm.aa).apply(null,arguments)},Ib= +a._emscripten_bind_DracoFloat32Array___destroy___0=function(){return(Ib=a._emscripten_bind_DracoFloat32Array___destroy___0=a.asm.ba).apply(null,arguments)},Ja=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0=function(){return(Ja=a._emscripten_bind_DracoInt8Array_DracoInt8Array_0=a.asm.ca).apply(null,arguments)},Jb=a._emscripten_bind_DracoInt8Array_GetValue_1=function(){return(Jb=a._emscripten_bind_DracoInt8Array_GetValue_1=a.asm.da).apply(null,arguments)},Kb=a._emscripten_bind_DracoInt8Array_size_0= +function(){return(Kb=a._emscripten_bind_DracoInt8Array_size_0=a.asm.ea).apply(null,arguments)},Lb=a._emscripten_bind_DracoInt8Array___destroy___0=function(){return(Lb=a._emscripten_bind_DracoInt8Array___destroy___0=a.asm.fa).apply(null,arguments)},Ka=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=function(){return(Ka=a._emscripten_bind_DracoUInt8Array_DracoUInt8Array_0=a.asm.ga).apply(null,arguments)},Mb=a._emscripten_bind_DracoUInt8Array_GetValue_1=function(){return(Mb=a._emscripten_bind_DracoUInt8Array_GetValue_1= +a.asm.ha).apply(null,arguments)},Nb=a._emscripten_bind_DracoUInt8Array_size_0=function(){return(Nb=a._emscripten_bind_DracoUInt8Array_size_0=a.asm.ia).apply(null,arguments)},Ob=a._emscripten_bind_DracoUInt8Array___destroy___0=function(){return(Ob=a._emscripten_bind_DracoUInt8Array___destroy___0=a.asm.ja).apply(null,arguments)},La=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=function(){return(La=a._emscripten_bind_DracoInt16Array_DracoInt16Array_0=a.asm.ka).apply(null,arguments)},Pb=a._emscripten_bind_DracoInt16Array_GetValue_1= +function(){return(Pb=a._emscripten_bind_DracoInt16Array_GetValue_1=a.asm.la).apply(null,arguments)},Qb=a._emscripten_bind_DracoInt16Array_size_0=function(){return(Qb=a._emscripten_bind_DracoInt16Array_size_0=a.asm.ma).apply(null,arguments)},Rb=a._emscripten_bind_DracoInt16Array___destroy___0=function(){return(Rb=a._emscripten_bind_DracoInt16Array___destroy___0=a.asm.na).apply(null,arguments)},Ma=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0=function(){return(Ma=a._emscripten_bind_DracoUInt16Array_DracoUInt16Array_0= +a.asm.oa).apply(null,arguments)},Sb=a._emscripten_bind_DracoUInt16Array_GetValue_1=function(){return(Sb=a._emscripten_bind_DracoUInt16Array_GetValue_1=a.asm.pa).apply(null,arguments)},Tb=a._emscripten_bind_DracoUInt16Array_size_0=function(){return(Tb=a._emscripten_bind_DracoUInt16Array_size_0=a.asm.qa).apply(null,arguments)},Ub=a._emscripten_bind_DracoUInt16Array___destroy___0=function(){return(Ub=a._emscripten_bind_DracoUInt16Array___destroy___0=a.asm.ra).apply(null,arguments)},Na=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0= +function(){return(Na=a._emscripten_bind_DracoInt32Array_DracoInt32Array_0=a.asm.sa).apply(null,arguments)},Vb=a._emscripten_bind_DracoInt32Array_GetValue_1=function(){return(Vb=a._emscripten_bind_DracoInt32Array_GetValue_1=a.asm.ta).apply(null,arguments)},Wb=a._emscripten_bind_DracoInt32Array_size_0=function(){return(Wb=a._emscripten_bind_DracoInt32Array_size_0=a.asm.ua).apply(null,arguments)},Xb=a._emscripten_bind_DracoInt32Array___destroy___0=function(){return(Xb=a._emscripten_bind_DracoInt32Array___destroy___0= +a.asm.va).apply(null,arguments)},Oa=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=function(){return(Oa=a._emscripten_bind_DracoUInt32Array_DracoUInt32Array_0=a.asm.wa).apply(null,arguments)},Yb=a._emscripten_bind_DracoUInt32Array_GetValue_1=function(){return(Yb=a._emscripten_bind_DracoUInt32Array_GetValue_1=a.asm.xa).apply(null,arguments)},Zb=a._emscripten_bind_DracoUInt32Array_size_0=function(){return(Zb=a._emscripten_bind_DracoUInt32Array_size_0=a.asm.ya).apply(null,arguments)},$b=a._emscripten_bind_DracoUInt32Array___destroy___0= +function(){return($b=a._emscripten_bind_DracoUInt32Array___destroy___0=a.asm.za).apply(null,arguments)},Pa=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0=function(){return(Pa=a._emscripten_bind_MetadataQuerier_MetadataQuerier_0=a.asm.Aa).apply(null,arguments)},ac=a._emscripten_bind_MetadataQuerier_HasEntry_2=function(){return(ac=a._emscripten_bind_MetadataQuerier_HasEntry_2=a.asm.Ba).apply(null,arguments)},bc=a._emscripten_bind_MetadataQuerier_GetIntEntry_2=function(){return(bc=a._emscripten_bind_MetadataQuerier_GetIntEntry_2= +a.asm.Ca).apply(null,arguments)},cc=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=function(){return(cc=a._emscripten_bind_MetadataQuerier_GetIntEntryArray_3=a.asm.Da).apply(null,arguments)},dc=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=function(){return(dc=a._emscripten_bind_MetadataQuerier_GetDoubleEntry_2=a.asm.Ea).apply(null,arguments)},ec=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=function(){return(ec=a._emscripten_bind_MetadataQuerier_GetStringEntry_2=a.asm.Fa).apply(null, +arguments)},fc=a._emscripten_bind_MetadataQuerier_NumEntries_1=function(){return(fc=a._emscripten_bind_MetadataQuerier_NumEntries_1=a.asm.Ga).apply(null,arguments)},gc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=function(){return(gc=a._emscripten_bind_MetadataQuerier_GetEntryName_2=a.asm.Ha).apply(null,arguments)},hc=a._emscripten_bind_MetadataQuerier___destroy___0=function(){return(hc=a._emscripten_bind_MetadataQuerier___destroy___0=a.asm.Ia).apply(null,arguments)},Qa=a._emscripten_bind_Decoder_Decoder_0= +function(){return(Qa=a._emscripten_bind_Decoder_Decoder_0=a.asm.Ja).apply(null,arguments)},ic=a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=function(){return(ic=a._emscripten_bind_Decoder_DecodeArrayToPointCloud_3=a.asm.Ka).apply(null,arguments)},jc=a._emscripten_bind_Decoder_DecodeArrayToMesh_3=function(){return(jc=a._emscripten_bind_Decoder_DecodeArrayToMesh_3=a.asm.La).apply(null,arguments)},kc=a._emscripten_bind_Decoder_GetAttributeId_2=function(){return(kc=a._emscripten_bind_Decoder_GetAttributeId_2= +a.asm.Ma).apply(null,arguments)},lc=a._emscripten_bind_Decoder_GetAttributeIdByName_2=function(){return(lc=a._emscripten_bind_Decoder_GetAttributeIdByName_2=a.asm.Na).apply(null,arguments)},mc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=function(){return(mc=a._emscripten_bind_Decoder_GetAttributeIdByMetadataEntry_3=a.asm.Oa).apply(null,arguments)},nc=a._emscripten_bind_Decoder_GetAttribute_2=function(){return(nc=a._emscripten_bind_Decoder_GetAttribute_2=a.asm.Pa).apply(null,arguments)}, +oc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=function(){return(oc=a._emscripten_bind_Decoder_GetAttributeByUniqueId_2=a.asm.Qa).apply(null,arguments)},pc=a._emscripten_bind_Decoder_GetMetadata_1=function(){return(pc=a._emscripten_bind_Decoder_GetMetadata_1=a.asm.Ra).apply(null,arguments)},qc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=function(){return(qc=a._emscripten_bind_Decoder_GetAttributeMetadata_2=a.asm.Sa).apply(null,arguments)},rc=a._emscripten_bind_Decoder_GetFaceFromMesh_3= +function(){return(rc=a._emscripten_bind_Decoder_GetFaceFromMesh_3=a.asm.Ta).apply(null,arguments)},sc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=function(){return(sc=a._emscripten_bind_Decoder_GetTriangleStripsFromMesh_2=a.asm.Ua).apply(null,arguments)},tc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=function(){return(tc=a._emscripten_bind_Decoder_GetTrianglesUInt16Array_3=a.asm.Va).apply(null,arguments)},uc=a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=function(){return(uc= +a._emscripten_bind_Decoder_GetTrianglesUInt32Array_3=a.asm.Wa).apply(null,arguments)},vc=a._emscripten_bind_Decoder_GetAttributeFloat_3=function(){return(vc=a._emscripten_bind_Decoder_GetAttributeFloat_3=a.asm.Xa).apply(null,arguments)},wc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=function(){return(wc=a._emscripten_bind_Decoder_GetAttributeFloatForAllPoints_3=a.asm.Ya).apply(null,arguments)},xc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3=function(){return(xc=a._emscripten_bind_Decoder_GetAttributeIntForAllPoints_3= +a.asm.Za).apply(null,arguments)},yc=a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=function(){return(yc=a._emscripten_bind_Decoder_GetAttributeInt8ForAllPoints_3=a.asm._a).apply(null,arguments)},zc=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=function(){return(zc=a._emscripten_bind_Decoder_GetAttributeUInt8ForAllPoints_3=a.asm.$a).apply(null,arguments)},Ac=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3=function(){return(Ac=a._emscripten_bind_Decoder_GetAttributeInt16ForAllPoints_3= +a.asm.ab).apply(null,arguments)},Bc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=function(){return(Bc=a._emscripten_bind_Decoder_GetAttributeUInt16ForAllPoints_3=a.asm.bb).apply(null,arguments)},Cc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=function(){return(Cc=a._emscripten_bind_Decoder_GetAttributeInt32ForAllPoints_3=a.asm.cb).apply(null,arguments)},Dc=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3=function(){return(Dc=a._emscripten_bind_Decoder_GetAttributeUInt32ForAllPoints_3= +a.asm.db).apply(null,arguments)},Ec=a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=function(){return(Ec=a._emscripten_bind_Decoder_GetAttributeDataArrayForAllPoints_5=a.asm.eb).apply(null,arguments)},Fc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=function(){return(Fc=a._emscripten_bind_Decoder_SkipAttributeTransform_1=a.asm.fb).apply(null,arguments)},Gc=a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1=function(){return(Gc=a._emscripten_bind_Decoder_GetEncodedGeometryType_Deprecated_1= +a.asm.gb).apply(null,arguments)},Hc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=function(){return(Hc=a._emscripten_bind_Decoder_DecodeBufferToPointCloud_2=a.asm.hb).apply(null,arguments)},Ic=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=function(){return(Ic=a._emscripten_bind_Decoder_DecodeBufferToMesh_2=a.asm.ib).apply(null,arguments)},Jc=a._emscripten_bind_Decoder___destroy___0=function(){return(Jc=a._emscripten_bind_Decoder___destroy___0=a.asm.jb).apply(null,arguments)},Kc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM= +function(){return(Kc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_INVALID_TRANSFORM=a.asm.kb).apply(null,arguments)},Lc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=function(){return(Lc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_NO_TRANSFORM=a.asm.lb).apply(null,arguments)},Mc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM=function(){return(Mc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_QUANTIZATION_TRANSFORM= +a.asm.mb).apply(null,arguments)},Nc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=function(){return(Nc=a._emscripten_enum_draco_AttributeTransformType_ATTRIBUTE_OCTAHEDRON_TRANSFORM=a.asm.nb).apply(null,arguments)},Oc=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=function(){return(Oc=a._emscripten_enum_draco_GeometryAttribute_Type_INVALID=a.asm.ob).apply(null,arguments)},Pc=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION=function(){return(Pc=a._emscripten_enum_draco_GeometryAttribute_Type_POSITION= +a.asm.pb).apply(null,arguments)},Qc=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=function(){return(Qc=a._emscripten_enum_draco_GeometryAttribute_Type_NORMAL=a.asm.qb).apply(null,arguments)},Rc=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=function(){return(Rc=a._emscripten_enum_draco_GeometryAttribute_Type_COLOR=a.asm.rb).apply(null,arguments)},Sc=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD=function(){return(Sc=a._emscripten_enum_draco_GeometryAttribute_Type_TEX_COORD= +a.asm.sb).apply(null,arguments)},Tc=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=function(){return(Tc=a._emscripten_enum_draco_GeometryAttribute_Type_GENERIC=a.asm.tb).apply(null,arguments)},Uc=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=function(){return(Uc=a._emscripten_enum_draco_EncodedGeometryType_INVALID_GEOMETRY_TYPE=a.asm.ub).apply(null,arguments)},Vc=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD=function(){return(Vc=a._emscripten_enum_draco_EncodedGeometryType_POINT_CLOUD= +a.asm.vb).apply(null,arguments)},Wc=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=function(){return(Wc=a._emscripten_enum_draco_EncodedGeometryType_TRIANGULAR_MESH=a.asm.wb).apply(null,arguments)},Xc=a._emscripten_enum_draco_DataType_DT_INVALID=function(){return(Xc=a._emscripten_enum_draco_DataType_DT_INVALID=a.asm.xb).apply(null,arguments)},Yc=a._emscripten_enum_draco_DataType_DT_INT8=function(){return(Yc=a._emscripten_enum_draco_DataType_DT_INT8=a.asm.yb).apply(null,arguments)},Zc= +a._emscripten_enum_draco_DataType_DT_UINT8=function(){return(Zc=a._emscripten_enum_draco_DataType_DT_UINT8=a.asm.zb).apply(null,arguments)},$c=a._emscripten_enum_draco_DataType_DT_INT16=function(){return($c=a._emscripten_enum_draco_DataType_DT_INT16=a.asm.Ab).apply(null,arguments)},ad=a._emscripten_enum_draco_DataType_DT_UINT16=function(){return(ad=a._emscripten_enum_draco_DataType_DT_UINT16=a.asm.Bb).apply(null,arguments)},bd=a._emscripten_enum_draco_DataType_DT_INT32=function(){return(bd=a._emscripten_enum_draco_DataType_DT_INT32= +a.asm.Cb).apply(null,arguments)},cd=a._emscripten_enum_draco_DataType_DT_UINT32=function(){return(cd=a._emscripten_enum_draco_DataType_DT_UINT32=a.asm.Db).apply(null,arguments)},dd=a._emscripten_enum_draco_DataType_DT_INT64=function(){return(dd=a._emscripten_enum_draco_DataType_DT_INT64=a.asm.Eb).apply(null,arguments)},ed=a._emscripten_enum_draco_DataType_DT_UINT64=function(){return(ed=a._emscripten_enum_draco_DataType_DT_UINT64=a.asm.Fb).apply(null,arguments)},fd=a._emscripten_enum_draco_DataType_DT_FLOAT32= +function(){return(fd=a._emscripten_enum_draco_DataType_DT_FLOAT32=a.asm.Gb).apply(null,arguments)},gd=a._emscripten_enum_draco_DataType_DT_FLOAT64=function(){return(gd=a._emscripten_enum_draco_DataType_DT_FLOAT64=a.asm.Hb).apply(null,arguments)},hd=a._emscripten_enum_draco_DataType_DT_BOOL=function(){return(hd=a._emscripten_enum_draco_DataType_DT_BOOL=a.asm.Ib).apply(null,arguments)},id=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT=function(){return(id=a._emscripten_enum_draco_DataType_DT_TYPES_COUNT= +a.asm.Jb).apply(null,arguments)},jd=a._emscripten_enum_draco_StatusCode_OK=function(){return(jd=a._emscripten_enum_draco_StatusCode_OK=a.asm.Kb).apply(null,arguments)},kd=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=function(){return(kd=a._emscripten_enum_draco_StatusCode_DRACO_ERROR=a.asm.Lb).apply(null,arguments)},ld=a._emscripten_enum_draco_StatusCode_IO_ERROR=function(){return(ld=a._emscripten_enum_draco_StatusCode_IO_ERROR=a.asm.Mb).apply(null,arguments)},md=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER= +function(){return(md=a._emscripten_enum_draco_StatusCode_INVALID_PARAMETER=a.asm.Nb).apply(null,arguments)},nd=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=function(){return(nd=a._emscripten_enum_draco_StatusCode_UNSUPPORTED_VERSION=a.asm.Ob).apply(null,arguments)},od=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=function(){return(od=a._emscripten_enum_draco_StatusCode_UNKNOWN_VERSION=a.asm.Pb).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.Qb).apply(null,arguments)}; +a._free=function(){return(a._free=a.asm.Rb).apply(null,arguments)};var ua=function(){return(ua=a.asm.Sb).apply(null,arguments)};a.___start_em_js=11660;a.___stop_em_js=11758;var la;ha=function b(){la||F();la||(ha=b)};if(a.preInit)for("function"==typeof a.preInit&&(a.preInit=[a.preInit]);0=r.size?(0>>=0;switch(c.BYTES_PER_ELEMENT){case 2:d>>>=1;break;case 4:d>>>=2;break;case 8:d>>>=3}for(var g=0;gb.byteLength)return a.INVALID_GEOMETRY_TYPE;switch(b[7]){case 0:return a.POINT_CLOUD;case 1:return a.TRIANGULAR_MESH;default:return a.INVALID_GEOMETRY_TYPE}};return n.ready}}();"object"===typeof exports&&"object"===typeof module?module.exports=DracoDecoderModule:"function"===typeof define&&define.amd?define([],function(){return DracoDecoderModule}):"object"===typeof exports&&(exports.DracoDecoderModule=DracoDecoderModule); diff --git a/pixi-renderers/layer-pixi-renderer.js b/pixi-renderers/layer-pixi-renderer.js new file mode 100644 index 0000000000000000000000000000000000000000..df5a126070d36ebacbd6e4a9701991a52ddd40aa --- /dev/null +++ b/pixi-renderers/layer-pixi-renderer.js @@ -0,0 +1,15 @@ +var gdjs;(function(h){const p=new h.Logger("LayerPixiRenderer"),l=class{constructor(e,t,r){this._lightingSprite=null;this._renderTexture=null;this._oldWidth=null;this._oldHeight=null;this._threeGroup=null;this._threeScene=null;this._threeCamera=null;this._threeCameraDirty=!1;this._threeEffectComposer=null;this._threePlaneTexture=null;this._threePlaneGeometry=null;this._threePlaneMaterial=null;this._threePlaneMesh=null;this._pixiContainer=new PIXI.Container,this._pixiContainer.sortableChildren=!0,this._layer=e,this._isLightingLayer=e.isLightingLayer();const s=t.getRendererObject();s&&s.addChild(this._pixiContainer),this._pixiContainer.filters=[];const a=r.getPIXIRenderer();this._isLightingLayer?(this._clearColor=e.getClearColor(),this._setupLightingRendering(a,t)):(this._clearColor=[...h.hexNumberToRGBArray(this._layer.getRuntimeScene().getBackgroundColor()),0],this._setup3DRendering(a,t))}onCreated(){this._update3DCameraAspectAndPosition()}onGameResolutionResized(){this._update3DCameraAspectAndPosition()}_update3DCameraAspectAndPosition(){if(!!this._threeCamera){if(this._threeCamera instanceof THREE.OrthographicCamera){const e=this._layer.getWidth(),t=this._layer.getHeight();this._threeCamera.left=-e/2,this._threeCamera.right=e/2,this._threeCamera.top=t/2,this._threeCamera.bottom=-t/2}else this._threeCamera.aspect=this._layer.getWidth()/this._layer.getHeight();this._threeCamera.updateProjectionMatrix(),this.updatePosition()}}getRendererObject(){return this._pixiContainer}getThreeScene(){return this._threeScene}getThreeCamera(){return this._threeCamera}getThreeEffectComposer(){return this._threeEffectComposer}addPostProcessingPass(e){if(!this._threeEffectComposer)return;const t=this._layer.getRuntimeScene().getGame(),r=this._threeEffectComposer.passes.length-(t.getAntialiasingMode()==="none"?1:2);this._threeEffectComposer.insertPass(e,r)}removePostProcessingPass(e){!this._threeEffectComposer||this._threeEffectComposer.removePass(e)}hasPostProcessingPass(){if(!this._threeEffectComposer)return!1;const t=this._layer.getRuntimeScene().getGame().getAntialiasingMode()==="none"?2:3;return this._threeEffectComposer.passes.length>t}getLightingSprite(){return this._lightingSprite}_setup3DRendering(e,t){if(typeof THREE!="undefined")if(this._layer instanceof h.Layer){if(this._layer.getRenderingType()===h.RuntimeLayerRenderingType.THREE_D||this._layer.getRenderingType()===h.RuntimeLayerRenderingType.TWO_D_PLUS_THREE_D){if(this._threeScene||this._threeGroup||this._threeCamera)throw new Error("Tried to setup 3D rendering for a layer that is already set up.");if(this._threeScene=new THREE.Scene,this._threeScene.scale.y=-1,this._threeGroup=new THREE.Group,this._threeScene.add(this._threeGroup),this._layer.getCameraType()===h.RuntimeLayerCameraType.ORTHOGRAPHIC){const a=this._layer.getWidth(),n=this._layer.getHeight();this._threeCamera=new THREE.OrthographicCamera(-a/2,a/2,n/2,-n/2,this._layer.getInitialCamera3DNearPlaneDistance(),this._layer.getInitialCamera3DFarPlaneDistance())}else this._threeCamera=new THREE.PerspectiveCamera(this._layer.getInitialCamera3DFieldOfView(),1,this._layer.getInitialCamera3DNearPlaneDistance(),this._layer.getInitialCamera3DFarPlaneDistance());this._threeCamera.rotation.order="ZYX";const r=this._layer.getRuntimeScene().getGame(),s=r.getRenderer().getThreeRenderer();if(s&&(this._threeEffectComposer=new THREE_ADDONS.EffectComposer(s),this._threeEffectComposer.addPass(new THREE_ADDONS.RenderPass(this._threeScene,this._threeCamera)),r.getAntialiasingMode()!=="none"&&this._threeEffectComposer.addPass(new THREE_ADDONS.SMAAPass(r.getGameResolutionWidth(),r.getGameResolutionHeight())),this._threeEffectComposer.addPass(new THREE_ADDONS.OutputPass)),this._layer.getRenderingType()===h.RuntimeLayerRenderingType.TWO_D_PLUS_THREE_D){if(this._renderTexture||this._threePlaneGeometry||this._threePlaneMaterial||this._threePlaneTexture||this._threePlaneMesh)throw new Error("Tried to setup PixiJS plane for 2D rendering in 3D for a layer that is already set up.");this._createPixiRenderTexture(e),this._threePlaneGeometry=new THREE.PlaneGeometry(1,1);const a=1,n=1,u=a*n,g=new Uint8Array(4*u),_=new THREE.DataTexture(g,a,n);_.needsUpdate=!0,this._threePlaneTexture=_,this._threePlaneTexture.generateMipmaps=!1;const d=this._layer.getRuntimeScene().getGame().getScaleMode()==="nearest"?THREE.NearestFilter:THREE.LinearFilter;this._threePlaneTexture.minFilter=d,this._threePlaneTexture.magFilter=d,this._threePlaneTexture.wrapS=THREE.ClampToEdgeWrapping,this._threePlaneTexture.wrapT=THREE.ClampToEdgeWrapping;const i={vertexShader:` + varying vec2 vUv; + void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); + } + `,fragmentShader:` + uniform sampler2D map; + varying vec2 vUv; + void main() { + vec4 texel = texture2D(map, vUv); + gl_FragColor = texel; + } + `,uniforms:{map:{value:this._threePlaneTexture}},side:THREE.FrontSide,transparent:!0};this._threePlaneMaterial=new THREE.ShaderMaterial(i),this._threePlaneMaterial,this._threePlaneMesh=new THREE.Mesh(this._threePlaneGeometry,this._threePlaneMaterial),this._threePlaneMesh.renderOrder=Number.MAX_SAFE_INTEGER,this._threeScene.add(this._threePlaneMesh)}}}else{const r=t.get3DRendererObject();if(!r)return;this._threeGroup||(this._threeGroup=new THREE.Group,r.add(this._threeGroup))}}setThreeCameraDirty(e){this._threeCameraDirty=e}show2DRenderingPlane(e){!this._threePlaneMesh||this._threePlaneMesh.visible!==e&&(this._threePlaneMesh.visible=e)}updatePosition(){const e=-h.toRad(this._layer.getCameraRotation()),t=this._layer.getCameraZoom();this._pixiContainer.rotation=e,this._pixiContainer.scale.x=t,this._pixiContainer.scale.y=t;const r=Math.cos(e),s=Math.sin(e),a=this._layer.getCameraX()*t*r-this._layer.getCameraY()*t*s,n=this._layer.getCameraX()*t*s+this._layer.getCameraY()*t*r;this._pixiContainer.position.x=this._layer.getWidth()/2-a,this._pixiContainer.position.y=this._layer.getHeight()/2-n,this._layer.getRuntimeScene().getGame().getPixelsRounding()&&(r===0||s===0)&&Number.isInteger(t)&&(this._layer.getRuntimeScene().getGame().getRenderer().getPIXIRenderer()instanceof PIXI.Renderer?(this._pixiContainer.position.x=Math.round(this._pixiContainer.position.x),this._pixiContainer.position.y=Math.round(this._pixiContainer.position.y)):(this._pixiContainer.position.x=Math.ceil(this._pixiContainer.position.x),this._pixiContainer.position.y=Math.ceil(this._pixiContainer.position.y))),this._threeCamera&&(this._threeCamera.position.x=this._layer.getCameraX(),this._threeCamera.position.y=-this._layer.getCameraY(),this._threeCamera.rotation.z=e,this._threeCamera instanceof THREE.OrthographicCamera?(this._threeCamera.zoom=this._layer.getCameraZoom(),this._threeCamera.updateProjectionMatrix(),this._threeCamera.position.z=this._layer.getCameraZ(null)):this._threeCamera.position.z=this._layer.getCameraZ(this._threeCamera.fov),this._threePlaneMesh&&(this._threePlaneMesh.scale.x=this._layer.getWidth()/t,this._threePlaneMesh.scale.y=this._layer.getHeight()/t,this._threePlaneMesh.position.x=this._threeCamera.position.x,this._threePlaneMesh.position.y=-this._threeCamera.position.y,this._threePlaneMesh.rotation.z=-e))}updateResolution(){if(this._threeEffectComposer){const e=this._layer.getRuntimeScene().getGame();this._threeEffectComposer.setSize(e.getGameResolutionWidth(),e.getGameResolutionHeight())}}isCameraRotatedIn3D(){return this._threeCamera&&(this._threeCamera.rotation.x!==0||this._threeCamera.rotation.y!==0)}transformTo3DWorld(e,t,r,s,a){const n=this._threeCamera;if(!n)return a[0]=0,a[1]=0,a;const u=this._layer.getWidth(),g=this._layer.getHeight(),_=e/u*2-1,d=-(t/g)*2+1;let i=l.vectorForProjections;if(i||(i=new THREE.Vector3,l.vectorForProjections=i),n.updateMatrixWorld(),n instanceof THREE.OrthographicCamera){i.set(_,d,0),i.unproject(n);const o=new THREE.Vector3;n.getWorldDirection(o);const m=(r-i.z)/o.z;i.x+=m*o.x,i.y+=m*o.y}else{i.set(_,d,.5),i.unproject(n),i.sub(n.position).normalize();const o=(r-n.position.z)/i.z;i.x=o*i.x+n.position.x,i.y=o*i.y+n.position.y}return!Number.isFinite(i.x)||!Number.isFinite(i.y)?(a[0]=0,a[1]=0,a):(a[0]=i.x,a[1]=-i.y,a)}updateVisibility(e){this._pixiContainer.visible=!!e,this._threeGroup&&(this._threeGroup.visible=!!e)}updatePreRender(){if(this._threeCameraDirty){const e=this.getThreeCamera();e&&e.updateProjectionMatrix(),this._threeCameraDirty=!1}}addRendererObject(e,t){const r=e;r.zIndex=t||l.zeroZOrderForPixi,this._pixiContainer.addChild(r)}changeRendererObjectZOrder(e,t){const r=e;r.zIndex=t}removeRendererObject(e){this._pixiContainer.removeChild(e)}has3DObjects(){return!!this._threeGroup&&this._threeGroup.children.length>0}has2DObjects(){return this._pixiContainer.children.length>0}add3DRendererObject(e){!this._threeGroup||this._threeGroup.add(e)}remove3DRendererObject(e){!this._threeGroup||this._threeGroup.remove(e)}updateClearColor(){this._clearColor=this._layer.getClearColor()}_createPixiRenderTexture(e){if(!e||e.type!==PIXI.RENDERER_TYPE.WEBGL)return;if(this._renderTexture){p.error("Tried to create a PixiJS RenderTexture for a layer that already has one.");return}this._oldWidth=e.screen.width,this._oldHeight=e.screen.height;const t=this._oldWidth,r=this._oldHeight,s=e.resolution;this._renderTexture=PIXI.RenderTexture.create({width:t||100,height:r||100,resolution:s}),this._renderTexture.baseTexture.scaleMode=PIXI.SCALE_MODES.LINEAR,p.info(`RenderTexture created for layer ${this._layer.getName()}.`)}renderOnPixiRenderTexture(e){if(!this._renderTexture)return;(this._oldWidth!==e.screen.width||this._oldHeight!==e.screen.height)&&(this._renderTexture.resize(e.screen.width||100,e.screen.height||100),this._oldWidth=e.screen.width,this._oldHeight=e.screen.height);const t=e.renderTexture.current||void 0,r=e.renderTexture.sourceFrame;e.renderTexture.bind(this._renderTexture),this._clearColor[3]=this._isLightingLayer?1:0,e.renderTexture.clear(this._clearColor),e.render(this._pixiContainer,{renderTexture:this._renderTexture,clear:!1}),e.renderTexture.bind(t,r,void 0)}updateThreePlaneTextureFromPixiRenderTexture(e,t){if(!this._threePlaneTexture||!this._renderTexture)return;const r=this._renderTexture.baseTexture._glTextures[t.CONTEXT_UID];if(r){const s=e.properties.get(this._threePlaneTexture);s.__webglTexture=r.texture}}_setupLightingRendering(e,t){if(this._createPixiRenderTexture(e),!this._renderTexture)return;this._lightingSprite=new PIXI.Sprite(this._renderTexture),this._lightingSprite.blendMode=PIXI.BLEND_MODES.MULTIPLY;const r=t.getRendererObject();if(r){const s=r.getChildIndex(this._pixiContainer);r.addChildAt(this._lightingSprite,s),r.removeChild(this._pixiContainer)}}};let c=l;c.zeroZOrderForPixi=Math.pow(2,-24),c.vectorForProjections=null,h.LayerPixiRenderer=c,h.LayerRenderer=h.LayerPixiRenderer})(gdjs||(gdjs={})); +//# sourceMappingURL=layer-pixi-renderer.js.map diff --git a/pixi-renderers/loadingscreen-pixi-renderer.js b/pixi-renderers/loadingscreen-pixi-renderer.js new file mode 100644 index 0000000000000000000000000000000000000000..5b34269a46c59127ea4c99ef2acc6bce94f78ca9 --- /dev/null +++ b/pixi-renderers/loadingscreen-pixi-renderer.js @@ -0,0 +1,2 @@ +var gdjs;(function(p){let a;(function(r){r[r.NOT_STARTED=0]="NOT_STARTED",r[r.STARTED=1]="STARTED",r[r.FINISHED=2]="FINISHED"})(a||(a={}));const d=(n,e,i)=>{!n||(e>0?(n.alpha+=1/e*i/1e3,n.alpha>1&&(n.alpha=1)):n.alpha=1)},_=n=>!n||n.alpha>=1;class c{constructor(e,i,r,t,s){this._backgroundSprite=null;this._gdevelopLogoSprite=null;this._progressBarGraphics=null;this._state=0;this._startTimeInMs=0;this._backgroundReadyTimeInMs=0;this._lastFrameTimeInMs=0;this._progressPercent=0;if(this._loadingScreenData=r,this._isWatermarkEnabled=t,this._isFirstLayout=s,this._loadingScreenContainer=new PIXI.Container,this._pixiRenderer=e.getPIXIRenderer(),!this._pixiRenderer)return;const o=i.getOrLoadPIXITexture(r.backgroundImageResourceName);o!==i.getInvalidPIXITexture()&&(this._backgroundSprite=PIXI.Sprite.from(o),this._backgroundSprite.alpha=0,this._backgroundSprite.anchor.x=.5,this._backgroundSprite.anchor.y=.5,this._loadingScreenContainer.addChild(this._backgroundSprite)),r.showGDevelopSplash&&s&&(this._gdevelopLogoSprite=PIXI.Sprite.from(p.gdevelopLogo),this._gdevelopLogoSprite.alpha=0,this._gdevelopLogoSprite.anchor.x=.5,this._gdevelopLogoSprite.anchor.y=.5,this._loadingScreenContainer.addChild(this._gdevelopLogoSprite)),r.showProgressBar&&(this._progressBarGraphics=new PIXI.Graphics,this._progressBarGraphics.alpha=0,this._loadingScreenContainer.addChild(this._progressBarGraphics)),this._render(performance.now())}setPercent(e){this._progressPercent=e}_startLoadingScreen(){!this._pixiRenderer||(this._state=1,this._startTimeInMs=performance.now())}_updatePositions(){if(!!this._pixiRenderer){if(this._backgroundSprite&&this._backgroundSprite.texture.valid){this._backgroundSprite.position.x=this._pixiRenderer.width/2,this._backgroundSprite.position.y=this._pixiRenderer.height/2;const e=Math.max(this._pixiRenderer.width/this._backgroundSprite.texture.width,this._pixiRenderer.height/this._backgroundSprite.texture.height);this._backgroundSprite.scale.x=e,this._backgroundSprite.scale.y=e}if(this._gdevelopLogoSprite){this._gdevelopLogoSprite.position.x=this._pixiRenderer.width/2,this._gdevelopLogoSprite.position.y=this._pixiRenderer.height/2;const e=680,i=this._pixiRenderer.width>this._pixiRenderer.height&&this._pixiRenderer.width>500?150:35,t=Math.min(e,Math.max(1,this._pixiRenderer.width-i*2))/e;this._gdevelopLogoSprite.scale.x=t,this._gdevelopLogoSprite.scale.y=t,this._gdevelopLogoSprite.visible=this._pixiRenderer.width>200&&this._pixiRenderer.height>200}}}_render(e){!this._pixiRenderer||this._state!==2&&(requestAnimationFrame(()=>this._render(performance.now())),this._renderIfNeeded(e))}renderIfNeeded(){return this._renderIfNeeded(performance.now())}_renderIfNeeded(e){if(e-this._lastFrameTimeInMs<1e3/60||!this._pixiRenderer)return!1;const i=this._lastFrameTimeInMs?e-this._lastFrameTimeInMs:0;if(this._lastFrameTimeInMs=e,this._updatePositions(),this._state===2)return!0;if(this._state==0)return this._pixiRenderer.background.color=this._loadingScreenData.backgroundColor,(!this._backgroundSprite||this._backgroundSprite.texture.valid)&&this._startLoadingScreen(),!0;const r=this._loadingScreenData.backgroundFadeInDuration;if(this._backgroundSprite||d(this._pixiRenderer.background,r,i),this._pixiRenderer.clear(),d(this._backgroundSprite,r,i),_(this._backgroundSprite)){this._backgroundReadyTimeInMs||(this._backgroundReadyTimeInMs=e);const t=this._loadingScreenData.logoAndProgressFadeInDuration,s=this._loadingScreenData.logoAndProgressLogoFadeInDelay;e-this._backgroundReadyTimeInMs>s*1e3&&(d(this._gdevelopLogoSprite,t,i),d(this._progressBarGraphics,t,i))}if(this._progressBarGraphics){const t=this._loadingScreenData.progressBarColor;let s=this._loadingScreenData.progressBarWidthPercent/100*this._pixiRenderer.width;this._loadingScreenData.progressBarMaxWidth>0&&s>this._loadingScreenData.progressBarMaxWidth&&(s=this._loadingScreenData.progressBarMaxWidth),this._loadingScreenData.progressBarMinWidth>0&&sthis._loadingScreenData.minDuration)return this._state=2,Promise.resolve();const r=this._loadingScreenData.minDuration-e;return this.setPercent(100),new Promise(t=>setTimeout(()=>{this._state=2,t()},r*1e3))}}p.LoadingScreenRenderer=c})(gdjs||(gdjs={})); +//# sourceMappingURL=loadingscreen-pixi-renderer.js.map diff --git a/pixi-renderers/pixi-bitmapfont-manager.js b/pixi-renderers/pixi-bitmapfont-manager.js new file mode 100644 index 0000000000000000000000000000000000000000..22d8d40620edc9cf9b1ec9b25b442b92a08bae83 --- /dev/null +++ b/pixi-renderers/pixi-bitmapfont-manager.js @@ -0,0 +1,2 @@ +var gdjs;(function(a){const n=new a.Logger("Bitmap text"),l="GDJS-DEFAULT-BITMAP-FONT",m=5,p=(s,t)=>{const i=s.font;return s.font=t,PIXI.BitmapFont.available[t]=s,delete PIXI.BitmapFont.available[i],PIXI.BitmapFont.available[t]},d=["bitmapFont"];class u{constructor(t,i){this._pixiBitmapFontsInUse={};this._pixiBitmapFontsToUninstall=[];this._loadedFontsData=new a.ResourceCache;this._defaultSlugFontName=null;this._imageManager=i,this._resourceLoader=t}getResourceKinds(){return d}getDefaultBitmapFont(){if(this._defaultSlugFontName!==null)return PIXI.BitmapFont.available[this._defaultSlugFontName];const t="Arial",i=new PIXI.TextStyle({fontFamily:t,fontSize:20,padding:5,align:"left",fill:"#ffffff",wordWrap:!0,lineHeight:20}),e=p(PIXI.BitmapFont.from(t,i,{chars:[[" ","~"]]}),l);return this._defaultSlugFontName=e.font,e}_markBitmapFontAsUsed(t){this._pixiBitmapFontsInUse[t]=this._pixiBitmapFontsInUse[t]||{objectsUsingTheFont:0},this._pixiBitmapFontsInUse[t].objectsUsingTheFont++;for(let i=0;im)){const i=this._pixiBitmapFontsToUninstall.shift();PIXI.BitmapFont.uninstall(i),n.log("Bitmap Text",'Uninstalled BitmapFont "'+i+'" from memory.')}}}obtainBitmapFont(t,i){const e=t+"@"+i;if(PIXI.BitmapFont.available[e])return this._markBitmapFontAsUsed(e),PIXI.BitmapFont.available[e];const o=this._loadedFontsData.getFromName(t);if(!o)return n.warn('Could not find Bitmap Font for resource named "'+t+'". The default font will be used.'),this.getDefaultBitmapFont();const c=this._imageManager.getPIXITexture(i);try{const r=p(PIXI.BitmapFont.install(o,c),e);return this._markBitmapFontAsUsed(e),r}catch(r){return n.error('Could not load the Bitmap Font for resource named "'+t+'". The default font will be used. Error is: '+r),this.getDefaultBitmapFont()}}async processResource(t){}async loadResource(t){const i=this._resourceLoader.getResource(t);if(!i){n.warn('Unable to find bitmap font for resource "'+t+'".');return}if(!this._loadedFontsData.get(i))try{const o=await(await fetch(this._resourceLoader.getFullUrl(i.file),{credentials:this._resourceLoader.checkIfCredentialsRequired(i.file)?"include":"same-origin"})).text();this._loadedFontsData.set(i,o)}catch(e){n.error("Can't fetch the bitmap font file "+i.file+", error: "+e)}}dispose(){for(const t in this._pixiBitmapFontsInUse)PIXI.BitmapFont.uninstall(t);for(const t of this._pixiBitmapFontsToUninstall)PIXI.BitmapFont.uninstall(t);this._pixiBitmapFontsInUse={},this._pixiBitmapFontsToUninstall.length=0,this._loadedFontsData.clear()}}a.PixiBitmapFontManager=u,a.BitmapFontManager=a.PixiBitmapFontManager})(gdjs||(gdjs={})); +//# sourceMappingURL=pixi-bitmapfont-manager.js.map diff --git a/pixi-renderers/pixi-effects-manager.js b/pixi-renderers/pixi-effects-manager.js new file mode 100644 index 0000000000000000000000000000000000000000..bc29af19d014c0c4275d700221b334c33b16e952 --- /dev/null +++ b/pixi-renderers/pixi-effects-manager.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){class f{initializeEffect(e,t,n){const r=i.PixiFiltersTools.getFilterCreator(e.effectType);return r?(t[e.name]=r.makeFilter(n,e),!0):(console.warn(`Effect: "${e.name}", on layer: "${n.getName()}", has an unknown effect type: "${e.effectType}". Was it registered properly? Is the effect type correct?`),!1)}updatePreRender(e,t){for(const n in e)e[n].updatePreRender(t)}addEffect(e,t,n){let r=!0;return r=this.initializeEffect(e,t,n)&&r,r=this.updateAllEffectParameters(t,e)&&r,t[e.name]&&(r=t[e.name].applyEffect(n)&&r),r}removeEffect(e,t,n){const r=e[n];return r?(r.removeEffect(t),delete e[n],!0):!1}clearEffects(e){return e&&(e.filters=[]),!0}setEffectDoubleParameter(e,t,n,r){const a=e[t];return a?(a.updateDoubleParameter(n,r),!0):!1}setEffectStringParameter(e,t,n,r){const a=e[t];return a?(a.updateStringParameter(n,r),!0):!1}setEffectBooleanParameter(e,t,n,r){const a=e[t];return a?(a.updateBooleanParameter(n,r),!0):!1}updateAllEffectParameters(e,t){let n=!0,r=!0,a=!0;for(let s in t.doubleParameters)n=this.setEffectDoubleParameter(e,t.name,s,t.doubleParameters[s])&&n;for(let s in t.stringParameters)r=this.setEffectStringParameter(e,t.name,s,t.stringParameters[s])&&r;for(let s in t.booleanParameters)a=this.setEffectBooleanParameter(e,t.name,s,t.booleanParameters[s])&&a;return n&&r&&a}hasEffect(e,t){return!!e[t]}enableEffect(e,t,n,r){const a=e[n];!a||a.setEnabled(t,r)}isEffectEnabled(e,t,n){const r=e[n];return r?r.isEnabled(t):!1}}i.EffectsManager=f})(gdjs||(gdjs={})); +//# sourceMappingURL=pixi-effects-manager.js.map diff --git a/pixi-renderers/pixi-filters-tools.js b/pixi-renderers/pixi-filters-tools.js new file mode 100644 index 0000000000000000000000000000000000000000..fa3be126c7e08a097352415b47934dedc81bdf5a --- /dev/null +++ b/pixi-renderers/pixi-filters-tools.js @@ -0,0 +1,2 @@ +var gdjs;(function(o){const f=new o.Logger("Filters");let m;(function(n){n.clampValue=function(r,e,t){return Math.max(e,Math.min(t,r))},n.clampKernelSize=function(r,e,t){const a=Math.round((t-e)/2+1),s=new Array(a);for(let l=0;la!==this.pixiFilter),!0):!1}updatePreRender(e){this.filterCreator.updatePreRender(this.pixiFilter,e)}updateDoubleParameter(e,t){this.filterCreator.updateDoubleParameter(this.pixiFilter,e,t)}updateStringParameter(e,t){this.filterCreator.updateStringParameter(this.pixiFilter,e,t)}updateBooleanParameter(e,t){this.filterCreator.updateBooleanParameter(this.pixiFilter,e,t)}updateColorParameter(e,t){this.filterCreator.updateColorParameter(this.pixiFilter,e,t)}getDoubleParameter(e){return this.filterCreator.getDoubleParameter(this.pixiFilter,e)}getColorParameter(e){return this.filterCreator.getColorParameter(this.pixiFilter,e)}getNetworkSyncData(){return{ena:this.pixiFilter.enabled,fc:this.filterCreator.getNetworkSyncData(this.pixiFilter)}}updateFromNetworkSyncData(e){this.pixiFilter.enabled=e.ena,this.filterCreator.updateFromNetworkSyncData(this.pixiFilter,e.fc)}}n.PixiFilter=u;class F{isEnabled(e){return!1}setEnabled(e,t){return!1}applyEffect(e){return!1}removeEffect(e){return!1}updatePreRender(e){}updateDoubleParameter(e,t){}updateStringParameter(e,t){}updateBooleanParameter(e,t){}updateColorParameter(e,t){}getDoubleParameter(e){return 0}getColorParameter(e){return 0}getNetworkSyncData(){return{}}updateFromNetworkSyncData(e){}}n.EmptyFilter=F})(m=o.PixiFiltersTools||(o.PixiFiltersTools={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=pixi-filters-tools.js.map diff --git a/pixi-renderers/pixi-image-manager.js b/pixi-renderers/pixi-image-manager.js new file mode 100644 index 0000000000000000000000000000000000000000..7e108e6fd089dff1855acebacb776369ad9ff6c6 --- /dev/null +++ b/pixi-renderers/pixi-image-manager.js @@ -0,0 +1,2 @@ +var gdjs;(function(l){const a=new l.Logger("PIXI Image manager"),T=(n,e)=>{a.error("Unable to load file "+n+" with error:",e||"(unknown error)")},d=(n,e)=>{!n||e.smoothed||(n.baseTexture.scaleMode=PIXI.SCALE_MODES.NEAREST)},A=(n,e)=>{e&&!e.smoothed&&(n.magFilter=THREE.NearestFilter,n.minFilter=THREE.NearestFilter)},g=["image","video"];class x{constructor(e){this._loadedTextures=new l.ResourceCache;this._diskTextures=new Map;this._rectangleTextures=new Map;this._scaledTextures=new Map;this._getImageResource=e=>{const r=this._resourceLoader.getResource(e);return r&&this.getResourceKinds().includes(r.kind)?r:null};this._resourceLoader=e,this._invalidTexture=PIXI.Texture.from("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAMAAABlApw1AAAAkFBMVEWdIvr///+hOfrx6v7i0/39/P+eK/rn2v6vbPv7+f/cx/359v/38v7s4v7Wvf3LqvzFnvysY/v18P6jQvrz7P7u5P7ezP3Or/yoV/qlTfrq3v7l1v3hz/2fLvrTuPy0efufMvraxP3YwP3AlPu2fvuuavvRtPy8i/uqXfu5hvvIo/y4gvuxcvugNfq+j/vCmfxfwZ2lAAAF60lEQVR42uzPMQ0AAAjEQPBvmhkBDE+uAppcdXgfAHXY9R4AAAAAAAAAAGAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAEA/YAQAMNfa2nCoMhmE4HxhcFESggMhGtNa11NLl/d9dO53pQRMklPKn4TllhuEdEjb/CK/WWPXvBTjOOVxvDsvVO3u03e8EnC9BZnNMwNcfYDU728NkLpoDLpmPSQU6Ax5vNsfE0lpbwOs1AYGbroDnBCQyPQH7tQsanpYAqwQVftEQEKWgE9AHtAkIpTV1QBOD1Jk4IPJA6y9tQF2C2Io24ApqXq4OMHgBvTsSBjgVBnA9P7HH2xEGPOM+7hVPQdhGUZRvt4/WeHvCgBJ3uFXYsn4m/BO3HJ2Ko8XuMSogQBdvzXoYFRCjQ3GazWQuRIfKms1o0Skge3DmMxvdckiWzoyGu0dIvGhO0+kAkmBW4/UVRPw0qwAfopKpmRPwh0N0ZGrmBPyDyI2Yms6AaiH48nd3g8hmsijMFkrZ9UQSwCFY9j+EHpgor1wM4gaO9oAKog0TtDEGuxoQIF7DOcZwqQEB4kJe4Bt83QHOEiJLuAGe2QG2KuAF37HUHVAn0wZsdAfs/WkD8pkHrGrtSyhWBVgxhnti5m1itsZg/IUiIO4NKJQBzoFjoJjRB6hfZA0T/U8xTEASkMo7TfEtJLGa4CB81JYeZM3PAmQfUQUEtsUY+zx66N6I+MTuySFJPk48Sl9ACYH/1s6dICkKQwEYfg9NkE1QdhkREXGZ1rn/7aZmrR4SAdHnMpXvAF31txETSPA/BXjy9QBiV0KKAhNuCwA5E5vS1hWZtYc+XBScYbDhAVsDm7xeuxYX2GQUzwgAu9+cHrFzkuoCTcAamz7ar6O46QiQr6WNLVGAOFjjjrE88rsDIskHRxRQYVPecTlEszvAEP8tVAErbFrDJ0sHRceuAA8FCVXAB2u/81OjiOW8PUAXR9CJKsCfY4OtwSeFhRJm2haQGpJ5EFUAjLCp6vGQL9gUlwM8yUyaLmDcccXeGyjleKf+f3IOdAHiILc5CD8FMuzLZg8SmiWOIMKAr9gxhvYMLzKCsp5onbe0cUUY4KMgb6y5sN1I183Y+yM2Q3EE+VQB8mXjqIDPEhtvFJE+4Cg7t2Nv8EZn0oAdCnSh8SZWQRrALWxijS+dtqAfQcMDwETBmMM/fB1vcCYOWKGo+cup3VBgnYgDtKDHjXB/gUNl5I9Z8z7bCE9THMgjD0gZCmwfmg4BDhEW5AGwRlHGocmfWni9KdAHTIyeF780MvBKrCIIEMS9HwhtTYZXCeARAVrQfz/wrMRrlBQBohol7C3I8KQOGPZVPSbAH0kLJnBBlS+wm/PleFiSBIg22PoZiLi/yZ3AkC9zRuG69hLhoCplwHKMMtaOQwu+XR3itfnXOvcOq9VMe8aGp5mNUqUPT9crADyUcyZAgCAAdJSzvwIBgoDEQjlWJu/xWoaVgRfMa+0dAuBg4MUE178xYDuR2t8zAI4MLyfE6fAAvhsxKeN81wDIsYUVbQYGrMZ4QcTvGwBrbGWXX0/XBvDDmOEFQQp3DuARdljEiQa9cf+Y4WWb+289LiLsNB+7uz4RxS7WGbbIKfZO85phD8Y8Ko/bWcJBwt/PdlMzMLDduqDZ/L0zsDcrdJxFNI3dX+JppDuOM8c+oiXV7vXVCB8gO9Ftv/czJJdplOcHuGshLfNEfABiFyKlbEl+gqOoGZKJl484gjLLkEa4HTobfYlxxGrtgWcpzzremf7x2OO4vMoMvBsWnjkQB4gmEd5J8PU5r2nj23yEt1scORAFdCsm0znD4Zg9/eC0a+JuVa0bOARb5BXpor4/v8qdOV7DDstvKQd4kYAfllW/l+Sx+RfzW+XDDy8V8BPnyc511wvHCQPb+F3DDDsIHcfJStc9p5w//zRrL1qazH7ZJ6nP4a8XOI77IlTAld4w4FVu7qqA31SAClABKkAFqAAVoAJUgApQASpABagAFaACVIAKUAH/TcB7e/uA7+03ZsJSaNOuAAAAAElFTkSuQmCC",{width:192,height:192}),this._loadedThreeTextures=new Hashtable,this._loadedThreeMaterials=new Hashtable}getResourceKinds(){return g}getPIXITexture(e){const r=this._getImageResource(e);if(!r)return a.warn('Unable to find texture for resource "'+e+'".'),this._invalidTexture;const t=this._loadedTextures.get(r);return t?t.valid?t:(a.error("Texture for "+e+" is not valid anymore (or never was)."),this._invalidTexture):this._invalidTexture}getOrLoadPIXITexture(e){const r=this._getImageResource(e);if(!r)return a.warn('Unable to find texture for resource "'+e+'".'),this._invalidTexture;const t=this._loadedTextures.get(r);if(t)return t.valid?t:(a.error("Texture for "+e+" is not valid anymore (or never was)."),this._invalidTexture);a.log('Loading texture for resource "'+e+'"...');const i=r.file,o=this._resourceLoader.getFullUrl(i),s=PIXI.Texture.from(o,{resourceOptions:{crossorigin:this._resourceLoader.checkIfCredentialsRequired(i)?"use-credentials":"anonymous"}}).on("error",u=>{T(i,u)});if(!s)throw new Error("Texture loading by PIXI returned nothing for file "+i+" behind url "+o);return d(s,r),this._loadedTextures.set(r,s),s}getThreeTexture(e){const r=this._loadedThreeTextures.get(e);if(r)return r;const t=this.getPIXITexture(e);if(!this._resourceLoader._runtimeGame.getRenderer().getPIXIRenderer())throw new Error("No PIXI renderer was found.");const o=t.baseTexture.resource.source;if(!(o instanceof HTMLImageElement))throw new Error(`Can't load texture for resource "${e}" as it's not an image.`);const s=new THREE.Texture(o);s.magFilter=THREE.LinearFilter,s.minFilter=THREE.LinearFilter,s.wrapS=THREE.RepeatWrapping,s.wrapT=THREE.RepeatWrapping,s.colorSpace=THREE.SRGBColorSpace,s.needsUpdate=!0;const u=this._getImageResource(e);return A(s,u),this._loadedThreeTextures.put(e,s),s}getThreeMaterial(e,{useTransparentTexture:r,forceBasicMaterial:t}){const i=`${e}|${r?1:0}|${t?1:0}`,o=this._loadedThreeMaterials.get(i);if(o)return o;const s=t?new THREE.MeshBasicMaterial({map:this.getThreeTexture(e),side:r?THREE.DoubleSide:THREE.FrontSide,transparent:r}):new THREE.MeshStandardMaterial({map:this.getThreeTexture(e),side:r?THREE.DoubleSide:THREE.FrontSide,transparent:r,metalness:0});return this._loadedThreeMaterials.put(i,s),s}getPIXIVideoTexture(e){if(e==="")return this._invalidTexture;const r=this._getImageResource(e);if(!r)return a.warn('Unable to find video texture for resource "'+e+'".'),this._invalidTexture;const t=this._loadedTextures.get(r);return t||this._invalidTexture}getInvalidPIXITexture(){return this._invalidTexture}async loadResource(e){const r=this._resourceLoader.getResource(e);if(!r){a.warn('Unable to find texture for resource "'+e+'".');return}await this._loadTexture(r)}async processResource(e){}async _loadTexture(e){if(!this._loadedTextures.get(e))try{if(e.kind==="video")await new Promise((r,t)=>{const i=PIXI.Texture.from(this._resourceLoader.getFullUrl(e.file),{resourceOptions:{crossorigin:this._resourceLoader.checkIfCredentialsRequired(e.file)?"use-credentials":"anonymous",autoPlay:!1}}).on("error",s=>{t(s)});i.baseTexture.on("loaded",()=>{this._loadedTextures.set(e,i),d(i,e),r()}).on("error",s=>{t(s)})});else{const r=PIXI.Texture.from(this._resourceLoader.getFullUrl(e.file),{resourceOptions:{autoLoad:!1,crossorigin:this._resourceLoader.checkIfCredentialsRequired(e.file)?"use-credentials":"anonymous"}});await r.baseTexture.resource.load(),this._loadedTextures.set(e,r),d(r,e)}}catch(r){T(e.file,r)}}getOrCreateDiskTexture(e,r){let t=this._diskTextures.get(e);if(!t){const i=new PIXI.Graphics;i.lineStyle(0,0,0),i.beginFill(l.rgbToHexNumber(255,255,255),1),i.drawCircle(0,0,e),i.endFill(),t=r.generateTexture(i),i.destroy(),this._diskTextures.set(e,t)}return t}getOrCreateRectangleTexture(e,r,t){const i=`${e}_${r}`;let o=this._rectangleTextures.get(i);if(!o){const s=new PIXI.Graphics;s.lineStyle(0,0,0),s.beginFill(l.rgbToHexNumber(255,255,255),1),s.drawRect(0,0,e,r),s.endFill(),o=t.generateTexture(s),s.destroy(),this._rectangleTextures.set(i,o)}return o}getOrCreateScaledTexture(e,r,t,i){const o=`${e}_${r}_${t}`;let s=this._scaledTextures.get(o);if(!s){const u=new PIXI.Graphics,c=new PIXI.Sprite(this.getPIXITexture(e));c.width=r,c.height=t,u.addChild(c),s=i.generateTexture(u),u.destroy(),this._scaledTextures.set(o,s)}return s}dispose(){this._loadedTextures.clear();const e=[];this._loadedThreeTextures.values(e),this._loadedThreeTextures.clear();for(const t of e)t.dispose();const r=[];this._loadedThreeMaterials.values(r),this._loadedThreeMaterials.clear();for(const t of r)t.dispose();for(const t of this._diskTextures.values())t.destroyed||t.destroy();this._diskTextures.clear();for(const t of this._rectangleTextures.values())t.destroyed||t.destroy();this._rectangleTextures.clear();for(const t of this._scaledTextures.values())t.destroyed||t.destroy();this._scaledTextures.clear()}}l.PixiImageManager=x,l.ImageManager=l.PixiImageManager})(gdjs||(gdjs={})); +//# sourceMappingURL=pixi-image-manager.js.map diff --git a/pixi-renderers/pixi.js b/pixi-renderers/pixi.js new file mode 100644 index 0000000000000000000000000000000000000000..5f885b19830e541b827faccd7ab261f85fa99d5e --- /dev/null +++ b/pixi-renderers/pixi.js @@ -0,0 +1,1163 @@ +/*! + * pixi.js-legacy - v7.3.0 + * Compiled Mon, 18 Sep 2023 15:35:01 UTC + * + * pixi.js-legacy is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */var PIXI=function(y){"use strict";var be=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(be||{}),li=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(li||{}),ui=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(ui||{}),C=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(C||{}),Ot=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(Ot||{}),M=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(M||{}),Me=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(Me||{}),$=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))($||{}),k=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(k||{}),Bt=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(Bt||{}),Zt=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(Zt||{}),Ht=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(Ht||{}),At=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))(At||{}),Vt=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Vt||{}),ci=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(ci||{}),Rt=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(Rt||{}),pt=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(pt||{}),Pa=(i=>(i[i.RED=1]="RED",i[i.GREEN=2]="GREEN",i[i.BLUE=4]="BLUE",i[i.ALPHA=8]="ALPHA",i))(Pa||{}),ft=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(ft||{}),jt=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))(jt||{});const Ma={createCanvas:(i,t)=>{const e=document.createElement("canvas");return e.width=i,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>{var i;return(i=document.baseURI)!=null?i:window.location.href},getFontFaceSet:()=>document.fonts,fetch:(i,t)=>fetch(i,t),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")},N={ADAPTER:Ma,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Ar=/iPhone/i,Da=/iPod/i,Oa=/iPad/i,Ba=/\biOS-universal(?:.+)Mac\b/i,wr=/\bAndroid(?:.+)Mobile\b/i,Fa=/Android/i,ze=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,di=/Silk/i,he=/Windows Phone/i,Na=/\bWindows(?:.+)ARM\b/i,La=/BlackBerry/i,Ua=/BB10/i,ka=/Opera Mini/i,Ga=/\b(CriOS|Chrome)(?:.+)Mobile/i,$a=/Mobile(?:.+)Firefox\b/i,Ha=function(i){return typeof i!="undefined"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream=="undefined"};function Hu(i){return function(t){return t.test(i)}}function Va(i){var t={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator!="undefined"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?t.userAgent=i:i&&i.userAgent&&(t={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var e=t.userAgent,s=e.split("[FBAN");typeof s[1]!="undefined"&&(e=s[0]),s=e.split("Twitter"),typeof s[1]!="undefined"&&(e=s[0]);var r=Hu(e),n={apple:{phone:r(Ar)&&!r(he),ipod:r(Da),tablet:!r(Ar)&&(r(Oa)||Ha(t))&&!r(he),universal:r(Ba),device:(r(Ar)||r(Da)||r(Oa)||r(Ba)||Ha(t))&&!r(he)},amazon:{phone:r(ze),tablet:!r(ze)&&r(di),device:r(ze)||r(di)},android:{phone:!r(he)&&r(ze)||!r(he)&&r(wr),tablet:!r(he)&&!r(ze)&&!r(wr)&&(r(di)||r(Fa)),device:!r(he)&&(r(ze)||r(di)||r(wr)||r(Fa))||r(/\bokhttp\b/i)},windows:{phone:r(he),tablet:r(Na),device:r(he)||r(Na)},other:{blackberry:r(La),blackberry10:r(Ua),opera:r(ka),firefox:r($a),chrome:r(Ga),device:r(La)||r(Ua)||r(ka)||r($a)||r(Ga)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}var ja;const Xt=((ja=Va.default)!=null?ja:Va)(globalThis.navigator);N.RETINA_PREFIX=/@([0-9\.]+)x/,N.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Sr=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function We(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function dg(i){return i&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function fg(i){return i&&Object.prototype.hasOwnProperty.call(i,"default")&&Object.keys(i).length===1?i.default:i}function pg(i){if(i.__esModule)return i;var t=i.default;if(typeof t=="function"){var e=function s(){if(this instanceof s){var r=[null];r.push.apply(r,arguments);var n=Function.bind.apply(t,r);return new n}return t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(i).forEach(function(s){var r=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(e,s,r.get?r:{enumerable:!0,get:function(){return i[s]}})}),e}var Cr={exports:{}},mg=Cr.exports;(function(i){"use strict";var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function r(h,l,u){this.fn=h,this.context=l,this.once=u||!1}function n(h,l,u,c,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new r(u,c||h,d),p=e?e+l:l;return h._events[p]?h._events[p].fn?h._events[p]=[h._events[p],f]:h._events[p].push(f):(h._events[p]=f,h._eventsCount++),h}function a(h,l){--h._eventsCount===0?h._events=new s:delete h._events[l]}function o(){this._events=new s,this._eventsCount=0}o.prototype.eventNames=function(){var l=[],u,c;if(this._eventsCount===0)return l;for(c in u=this._events)t.call(u,c)&&l.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(u)):l},o.prototype.listeners=function(l){var u=e?e+l:l,c=this._events[u];if(!c)return[];if(c.fn)return[c.fn];for(var d=0,f=c.length,p=new Array(f);d80*e){o=l=i[0],h=u=i[1];for(var p=e;pl&&(l=c),d>u&&(u=d);f=Math.max(l-o,u-h),f=f!==0?32767/f:0}return ls(n,a,e,o,h,f,0),a}function Xa(i,t,e,s,r){var n,a;if(r===Pr(i,t,e,s)>0)for(n=t;n=t;n-=s)a=Ya(n,i[n],i[n+1],a);return a&&mi(a,a.next)&&(cs(a),a=a.next),a}function De(i,t){if(!i)return i;t||(t=i);var e=i,s;do if(s=!1,!e.steiner&&(mi(e,e.next)||ct(e.prev,e,e.next)===0)){if(cs(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function ls(i,t,e,s,r,n,a){if(i){!a&&n&&Ju(i,s,r,n);for(var o=i,h,l;i.prev!==i.next;){if(h=i.prev,l=i.next,n?Xu(i,s,r,n):ju(i)){t.push(h.i/e|0),t.push(i.i/e|0),t.push(l.i/e|0),cs(i),i=l.next,o=l.next;continue}if(i=l,i===o){a?a===1?(i=zu(De(i),t,e),ls(i,t,e,s,r,n,2)):a===2&&Wu(i,t,e,s,r,n):ls(De(i),t,e,s,r,n,1);break}}}}function ju(i){var t=i.prev,e=i,s=i.next;if(ct(t,e,s)>=0)return!1;for(var r=t.x,n=e.x,a=s.x,o=t.y,h=e.y,l=s.y,u=rn?r>a?r:a:n>a?n:a,f=o>h?o>l?o:l:h>l?h:l,p=s.next;p!==t;){if(p.x>=u&&p.x<=d&&p.y>=c&&p.y<=f&&qe(r,o,n,h,a,l,p.x,p.y)&&ct(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Xu(i,t,e,s){var r=i.prev,n=i,a=i.next;if(ct(r,n,a)>=0)return!1;for(var o=r.x,h=n.x,l=a.x,u=r.y,c=n.y,d=a.y,f=oh?o>l?o:l:h>l?h:l,g=u>c?u>d?u:d:c>d?c:d,_=Rr(f,p,t,e,s),x=Rr(m,g,t,e,s),v=i.prevZ,b=i.nextZ;v&&v.z>=_&&b&&b.z<=x;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==r&&v!==a&&qe(o,u,h,c,l,d,v.x,v.y)&&ct(v.prev,v,v.next)>=0||(v=v.prevZ,b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==r&&b!==a&&qe(o,u,h,c,l,d,b.x,b.y)&&ct(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;v&&v.z>=_;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==r&&v!==a&&qe(o,u,h,c,l,d,v.x,v.y)&&ct(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=m&&b.y>=p&&b.y<=g&&b!==r&&b!==a&&qe(o,u,h,c,l,d,b.x,b.y)&&ct(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function zu(i,t,e){var s=i;do{var r=s.prev,n=s.next.next;!mi(r,n)&&za(r,s,s.next,n)&&us(r,n)&&us(n,r)&&(t.push(r.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),cs(s),cs(s.next),s=i=n),s=s.next}while(s!==i);return De(s)}function Wu(i,t,e,s,r,n){var a=i;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&sc(a,o)){var h=Wa(a,o);a=De(a,a.next),h=De(h,h.next),ls(a,t,e,s,r,n,0),ls(h,t,e,s,r,n,0);return}o=o.next}a=a.next}while(a!==i)}function Yu(i,t,e,s){var r=[],n,a,o,h,l;for(n=0,a=t.length;n=e.next.y&&e.next.y!==e.y){var o=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(o<=s&&o>n&&(n=o,a=e.x=e.x&&e.x>=l&&s!==e.x&&qe(ra.x||e.x===a.x&&Qu(a,e)))&&(a=e,c=d)),e=e.next;while(e!==h);return a}function Qu(i,t){return ct(i.prev,i,t.prev)<0&&ct(t.next,i,i.next)<0}function Ju(i,t,e,s){var r=i;do r.z===0&&(r.z=Rr(r.x,r.y,t,e,s)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==i);r.prevZ.nextZ=null,r.prevZ=null,tc(r)}function tc(i){var t,e,s,r,n,a,o,h,l=1;do{for(e=i,i=null,n=null,a=0;e;){for(a++,s=e,o=0,t=0;t0||h>0&&s;)o!==0&&(h===0||!s||e.z<=s.z)?(r=e,e=e.nextZ,o--):(r=s,s=s.nextZ,h--),n?n.nextZ=r:i=r,r.prevZ=n,n=r;e=s}n.nextZ=null,l*=2}while(a>1);return i}function Rr(i,t,e,s,r){return i=(i-e)*r|0,t=(t-s)*r|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,i|t<<1}function ec(i){var t=i,e=i;do(t.x=(i-a)*(n-o)&&(i-a)*(s-o)>=(e-a)*(t-o)&&(e-a)*(n-o)>=(r-a)*(s-o)}function sc(i,t){return i.next.i!==t.i&&i.prev.i!==t.i&&!ic(i,t)&&(us(i,t)&&us(t,i)&&rc(i,t)&&(ct(i.prev,i,t.prev)||ct(i,t.prev,t))||mi(i,t)&&ct(i.prev,i,i.next)>0&&ct(t.prev,t,t.next)>0)}function ct(i,t,e){return(t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y)}function mi(i,t){return i.x===t.x&&i.y===t.y}function za(i,t,e,s){var r=_i(ct(i,t,e)),n=_i(ct(i,t,s)),a=_i(ct(e,s,i)),o=_i(ct(e,s,t));return!!(r!==n&&a!==o||r===0&&gi(i,e,t)||n===0&&gi(i,s,t)||a===0&&gi(e,i,s)||o===0&&gi(e,t,s))}function gi(i,t,e){return t.x<=Math.max(i.x,e.x)&&t.x>=Math.min(i.x,e.x)&&t.y<=Math.max(i.y,e.y)&&t.y>=Math.min(i.y,e.y)}function _i(i){return i>0?1:i<0?-1:0}function ic(i,t){var e=i;do{if(e.i!==i.i&&e.next.i!==i.i&&e.i!==t.i&&e.next.i!==t.i&&za(e,e.next,i,t))return!0;e=e.next}while(e!==i);return!1}function us(i,t){return ct(i.prev,i,i.next)<0?ct(i,t,i.next)>=0&&ct(i,i.prev,t)>=0:ct(i,t,i.prev)<0||ct(i,i.next,t)<0}function rc(i,t){var e=i,s=!1,r=(i.x+t.x)/2,n=(i.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&r<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next;while(e!==i);return s}function Wa(i,t){var e=new Ir(i.i,i.x,i.y),s=new Ir(t.i,t.x,t.y),r=i.next,n=t.prev;return i.next=t,t.prev=i,e.next=r,r.prev=e,s.next=e,e.prev=s,n.next=s,s.prev=n,s}function Ya(i,t,e,s){var r=new Ir(i,t,e);return s?(r.next=s.next,r.prev=s,s.next.prev=r,s.next=r):(r.prev=r,r.next=r),r}function cs(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Ir(i,t,e){this.i=i,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}pi.deviation=function(i,t,e,s){var r=t&&t.length,n=r?t[0]*e:i.length,a=Math.abs(Pr(i,0,n,e));if(r)for(var o=0,h=t.length;o0&&(s+=i[r-1].length,e.holes.push(s))}return e};var nc=fi.exports,qa=We(nc),ds={},vi={exports:{}};/*! https://mths.be/punycode v1.3.2 by @mathias */var vg=vi.exports;(function(i,t){(function(e){var s=t&&!t.nodeType&&t,r=i&&!i.nodeType&&i,n=typeof Sr=="object"&&Sr;(n.global===n||n.window===n||n.self===n)&&(e=n);var a,o=2147483647,h=36,l=1,u=26,c=38,d=700,f=72,p=128,m="-",g=/^xn--/,_=/[^\x20-\x7E]/,x=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},b=h-l,T=Math.floor,R=String.fromCharCode,w;function A(F){throw RangeError(v[F])}function S(F,O){for(var Z=F.length,Q=[];Z--;)Q[Z]=O(F[Z]);return Q}function I(F,O){var Z=F.split("@"),Q="";Z.length>1&&(Q=Z[0]+"@",F=Z[1]),F=F.replace(x,".");var J=F.split("."),st=S(J,O).join(".");return Q+st}function H(F){for(var O=[],Z=0,Q=F.length,J,st;Z=55296&&J<=56319&&Z65535&&(O-=65536,Z+=R(O>>>10&1023|55296),O=56320|O&1023),Z+=R(O),Z}).join("")}function E(F){return F-48<10?F-22:F-65<26?F-65:F-97<26?F-97:h}function P(F,O){return F+22+75*(F<26)-((O!=0)<<5)}function V(F,O,Z){var Q=0;for(F=Z?T(F/d):F>>1,F+=T(F/O);F>b*u>>1;Q+=h)F=T(F/b);return T(Q+(b+1)*F/(F+c))}function q(F){var O=[],Z=F.length,Q,J=0,st=p,et=f,rt,lt,_t,nt,ut,mt,vt,ne,ae;for(rt=F.lastIndexOf(m),rt<0&&(rt=0),lt=0;lt=128&&A("not-basic"),O.push(F.charCodeAt(lt));for(_t=rt>0?rt+1:0;_t=Z&&A("invalid-input"),vt=E(F.charCodeAt(_t++)),(vt>=h||vt>T((o-J)/ut))&&A("overflow"),J+=vt*ut,ne=mt<=et?l:mt>=et+u?u:mt-et,!(vtT(o/ae)&&A("overflow"),ut*=ae;Q=O.length+1,et=V(J-nt,Q,nt==0),T(J/Q)>o-st&&A("overflow"),st+=T(J/Q),J%=Q,O.splice(J++,0,st)}return B(O)}function j(F){var O,Z,Q,J,st,et,rt,lt,_t,nt,ut,mt=[],vt,ne,ae,ii;for(F=H(F),vt=F.length,O=p,Z=0,st=f,et=0;et=O&&utT((o-Z)/ne)&&A("overflow"),Z+=(rt-O)*ne,O=rt,et=0;eto&&A("overflow"),ut==O){for(lt=Z,_t=h;nt=_t<=st?l:_t>=st+u?u:_t-st,!(lt0&&o>a&&(o=a);for(var h=0;h=0?(c=l.substr(0,u),d=l.substr(u+1)):(c=l,d=""),f=decodeURIComponent(c),p=decodeURIComponent(d),ac(r,f)?Array.isArray(r[f])?r[f].push(p):r[f]=[r[f],p]:r[f]=p}return r},bg=We(Qa),ps=function(i){switch(typeof i){case"string":return i;case"boolean":return i?"true":"false";case"number":return isFinite(i)?i:"";default:return""}},Ja=function(i,t,e,s){return t=t||"&",e=e||"=",i===null&&(i=void 0),typeof i=="object"?Object.keys(i).map(function(r){var n=encodeURIComponent(ps(r))+e;return Array.isArray(i[r])?i[r].map(function(a){return n+encodeURIComponent(ps(a))}).join(t):n+encodeURIComponent(ps(i[r]))}).join(t):s?encodeURIComponent(ps(s))+e+encodeURIComponent(ps(i)):""},Tg=We(Ja),oc,hc,Eg=fs.decode=hc=fs.parse=Qa,Ag=fs.encode=oc=fs.stringify=Ja,lc=Ka,Qt=Za,uc=ds.parse=ms,cc=ds.resolve=Tc,wg=ds.resolveObject=Ec,dc=ds.format=bc,Sg=ds.Url=Ft;function Ft(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var fc=/^([a-z0-9.+-]+:)/i,pc=/:[0-9]*$/,mc=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,gc=["<",">",'"',"`"," ","\r",` +`," "],_c=["{","}","|","\\","^","`"].concat(gc),Mr=["'"].concat(_c),to=["%","/","?",";","#"].concat(Mr),eo=["/","?","#"],vc=255,so=/^[+a-z0-9A-Z_-]{0,63}$/,yc=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,xc={javascript:!0,"javascript:":!0},Dr={javascript:!0,"javascript:":!0},Ke={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},Or=fs;function ms(i,t,e){if(i&&Qt.isObject(i)&&i instanceof Ft)return i;var s=new Ft;return s.parse(i,t,e),s}Ft.prototype.parse=function(i,t,e){if(!Qt.isString(i))throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var s=i.indexOf("?"),r=s!==-1&&s127?T+="x":T+=b[R];if(!T.match(so)){var A=x.slice(0,f),S=x.slice(f+1),I=b.match(yc);I&&(A.push(I[1]),S.unshift(I[2])),S.length&&(o="/"+S.join(".")+o),this.hostname=A.join(".");break}}}this.hostname.length>vc?this.hostname="":this.hostname=this.hostname.toLowerCase(),_||(this.hostname=lc.toASCII(this.hostname));var H=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+H,this.href+=this.host,_&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),o[0]!=="/"&&(o="/"+o))}if(!xc[u])for(var f=0,v=Mr.length;f0?e.host.split("@"):!1;T&&(e.auth=T.shift(),e.host=e.hostname=T.shift())}return e.search=i.search,e.query=i.query,(!Qt.isNull(e.pathname)||!Qt.isNull(e.search))&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!x.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var R=x.slice(-1)[0],w=(e.host||i.host||x.length>1)&&(R==="."||R==="..")||R==="",A=0,S=x.length;S>=0;S--)R=x[S],R==="."?x.splice(S,1):R===".."?(x.splice(S,1),A++):A&&(x.splice(S,1),A--);if(!g&&!_)for(;A--;A)x.unshift("..");g&&x[0]!==""&&(!x[0]||x[0].charAt(0)!=="/")&&x.unshift(""),w&&x.join("/").substr(-1)!=="/"&&x.push("");var I=x[0]===""||x[0]&&x[0].charAt(0)==="/";if(b){e.hostname=e.host=I?"":x.length?x.shift():"";var T=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;T&&(e.auth=T.shift(),e.host=e.hostname=T.shift())}return g=g||e.host&&x.length,g&&!I&&x.unshift(""),x.length?e.pathname=x.join("/"):(e.pathname=null,e.path=null),(!Qt.isNull(e.pathname)||!Qt.isNull(e.search))&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e},Ft.prototype.parseHost=function(){var i=this.host,t=pc.exec(i);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),i=i.substr(0,i.length-t.length)),i&&(this.hostname=i)};const io={};function ro(i,t,e=3){if(io[t])return;let s=new Error().stack;typeof s=="undefined"?console.warn("PixiJS Deprecation Warning: ",`${t} +Deprecated since v${i}`):(s=s.split(` +`).splice(e).join(` +`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t} +Deprecated since v${i}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t} +Deprecated since v${i}`),console.warn(s))),io[t]=!0}const Ac={get parse(){return uc},get format(){return dc},get resolve(){return cc}};function zt(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function gs(i){return i.split("?")[0].split("#")[0]}function wc(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sc(i,t,e){return i.replace(new RegExp(wc(t),"g"),e)}function Cc(i,t){let e="",s=0,r=-1,n=0,a=-1;for(let o=0;o<=i.length;++o){if(o2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",s=0):(e=e.slice(0,h),s=e.length-1-e.lastIndexOf("/")),r=o,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,r=o,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${i.slice(r+1,o)}`:e=i.slice(r+1,o),s=o-r-1;r=o,n=0}else a===46&&n!==-1?++n:n=-1}return e}const bt={toPosix(i){return Sc(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){zt(i),i=this.toPosix(i);const t=/^file:\/\/\//.exec(i);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(zt(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=gs(this.toPosix(t!=null?t:N.ADAPTER.getBaseUrl())),r=gs(this.toPosix(e!=null?e:this.rootname(s)));return i=this.toPosix(i),i.startsWith("/")?bt.join(r,i.slice(1)):this.isAbsolute(i)?i:this.join(s,i)},normalize(i){if(zt(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="";const e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));const s=i.endsWith("/");return i=Cc(i,!1),i.length>0&&s&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return zt(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){var t;if(i.length===0)return".";let e;for(let s=0;s0)if(e===void 0)e=r;else{const n=(t=i[s-1])!=null?t:"";this.extname(n)?e+=`/../${r}`:e+=`/${r}`}}return e===void 0?".":this.normalize(e)},dirname(i){if(zt(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0);const e=t===47;let s=-1,r=!0;const n=this.getProtocol(i),a=i;i=i.slice(n.length);for(let o=i.length-1;o>=1;--o)if(t=i.charCodeAt(o),t===47){if(!r){s=o;break}}else r=!1;return s===-1?e?"/":this.isUrl(a)?n+i:n:e&&s===1?"//":n+i.slice(0,s)},rootname(i){zt(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){const e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){zt(i),t&&zt(t),i=gs(this.toPosix(i));let e=0,s=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let a=t.length-1,o=-1;for(n=i.length-1;n>=0;--n){const h=i.charCodeAt(n);if(h===47){if(!r){e=n+1;break}}else o===-1&&(r=!1,o=n+1),a>=0&&(h===t.charCodeAt(a)?--a===-1&&(s=n):(a=-1,s=o))}return e===s?s=o:s===-1&&(s=i.length),i.slice(e,s)}for(n=i.length-1;n>=0;--n)if(i.charCodeAt(n)===47){if(!r){e=n+1;break}}else s===-1&&(r=!1,s=n+1);return s===-1?"":i.slice(e,s)},extname(i){zt(i),i=gs(this.toPosix(i));let t=-1,e=0,s=-1,r=!0,n=0;for(let a=i.length-1;a>=0;--a){const o=i.charCodeAt(a);if(o===47){if(!r){e=a+1;break}continue}s===-1&&(r=!1,s=a+1),o===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":i.slice(t,s)},parse(i){zt(i);const t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=gs(this.toPosix(i));let e=i.charCodeAt(0);const s=this.isAbsolute(i);let r;const n="";t.root=this.rootname(i),s||this.hasProtocol(i)?r=1:r=0;let a=-1,o=0,h=-1,l=!0,u=i.length-1,c=0;for(;u>=r;--u){if(e=i.charCodeAt(u),e===47){if(!l){o=u+1;break}continue}h===-1&&(l=!1,h=u+1),e===46?a===-1?a=u:c!==1&&(c=1):a!==-1&&(c=-1)}return a===-1||h===-1||c===0||c===1&&a===h-1&&a===o+1?h!==-1&&(o===0&&s?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(o,h)):(o===0&&s?(t.name=i.slice(1,a),t.base=i.slice(1,h)):(t.name=i.slice(o,a),t.base=i.slice(o,h)),t.ext=i.slice(a,h)),t.dir=this.dirname(i),n&&(t.dir=n+t.dir),t},sep:"/",delimiter:":"};let Br;async function no(){return Br!=null||(Br=(async()=>{var i;const t=document.createElement("canvas").getContext("webgl");if(!t)return At.UNPACK;const e=await new Promise(a=>{const o=document.createElement("video");o.onloadeddata=()=>a(o),o.onerror=()=>a(null),o.autoplay=!1,o.crossOrigin="anonymous",o.preload="auto",o.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",o.load()});if(!e)return At.UNPACK;const s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(r),t.deleteTexture(s),(i=t.getExtension("WEBGL_lose_context"))==null||i.loseContext(),n[0]<=n[3]?At.PMA:At.UNPACK})()),Br}function Rc(){}function Ic(){}let Fr;function ao(){return typeof Fr=="undefined"&&(Fr=function(){var i;const t={stencil:!0,failIfMajorPerformanceCaveat:N.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!N.ADAPTER.getWebGLRenderingContext())return!1;const e=N.ADAPTER.createCanvas();let s=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const r=!!((i=s==null?void 0:s.getContextAttributes())!=null&&i.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,r}catch(e){return!1}}()),Fr}var Pc={grad:.9,turn:360,rad:360/(2*Math.PI)},le=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},yt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},Nt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},oo=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},ho=function(i){return{r:Nt(i.r,0,255),g:Nt(i.g,0,255),b:Nt(i.b,0,255),a:Nt(i.a)}},Nr=function(i){return{r:yt(i.r),g:yt(i.g),b:yt(i.b),a:yt(i.a,3)}},Mc=/^#([0-9a-f]{3,8})$/i,yi=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},lo=function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=Math.max(t,e,s),a=n-Math.min(t,e,s),o=a?n===t?(e-s)/a:n===e?2+(s-t)/a:4+(t-e)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:r}},uo=function(i){var t=i.h,e=i.s,s=i.v,r=i.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),a=s*(1-e),o=s*(1-(t-n)*e),h=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,o,a,a,h,s][l],g:255*[h,s,s,o,a,a][l],b:255*[a,a,h,s,s,o][l],a:r}},co=function(i){return{h:oo(i.h),s:Nt(i.s,0,100),l:Nt(i.l,0,100),a:Nt(i.a)}},fo=function(i){return{h:yt(i.h),s:yt(i.s),l:yt(i.l),a:yt(i.a,3)}},po=function(i){return uo((e=(t=i).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},_s=function(i){return{h:(t=lo(i)).h,s:(r=(200-(e=t.s))*(s=t.v)/100)>0&&r<200?e*s/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,s,r},Dc=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Oc=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Bc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Fc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Lr={string:[[function(i){var t=Mc.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?yt(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?yt(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=Bc.exec(i)||Fc.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:ho({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=Dc.exec(i)||Oc.exec(i);if(!t)return null;var e,s,r=co({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Pc[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return po(r)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=r===void 0?1:r;return le(t)&&le(e)&&le(s)?ho({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(i){var t=i.h,e=i.s,s=i.l,r=i.a,n=r===void 0?1:r;if(!le(t)||!le(e)||!le(s))return null;var a=co({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return po(a)},"hsl"],[function(i){var t=i.h,e=i.s,s=i.v,r=i.a,n=r===void 0?1:r;if(!le(t)||!le(e)||!le(s))return null;var a=function(o){return{h:oo(o.h),s:Nt(o.s,0,100),v:Nt(o.v,0,100),a:Nt(o.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return uo(a)},"hsv"]]},mo=function(i,t){for(var e=0;e=.5},i.prototype.toHex=function(){return t=Nr(this.rgba),e=t.r,s=t.g,r=t.b,a=(n=t.a)<1?yi(yt(255*n)):"","#"+yi(e)+yi(s)+yi(r)+a;var t,e,s,r,n,a},i.prototype.toRgb=function(){return Nr(this.rgba)},i.prototype.toRgbString=function(){return t=Nr(this.rgba),e=t.r,s=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+r+", "+n+")":"rgb("+e+", "+s+", "+r+")";var t,e,s,r,n},i.prototype.toHsl=function(){return fo(_s(this.rgba))},i.prototype.toHslString=function(){return t=fo(_s(this.rgba)),e=t.h,s=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+r+"%, "+n+")":"hsl("+e+", "+s+"%, "+r+"%)";var t,e,s,r,n},i.prototype.toHsv=function(){return t=lo(this.rgba),{h:yt(t.h),s:yt(t.s),v:yt(t.v),a:yt(t.a,3)};var t},i.prototype.invert=function(){return Jt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),Jt(Ur(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),Jt(Ur(this.rgba,-t))},i.prototype.grayscale=function(){return Jt(Ur(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),Jt(_o(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),Jt(_o(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?Jt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):yt(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=_s(this.rgba);return typeof t=="number"?Jt({h:t,s:e.s,l:e.l,a:e.a}):yt(e.h)},i.prototype.isEqual=function(t){return this.toHex()===Jt(t).toHex()},i}(),Jt=function(i){return i instanceof xi?i:new xi(i)},vo=[],Nc=function(i){i.forEach(function(t){vo.indexOf(t)<0&&(t(xi,Lr),vo.push(t))})},Rg=function(){return new xi({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};function Lc(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var r in e)s[e[r]]=r;var n={};i.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,h,l=s[this.toHex()];if(l)return l;if(a!=null&&a.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var f in e)n[f]=new i(e[f]).toRgb();for(var p in e){var m=(o=u,h=n[p],Math.pow(o.r-h.r,2)+Math.pow(o.g-h.g,2)+Math.pow(o.b-h.b,2));mt in i?Uc(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,$c=(i,t)=>{for(var e in t||(t={}))kc.call(t,e)&&xo(i,e,t[e]);if(yo)for(var e of yo(t))Gc.call(t,e)&&xo(i,e,t[e]);return i};Nc([Lc]);const Ze=class yr{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof yr)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?$c({},t):t}isSourceEqual(t,e){const s=typeof t;if(s!==typeof e)return!1;if(s==="number"||s==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((r,n)=>r===e[n]);if(t!==null&&e!==null){const r=Object.keys(t),n=Object.keys(e);return r.length!==n.length?!1:r.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,s,r]=this._components;return{r:t,g:e,b:s,a:r}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,r]=this._components;return t=t!=null?t:[],t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(r*255),t}toRgbArray(t){t=t!=null?t:[];const[e,s,r]=this._components;return t[0]=e,t[1]=s,t[2]=r,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,r,n]=yr.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=r,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let s=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(r<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,s,r]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(r*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t!=null?t:[];const[e,s,r,n]=this._components;return t[0]=e,t[1]=s,t[2]=r,t[3]=n,t}normalize(t){let e,s,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,s=(a>>8&255)/255,r=(a&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,r,n=255]=t,e/=255,s/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const o=yr.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const a=Jt(t);a.isValid()&&({r:e,g:s,b:r,a:n}=a.rgba,e/=255,s/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=r,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(t*255<<16)+(e*255<<8)+(s*255|0)}_clamp(t,e=0,s=1){return typeof t=="number"?Math.min(Math.max(t,e),s):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),s)}),t)}};Ze.shared=new Ze,Ze.temp=new Ze,Ze.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Y=Ze;function Hc(i,t=[]){return Y.shared.setValue(i).toRgbArray(t)}function bo(i){return Y.shared.setValue(i).toHex()}function Vc(i){return Y.shared.setValue(i).toNumber()}function To(i){return Y.shared.setValue(i).toNumber()}function jc(){const i=[],t=[];for(let s=0;s<32;s++)i[s]=s,t[s]=s;i[C.NORMAL_NPM]=C.NORMAL,i[C.ADD_NPM]=C.ADD,i[C.SCREEN_NPM]=C.SCREEN,t[C.NORMAL]=C.NORMAL_NPM,t[C.ADD]=C.ADD_NPM,t[C.SCREEN]=C.SCREEN_NPM;const e=[];return e.push(t),e.push(i),e}const Gr=jc();function $r(i,t){return Gr[t?1:0][i]}function Xc(i,t,e,s=!0){return Y.shared.setValue(i).premultiply(t,s).toArray(e!=null?e:new Float32Array(4))}function zc(i,t){return Y.shared.setValue(i).toPremultiplied(t)}function Wc(i,t,e,s=!0){return Y.shared.setValue(i).premultiply(t,s).toArray(e!=null?e:new Float32Array(4))}const Eo=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;function Ao(i,t=null){const e=i*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let s=0,r=0;s>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function Hr(i){return!(i&i-1)&&!!i}function Vr(i){let t=(i>65535?1:0)<<4;i>>>=t;let e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function Oe(i,t,e){const s=i.length;let r;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(r=t;rt in i?td(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Oo=(i,t)=>{for(var e in t||(t={}))id.call(t,e)&&Do(i,e,t[e]);if(Mo)for(var e of Mo(t))rd.call(t,e)&&Do(i,e,t[e]);return i},nd=(i,t)=>ed(i,sd(t)),D=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(D||{});const Wr=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){const t=typeof i.extension!="object"?{type:i.extension}:i.extension;i=nd(Oo({},t),{ref:i})}if(typeof i=="object")i=Oo({},i);else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},Bo=(i,t)=>{var e;return(e=Wr(i).priority)!=null?e:t},U={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Wr).forEach(t=>{t.type.forEach(e=>{var s,r;return(r=(s=this._removeHandlers)[e])==null?void 0:r.call(s,t)})}),this},add(...i){return i.map(Wr).forEach(t=>{t.type.forEach(e=>{const s=this._addHandlers,r=this._queue;s[e]?s[e](t):(r[e]=r[e]||[],r[e].push(t))})}),this},handle(i,t,e){const s=this._addHandlers,r=this._removeHandlers;s[i]=t,r[i]=e;const n=this._queue;return n[i]&&(n[i].forEach(a=>t(a)),delete n[i]),this},handleByMap(i,t){return this.handle(i,e=>{t[e.name]=e.ref},e=>{delete t[e.name]})},handleByList(i,t,e=-1){return this.handle(i,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((r,n)=>Bo(n,e)-Bo(r,e)))},s=>{const r=t.indexOf(s.ref);r!==-1&&t.splice(r,1)})}};class Ti{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const ad=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` +`);function od(i){let t="";for(let e=0;e0&&(t+=` +else `),e=0;--s){const r=Ei[s];if(r.test&&r.test(i,e))return new r(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class Pt{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,r,n,a,o,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(Pt.prototype,{dispatch:{value:Pt.prototype.emit},run:{value:Pt.prototype.emit}});class Qe{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new Pt("setRealSize"),this.onUpdate=new Pt("update"),this.onError=new Pt("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,s){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class xs extends Qe{constructor(t,e){var s;const{width:r,height:n}=e||{};if(!r||!n)throw new Error("BufferResource width or height invalid");super(r,n),this.data=t,this.unpackAlignment=(s=e.unpackAlignment)!=null?s:4}upload(t,e,s){const r=t.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===At.UNPACK);const n=e.realWidth,a=e.realHeight;return s.width===n&&s.height===a?r.texSubImage2D(e.target,0,0,0,n,a,e.format,s.type,this.data):(s.width=n,s.height=a,r.texImage2D(e.target,0,s.internalFormat,n,a,0,e.format,s.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}var hd=Object.defineProperty,No=Object.getOwnPropertySymbols,ld=Object.prototype.hasOwnProperty,ud=Object.prototype.propertyIsEnumerable,Lo=(i,t,e)=>t in i?hd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,cd=(i,t)=>{for(var e in t||(t={}))ld.call(t,e)&&Lo(i,e,t[e]);if(No)for(var e of No(t))ud.call(t,e)&&Lo(i,e,t[e]);return i};const dd={scaleMode:Bt.NEAREST,alphaMode:At.NPM},en=class ns extends Ye{constructor(t=null,e=null){super(),e=Object.assign({},ns.defaultOptions,e);const{alphaMode:s,mipmap:r,anisotropicLevel:n,scaleMode:a,width:o,height:h,wrapMode:l,format:u,type:c,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof Qe)&&(t=tn(t,p),t.internal=!0),this.resolution=f||N.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=r,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=u,this.type=c,this.target=d,this.alphaMode=s,this.uid=Te(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=o>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let s;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,s=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,s=!0),s&&this.dirtyStyleId++,this}setSize(t,e,s){return s=s||this.resolution,this.setRealSize(t*s,e*s,s)}setRealSize(t,e,s){return this.resolution=s||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Hr(this.realWidth)&&Hr(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete It[this.cacheId],delete wt[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),ns.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,s=N.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${Te()}`}n=t._pixiId}let a=It[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new ns(t,e),a.cacheId=n,ns.addToCache(a,n)),a}static fromBuffer(t,e,s,r){t=t||new Float32Array(e*s*4);const n=new xs(t,cd({width:e,height:s},r==null?void 0:r.resourceOptions));let a,o;return t instanceof Float32Array?(a=M.RGBA,o=$.FLOAT):t instanceof Int32Array?(a=M.RGBA_INTEGER,o=$.INT):t instanceof Uint32Array?(a=M.RGBA_INTEGER,o=$.UNSIGNED_INT):t instanceof Int16Array?(a=M.RGBA_INTEGER,o=$.SHORT):t instanceof Uint16Array?(a=M.RGBA_INTEGER,o=$.UNSIGNED_SHORT):t instanceof Int8Array?(a=M.RGBA,o=$.BYTE):(a=M.RGBA,o=$.UNSIGNED_BYTE),n.internal=!0,new ns(n,Object.assign({},dd,{type:o,format:a},r))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),It[e]&&It[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),It[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=It[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete It[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e1){for(let c=0;c(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(it||{});class K{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new K(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}}const wi=[new K,new K,new K,new K];class z{constructor(t=0,e=0,s=0,r=0){this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(r),this.type=it.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new z(0,0,0,0)}clone(){return new z(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t=this.y&&et.right?t.right:this.right)<=A)return!1;const S=this.yt.bottom?t.bottom:this.bottom)>S}const s=this.left,r=this.right,n=this.top,a=this.bottom;if(r<=s||a<=n)return!1;const o=wi[0].set(t.left,t.top),h=wi[1].set(t.left,t.bottom),l=wi[2].set(t.right,t.top),u=wi[3].set(t.right,t.bottom);if(l.x<=o.x||h.y<=o.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(o,o),e.apply(h,h),e.apply(l,l),e.apply(u,u),Math.max(o.x,h.x,l.x,u.x)<=s||Math.min(o.x,h.x,l.x,u.x)>=r||Math.max(o.y,h.y,l.y,u.y)<=n||Math.min(o.y,h.y,l.y,u.y)>=a))return!1;const d=c*(h.y-o.y),f=c*(o.x-h.x),p=d*s+f*n,m=d*r+f*n,g=d*s+f*a,_=d*r+f*a;if(Math.max(p,m,g,_)<=d*o.x+f*o.y||Math.min(p,m,g,_)>=d*u.x+f*u.y)return!1;const x=c*(o.y-l.y),v=c*(l.x-o.x),b=x*s+v*n,T=x*r+v*n,R=x*s+v*a,w=x*r+v*a;return!(Math.max(b,T,R,w)<=x*o.x+v*o.y||Math.min(b,T,R,w)>=x*u.x+v*u.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=s-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=r,this.height=n-r,this}}class Si{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=it.CIRC}clone(){return new Si(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=s}getBounds(){return new z(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}class Ci{constructor(t=0,e=0,s=0,r=0){this.x=t,this.y=e,this.width=s,this.height=r,this.type=it.ELIP}clone(){return new Ci(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let s=(t-this.x)/this.width,r=(e-this.y)/this.height;return s*=s,r*=r,s+r<=1}getBounds(){return new z(this.x-this.width,this.y-this.height,this.width,this.height)}}class Be{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let r=0,n=e.length;re!=u>e&&t<(l-o)*((e-h)/(u-h))+o&&(s=!s)}return s}}class Ri{constructor(t=0,e=0,s=0,r=0,n=20){this.x=t,this.y=e,this.width=s,this.height=r,this.radius=n,this.type=it.RREC}clone(){return new Ri(this.x,this.y,this.width,this.height,this.radius)}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let r=t-(this.x+s),n=e-(this.y+s);const a=s*s;if(r*r+n*n<=a||(r=t-(this.x+this.width-s),r*r+n*n<=a)||(n=e-(this.y+this.height-s),r*r+n*n<=a)||(r=t-(this.x+s),r*r+n*n<=a))return!0}return!1}}class tt{constructor(t=1,e=0,s=0,r=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=a}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,s,r,n,a){return this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=a,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new K;const s=t.x,r=t.y;return e.x=this.a*s+this.c*r+this.tx,e.y=this.b*s+this.d*r+this.ty,e}applyInverse(t,e){e=e||new K;const s=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return e.x=this.d*s*r+-this.c*s*n+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*n+-this.b*s*r+(-this.ty*this.a+this.tx*this.b)*s,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),r=this.a,n=this.c,a=this.tx;return this.a=r*e-this.b*s,this.b=r*s+this.b*e,this.c=n*e-this.d*s,this.d=n*s+this.d*e,this.tx=a*e-this.ty*s,this.ty=a*s+this.ty*e,this}append(t){const e=this.a,s=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}setTransform(t,e,s,r,n,a,o,h,l){return this.a=Math.cos(o+l)*n,this.b=Math.sin(o+l)*n,this.c=-Math.sin(o-h)*a,this.d=Math.cos(o-h)*a,this.tx=t-(s*this.a+r*this.c),this.ty=e-(s*this.b+r*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,r=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,r=this.c,n=this.d,a=t.pivot,o=-Math.atan2(-r,n),h=Math.atan2(s,e),l=Math.abs(o+h);return l<1e-5||Math.abs(Ts-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=h),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(a.x*e+a.y*r),t.position.y=this.ty+(a.x*s+a.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,r=this.d,n=this.tx,a=t*r-e*s;return this.a=r/a,this.b=-e/a,this.c=-s/a,this.d=t/a,this.tx=(s*this.ty-r*n)/a,this.ty=-(t*this.ty-e*n)/a,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new tt;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new tt}static get TEMP_MATRIX(){return new tt}}const Fe=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Ne=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Le=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Ue=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],rn=[],$o=[],Ii=Math.sign;function vd(){for(let i=0;i<16;i++){const t=[];rn.push(t);for(let e=0;e<16;e++){const s=Ii(Fe[i]*Fe[e]+Le[i]*Ne[e]),r=Ii(Ne[i]*Fe[e]+Ue[i]*Ne[e]),n=Ii(Fe[i]*Le[e]+Le[i]*Ue[e]),a=Ii(Ne[i]*Le[e]+Ue[i]*Ue[e]);for(let o=0;o<16;o++)if(Fe[o]===s&&Ne[o]===r&&Le[o]===n&&Ue[o]===a){t.push(o);break}}}for(let i=0;i<16;i++){const t=new tt;t.set(Fe[i],Ne[i],Le[i],Ue[i],0,0),$o.push(t)}}vd();const at={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>Fe[i],uY:i=>Ne[i],vX:i=>Le[i],vY:i=>Ue[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>rn[i][t],sub:(i,t)=>rn[i][at.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?at.S:at.N:Math.abs(t)*2<=Math.abs(i)?i>0?at.E:at.W:t>0?i>0?at.SE:at.SW:i>0?at.NE:at.NW,matrixAppendRotationInv:(i,t,e=0,s=0)=>{const r=$o[at.inv(t)];r.tx=e,r.ty=s,i.append(r)}};class de{constructor(t,e,s=0,r=0){this._x=s,this._y=r,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new de(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}}const nn=class{constructor(){this.worldTransform=new tt,this.localTransform=new tt,this.position=new de(this.onChange,this,0,0),this.scale=new de(this.onChange,this,1,1),this.pivot=new de(this.onChange,this,0,0),this.skew=new de(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(t){const e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){const s=t.worldTransform,r=this.worldTransform;r.a=e.a*s.a+e.b*s.c,r.b=e.a*s.b+e.b*s.d,r.c=e.c*s.a+e.d*s.c,r.d=e.c*s.b+e.d*s.d,r.tx=e.tx*s.a+e.ty*s.c+s.tx,r.ty=e.tx*s.b+e.ty*s.d+s.ty,this._parentID=t._worldID,this._worldID++}}setFromMatrix(t){t.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())}};nn.IDENTITY=new nn;let Pi=nn;var yd=`varying vec2 vTextureCoord; + +uniform sampler2D uSampler; + +void main(void){ + gl_FragColor *= texture2D(uSampler, vTextureCoord); +}`,xd=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void){ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +} +`;function Ho(i,t,e){const s=i.createShader(t);return i.shaderSource(s,e),i.compileShader(s),s}function an(i){const t=new Array(i);for(let e=0;ei.type==="float"&&i.size===1&&!i.isArray,code:i=>` + if(uv["${i}"] !== ud["${i}"].value) + { + ud["${i}"].value = uv["${i}"] + gl.uniform1f(ud["${i}"].location, uv["${i}"]) + } + `},{test:(i,t)=>(i.type==="sampler2D"||i.type==="samplerCube"||i.type==="sampler2DArray")&&i.size===1&&!i.isArray&&(t==null||t.castToBaseTexture!==void 0),code:i=>`t = syncData.textureCount++; + + renderer.texture.bind(uv["${i}"], t); + + if(ud["${i}"].value !== t) + { + ud["${i}"].value = t; + gl.uniform1i(ud["${i}"].location, t); +; // eslint-disable-line max-len + }`},{test:(i,t)=>i.type==="mat3"&&i.size===1&&!i.isArray&&t.a!==void 0,code:i=>` + gl.uniformMatrix3fv(ud["${i}"].location, false, uv["${i}"].toArray(true)); + `,codeUbo:i=>` + var ${i}_matrix = uv.${i}.toArray(true); + + data[offset] = ${i}_matrix[0]; + data[offset+1] = ${i}_matrix[1]; + data[offset+2] = ${i}_matrix[2]; + + data[offset + 4] = ${i}_matrix[3]; + data[offset + 5] = ${i}_matrix[4]; + data[offset + 6] = ${i}_matrix[5]; + + data[offset + 8] = ${i}_matrix[6]; + data[offset + 9] = ${i}_matrix[7]; + data[offset + 10] = ${i}_matrix[8]; + `},{test:(i,t)=>i.type==="vec2"&&i.size===1&&!i.isArray&&t.x!==void 0,code:i=>` + cv = ud["${i}"].value; + v = uv["${i}"]; + + if(cv[0] !== v.x || cv[1] !== v.y) + { + cv[0] = v.x; + cv[1] = v.y; + gl.uniform2f(ud["${i}"].location, v.x, v.y); + }`,codeUbo:i=>` + v = uv.${i}; + + data[offset] = v.x; + data[offset+1] = v.y; + `},{test:i=>i.type==="vec2"&&i.size===1&&!i.isArray,code:i=>` + cv = ud["${i}"].value; + v = uv["${i}"]; + + if(cv[0] !== v[0] || cv[1] !== v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2f(ud["${i}"].location, v[0], v[1]); + } + `},{test:(i,t)=>i.type==="vec4"&&i.size===1&&!i.isArray&&t.width!==void 0,code:i=>` + cv = ud["${i}"].value; + v = uv["${i}"]; + + if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) + { + cv[0] = v.x; + cv[1] = v.y; + cv[2] = v.width; + cv[3] = v.height; + gl.uniform4f(ud["${i}"].location, v.x, v.y, v.width, v.height) + }`,codeUbo:i=>` + v = uv.${i}; + + data[offset] = v.x; + data[offset+1] = v.y; + data[offset+2] = v.width; + data[offset+3] = v.height; + `},{test:(i,t)=>i.type==="vec4"&&i.size===1&&!i.isArray&&t.red!==void 0,code:i=>` + cv = ud["${i}"].value; + v = uv["${i}"]; + + if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) + { + cv[0] = v.red; + cv[1] = v.green; + cv[2] = v.blue; + cv[3] = v.alpha; + gl.uniform4f(ud["${i}"].location, v.red, v.green, v.blue, v.alpha) + }`,codeUbo:i=>` + v = uv.${i}; + + data[offset] = v.red; + data[offset+1] = v.green; + data[offset+2] = v.blue; + data[offset+3] = v.alpha; + `},{test:(i,t)=>i.type==="vec3"&&i.size===1&&!i.isArray&&t.red!==void 0,code:i=>` + cv = ud["${i}"].value; + v = uv["${i}"]; + + if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a) + { + cv[0] = v.red; + cv[1] = v.green; + cv[2] = v.blue; + + gl.uniform3f(ud["${i}"].location, v.red, v.green, v.blue) + }`,codeUbo:i=>` + v = uv.${i}; + + data[offset] = v.red; + data[offset+1] = v.green; + data[offset+2] = v.blue; + `},{test:i=>i.type==="vec4"&&i.size===1&&!i.isArray,code:i=>` + cv = ud["${i}"].value; + v = uv["${i}"]; + + if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4f(ud["${i}"].location, v[0], v[1], v[2], v[3]) + }`}],bd={float:` + if (cv !== v) + { + cu.value = v; + gl.uniform1f(location, v); + }`,vec2:` + if (cv[0] !== v[0] || cv[1] !== v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + + gl.uniform2f(location, v[0], v[1]) + }`,vec3:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + + gl.uniform3f(location, v[0], v[1], v[2]) + }`,vec4:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4f(location, v[0], v[1], v[2], v[3]); + }`,int:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1i(location, v); + }`,ivec2:` + if (cv[0] !== v[0] || cv[1] !== v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + + gl.uniform2i(location, v[0], v[1]); + }`,ivec3:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + + gl.uniform3i(location, v[0], v[1], v[2]); + }`,ivec4:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4i(location, v[0], v[1], v[2], v[3]); + }`,uint:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1ui(location, v); + }`,uvec2:` + if (cv[0] !== v[0] || cv[1] !== v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + + gl.uniform2ui(location, v[0], v[1]); + }`,uvec3:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + + gl.uniform3ui(location, v[0], v[1], v[2]); + }`,uvec4:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4ui(location, v[0], v[1], v[2], v[3]); + }`,bool:` + if (cv !== v) + { + cu.value = v; + gl.uniform1i(location, v); + }`,bvec2:` + if (cv[0] != v[0] || cv[1] != v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + + gl.uniform2i(location, v[0], v[1]); + }`,bvec3:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + + gl.uniform3i(location, v[0], v[1], v[2]); + }`,bvec4:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4i(location, v[0], v[1], v[2], v[3]); + }`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1i(location, v); + }`,samplerCube:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1i(location, v); + }`,sampler2DArray:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1i(location, v); + }`},Td={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Ed(i,t){var e;const s=[` + var v = null; + var cv = null; + var cu = null; + var t = 0; + var gl = renderer.gl; + `];for(const r in i.uniforms){const n=t[r];if(!n){((e=i.uniforms[r])==null?void 0:e.group)===!0&&(i.uniforms[r].ubo?s.push(` + renderer.shader.syncUniformBufferGroup(uv.${r}, '${r}'); + `):s.push(` + renderer.shader.syncUniformGroup(uv.${r}, syncData); + `));continue}const a=i.uniforms[r];let o=!1;for(let h=0;h=be.WEBGL2&&(t=i.getContext("webgl2",{})),t||(t=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),Es=t}return Es}let Mi;function Ad(){if(!Mi){Mi=Rt.MEDIUM;const i=Xo();i&&i.getShaderPrecisionFormat&&(Mi=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?Rt.HIGH:Rt.MEDIUM)}return Mi}function zo(i,t){const e=i.getShaderSource(t).split(` +`).map((l,u)=>`${u}: ${l}`),s=i.getShaderInfoLog(t),r=s.split(` +`),n={},a=r.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),o=[""];a.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=e.join(` +`);o[0]=h,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function wd(i,t,e,s){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||zo(i,e),i.getShaderParameter(s,i.COMPILE_STATUS)||zo(i,s),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}const Sd={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Wo(i){return Sd[i]}let Di=null;const Yo={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function qo(i,t){if(!Di){const e=Object.keys(Yo);Di={};for(let s=0;s0&&(e+=` +else `),sthis.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,s=Kt._textureArrayPool,r=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count;let o=++X._globalBatch,h=0,l=s[0],u=0;r.copyBoundTextures(n,e);for(let c=0;c=e&&(r.boundArray(l,n,o,e),this.buildDrawCalls(l,u,c),u=c,l=s[++h],++o),d._batchEnabled=o,d.touched=a,l.elements[l.count++]=d)}l.count>0&&(r.boundArray(l,n,o,e),this.buildDrawCalls(l,u,this._bufferSize),++h,++o);for(let c=0;c0);for(let m=0;m=0;--r)t[r]=s[r]||null,t[r]&&(t[r]._batchLocation=r)}boundArray(t,e,s,r){const{elements:n,ids:a,count:o}=t;let h=0;for(let l=0;l=0&&c=be.WEBGL2&&(s=t.getContext("webgl2",e)),s)this.webGLVersion=2;else if(this.webGLVersion=1,s=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!s)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=s,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),s="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;s&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const r=s||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=r,r||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}Rs.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Rs.extension={type:D.RendererSystem,name:"context"},U.add(Rs);class Fi{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new Pt("disposeFramebuffer"),this.multisample=ft.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new X(null,{scaleMode:Bt.NEAREST,resolution:1,mipmap:Ht.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new X(null,{scaleMode:Bt.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ht.OFF,format:M.DEPTH_COMPONENT,type:$.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let s=0;s{const r=this.source;this.url=r.src;const n=()=>{this.destroyed||(r.onload=null,r.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};r.complete&&r.src?n():(r.onload=n,r.onerror=a=>{s(a),this.onError.emit(a)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,s=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:s?"cors":"no-cors"}).then(r=>r.blob()).then(r=>e(r,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===At.UNPACK?"premultiply":"none"})).then(r=>this.destroyed?Promise.reject():(this.bitmap=r,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,s){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,s);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,s,this.bitmap),!this.preserveBitmap){let r=!0;const n=e._glTextures;for(const a in n){const o=n[a];if(o!==s&&o.dirtyId!==e.dirtyId){r=!1;break}}r&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement!="undefined"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class cn{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,s){const r=e.width,n=e.height;if(s){const a=t.width/2/r,o=t.height/2/n,h=t.x/r+a,l=t.y/n+o;s=at.add(s,at.NW),this.x0=h+a*at.uX(s),this.y0=l+o*at.uY(s),s=at.add(s,2),this.x1=h+a*at.uX(s),this.y1=l+o*at.uY(s),s=at.add(s,2),this.x2=h+a*at.uX(s),this.y2=l+o*at.uY(s),s=at.add(s,2),this.x3=h+a*at.uX(s),this.y3=l+o*at.uY(s)}else this.x0=t.x/r,this.y0=t.y/n,this.x1=(t.x+t.width)/r,this.y1=t.y/n,this.x2=(t.x+t.width)/r,this.y2=(t.y+t.height)/n,this.x3=t.x/r,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}const th=new cn;function Li(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}class L extends Ye{constructor(t,e,s,r,n,a,o){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new z(0,0,1,1)),t instanceof L&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=r,this.valid=!1,this.destroyed=!1,this._uvs=th,this.uvMatrix=null,this.orig=s||e,this._rotate=Number(n||0),n===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=a?new K(a.x,a.y):new K(0,0),this.defaultBorders=o,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:e}=this.baseTexture;e!=null&&e.url&&wt[e.url]&&L.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,L.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var t;const e=this._frame.clone(),s=this._frame===this.orig?e:this.orig.clone(),r=new L(this.baseTexture,!this.noFrame&&e,s,(t=this.trim)==null?void 0:t.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=e),r}updateUvs(){this._uvs===th&&(this._uvs=new cn),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=N.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else if(t instanceof X){if(!t.cacheId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${o}-${Te()}`,X.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${Te()}`}n=t._pixiId}let a=wt[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(t instanceof X)?(e.resolution||(e.resolution=te(t)),a=new L(new X(t,e)),a.baseTexture.cacheId=n,X.addToCache(a.baseTexture,n),L.addToCache(a,n)):!a&&t instanceof X&&(a=new L(t),L.addToCache(a,n)),a}static fromURL(t,e){const s=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),r=L.from(t,Object.assign({resourceOptions:s},e),!1),n=r.baseTexture.resource;return r.baseTexture.valid?Promise.resolve(r):n.load().then(()=>Promise.resolve(r))}static fromBuffer(t,e,s,r){return new L(X.fromBuffer(t,e,s,r))}static fromLoader(t,e,s,r){const n=new X(t,Object.assign({scaleMode:X.defaultOptions.scaleMode,resolution:te(e)},r)),{resource:a}=n;a instanceof un&&(a.url=e);const o=new L(n);return s||(s=e),X.addToCache(o.baseTexture,s),L.addToCache(o,s),s!==e&&(X.addToCache(o.baseTexture,e),L.addToCache(o,e)),o.baseTexture.valid?Promise.resolve(o):new Promise(h=>{o.baseTexture.once("loaded",()=>h(o))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),wt[e]&&wt[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),wt[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=wt[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete wt[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;ethis.baseTexture.width,o=s+n>this.baseTexture.height;if(a||o){const h=a&&o?"and":"or",l=`X: ${e} + ${r} = ${e+r} > ${this.baseTexture.width}`,u=`Y: ${s} + ${n} = ${s+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${u}`)}this.valid=r&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return L._EMPTY||(L._EMPTY=new L(new X),Li(L._EMPTY),Li(L._EMPTY.baseTexture)),L._EMPTY}static get WHITE(){if(!L._WHITE){const t=N.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),L._WHITE=new L(X.from(t)),Li(L._WHITE),Li(L._WHITE.baseTexture)}return L._WHITE}}class Yt extends L{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,s=!0){const r=this.baseTexture.resolution,n=Math.round(t*r)/r,a=Math.round(e*r)/r;this.valid=n>0&&a>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=a,s&&this.baseTexture.resize(n,a),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new Yt(new Ni(t))}}class dn{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=ft.NONE){const r=new Ni(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new Yt(r)}getOptimalTexture(t,e,s=1,r=ft.NONE){let n;t=Math.max(Math.ceil(t*s-1e-6),1),e=Math.max(Math.ceil(e*s-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=vs(t),e=vs(e),n=((t&65535)<<16|e&65535)>>>0,r>1&&(n+=r*4294967296)):n=r>1?-r:-1,this.texturePool[n]||(this.texturePool[n]=[]);let a=this.texturePool[n].pop();return a||(a=this.createTexture(t,e,r)),a.filterPoolKey=n,a.setResolution(s),a}getFilterTexture(t,e,s){const r=this.getOptimalTexture(t.width,t.height,e||t.resolution,s||ft.NONE);return r.filterFrame=t.filterFrame,r}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const s=this.texturePool[e];if(s)for(let r=0;r0&&t.height>0;for(const e in this.texturePool){if(!(Number(e)<0))continue;const s=this.texturePool[e];if(s)for(let r=0;r1&&(u=this.getOptimalFilterTexture(l.width,l.height,e.resolution),u.filterFrame=l.filterFrame),s[c].apply(this,l,u,Vt.CLEAR,e);const d=l;l=u,u=d}s[c].apply(this,l,h.renderTexture,Vt.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(u)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=Vt.CLEAR){const{renderTexture:s,state:r}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t!=null&&t.filterFrame){const a=this.tempRect;a.x=0,a.y=0,a.width=t.filterFrame.width,a.height=t.filterFrame.height,s.bind(t,t.filterFrame,a)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?s.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=r.stateId&1||this.forceClear;(e===Vt.CLEAR||e===Vt.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,s,r){const n=this.renderer;n.state.set(t.state),this.bindAndClear(s,r),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(Ot.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(Ot.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:s,destinationFrame:r}=this.activeState,{orig:n}=e._texture,a=t.set(r.width,0,0,r.height,s.x,s.y),o=e.worldTransform.copyTo(tt.TEMP_MATRIX);return o.invert(),a.prepend(o),a.scale(1/n.width,1/n.height),a.translate(e.anchor.x,e.anchor.y),a}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,s=1,r=ft.NONE){return this.texturePool.getOptimalTexture(t,e,s,r)}getFilterTexture(t,e,s){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const r=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,s||ft.NONE);return r.filterFrame=t.filterFrame,r}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const s=Ui[0],r=Ui[1],n=Ui[2],a=Ui[3];s.set(e.left,e.top),r.set(e.left,e.bottom),n.set(e.right,e.top),a.set(e.right,e.bottom),t.apply(s,s),t.apply(r,r),t.apply(n,n),t.apply(a,a);const o=Math.min(s.x,r.x,n.x,a.x),h=Math.min(s.y,r.y,n.y,a.y),l=Math.max(s.x,r.x,n.x,a.x),u=Math.max(s.y,r.y,n.y,a.y);e.x=o,e.y=h,e.width=l-o,e.height=u-h}roundFrame(t,e,s,r,n){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(n){const{a,b:o,c:h,d:l}=n;if((Math.abs(o)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(l)>1e-4))return}n=n?pn.copyFrom(n):pn.identity(),n.translate(-s.x,-s.y).scale(r.width/s.width,r.height/s.height).translate(r.x,r.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}mn.extension={type:D.RendererSystem,name:"filter"},U.add(mn);class ih{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ft.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const Fd=new z;class gn{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Fi(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new z,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;N.PREFER_ENV===be.WEBGL_LEGACY&&(e=null,s=null),e?t.drawBuffers=r=>e.drawBuffersWEBGL(r):(this.hasMRT=!1,t.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,s=0){const{gl:r}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==s&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=s),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,s)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let a=0;a>s,o=e.height>>s,h=a/e.width;this.setViewport(e.x*h,e.y*h,a,o)}else{const a=t.width>>s,o=t.height>>s;this.setViewport(0,0,a,o)}}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,s,r){const n=this.viewport;t=Math.round(t),e=Math.round(e),s=Math.round(s),r=Math.round(r),(n.width!==s||n.height!==r||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=s,n.height=r,this.gl.viewport(t,e,s,r))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,s,r,n=ui.COLOR|ui.DEPTH){const{gl:a}=this;a.clearColor(t,e,s,r),a.clear(n)}initFramebuffer(t){const{gl:e}=this,s=new ih(e.createFramebuffer());return s.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=s,this.managedFramebuffers.push(t),t.disposeRunner.add(this),s}resizeFramebuffer(t){const{gl:e}=this,s=t.glFramebuffers[this.CONTEXT_UID];if(s.stencil){e.bindRenderbuffer(e.RENDERBUFFER,s.stencil);let a;this.renderer.context.webGLVersion===1?a=e.DEPTH_STENCIL:t.depth&&t.stencil?a=e.DEPTH24_STENCIL8:t.depth?a=e.DEPTH_COMPONENT24:a=e.STENCIL_INDEX8,s.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,a,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,a,t.width,t.height)}const r=t.colorTextures;let n=r.length;e.drawBuffers||(n=Math.min(n,1));for(let a=0;a1&&this.canMultisampleFramebuffer(t)?r.msaaBuffer=r.msaaBuffer||s.createRenderbuffer():r.msaaBuffer&&(s.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&(r.blitFramebuffer.dispose(),r.blitFramebuffer=null));const o=[];for(let h=0;h1&&s.drawBuffers(o),t.depthTexture&&this.writeDepthTexture){const h=t.depthTexture;this.renderer.texture.bind(h,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){r.stencil=r.stencil||s.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH_STENCIL):t.depth&&t.stencil?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH24_STENCIL8):t.depth?(h=s.DEPTH_ATTACHMENT,l=s.DEPTH_COMPONENT24):(h=s.STENCIL_ATTACHMENT,l=s.STENCIL_INDEX8),s.bindRenderbuffer(s.RENDERBUFFER,r.stencil),r.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,r.multisample,l,t.width,t.height):s.renderbufferStorage(s.RENDERBUFFER,l,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,h,s.RENDERBUFFER,r.stencil)}else r.stencil&&(s.deleteRenderbuffer(r.stencil),r.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let s=ft.NONE;if(t<=1||e===null)return s;for(let r=0;r=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(r.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&r.deleteRenderbuffer(s.msaaBuffer),s.stencil&&r.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&this.disposeFramebuffer(s.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;ss.createVertexArrayOES(),t.bindVertexArray=r=>s.bindVertexArrayOES(r),t.deleteVertexArray=r=>s.deleteVertexArrayOES(r)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const s=t.getExtension("ANGLE_instanced_arrays");s?(t.vertexAttribDivisor=(r,n)=>s.vertexAttribDivisorANGLE(r,n),t.drawElementsInstanced=(r,n,a,o,h)=>s.drawElementsInstancedANGLE(r,n,a,o,h),t.drawArraysInstanced=(r,n,a,o)=>s.drawArraysInstancedANGLE(r,n,a,o)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:s}=this;let r=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;r||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=r={},n=!0);const a=r[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==a&&(this._activeVao=a,this.hasVao?s.bindVertexArray(a):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let s=0;s0?this.maskStack[this.maskStack.length-1]._colorMask:15;s!==e&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}destroy(){this.renderer=null}}yn.extension={type:D.RendererSystem,name:"mask"},U.add(yn);class oh{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,s=this.getStackLength();this.maskStack=t;const r=this.getStackLength();r!==s&&(r===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const hh=new tt,lh=[],uh=class xr extends oh{constructor(t){super(t),this.glConst=N.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){var e;if(t._scissorRectLocal)return;const s=t._scissorRect,{maskObject:r}=t,{renderer:n}=this,a=n.renderTexture,o=r.getBounds(!0,(e=lh.pop())!=null?e:new z);this.roundFrameToPixels(o,a.current?a.current.resolution:n.resolution,a.sourceFrame,a.destinationFrame,n.projection.transform),s&&o.fit(s),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:s,c:r,d:n}=t;return(Math.abs(s)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||xr.isMatrixRotated(e.worldTransform)||xr.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const s=t._scissorRectLocal;return s.width>0&&s.height>0}roundFrameToPixels(t,e,s,r,n){xr.isMatrixRotated(n)||(n=n?hh.copyFrom(n):hh.identity(),n.translate(-s.x,-s.y).scale(r.width/s.width,r.height/s.height).translate(r.x,r.y),this.renderer.filter.transformAABB(n,t),t.fit(r),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&lh.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};uh.extension={type:D.RendererSystem,name:"scissor"};let ch=uh;U.add(ch);class xn extends oh{constructor(t){super(t),this.glConst=N.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:s}=this.renderer,r=t._stencilCounter;r===0&&(this.renderer.framebuffer.forceStencil(),s.clearStencil(0),s.clear(s.STENCIL_BUFFER_BIT),s.enable(s.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,s.colorMask(!1,!1,!1,!1)),s.stencilFunc(s.EQUAL,r,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,s.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,r=s?s._colorMask:15;r!==0&&(s._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,r!==0&&(s._colorMask=r,e.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}xn.extension={type:D.RendererSystem,name:"stencil"},U.add(xn);class bn{constructor(t){this.renderer=t,this.plugins={}}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}bn.extension={type:[D.RendererSystem,D.CanvasRendererSystem],name:"_plugin"},U.add(bn);class Tn{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new tt,this.transform=null}update(t,e,s,r){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,r),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,s,r){const n=this.projectionMatrix,a=r?-1:1;n.identity(),n.a=1/e.width*2,n.d=a*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-a-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}Tn.extension={type:D.RendererSystem,name:"projection"},U.add(Tn);var dh=Object.getOwnPropertySymbols,Ud=Object.prototype.hasOwnProperty,kd=Object.prototype.propertyIsEnumerable,Gd=(i,t)=>{var e={};for(var s in i)Ud.call(i,s)&&t.indexOf(s)<0&&(e[s]=i[s]);if(i!=null&&dh)for(var s of dh(i))t.indexOf(s)<0&&kd.call(i,s)&&(e[s]=i[s]);return e};const $d=new Pi,fh=new z;class En{constructor(t){this.renderer=t,this._tempMatrix=new tt}generateTexture(t,e){var s;const r=e||{},{region:n}=r,a=Gd(r,["region"]),o=(n==null?void 0:n.copyTo(fh))||t.getLocalBounds(fh,!0),h=a.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/h),o.height=Math.max(o.height,1/h),a.width=o.width,a.height=o.height,a.resolution=h,(s=a.multisample)!=null||(a.multisample=this.renderer.multisample);const l=Yt.create(a);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;const u=t.transform;return t.transform=$d,this.renderer.render(t,{renderTexture:l,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=u,l}destroy(){}}En.extension={type:[D.RendererSystem,D.CanvasRendererSystem],name:"textureGenerator"},U.add(En);const Ge=new z,Is=new z;class An{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new z,this.destinationFrame=new z,this.viewportFrame=new z}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(t=null,e,s){const r=this.renderer;this.current=t;let n,a,o;t?(n=t.baseTexture,o=n.resolution,e||(Ge.width=t.frame.width,Ge.height=t.frame.height,e=Ge),s||(Is.x=t.frame.x,Is.y=t.frame.y,Is.width=e.width,Is.height=e.height,s=Is),a=n.framebuffer):(o=r.resolution,e||(Ge.width=r._view.screen.width,Ge.height=r._view.screen.height,e=Ge),s||(s=Ge,s.width=e.width,s.height=e.height));const h=this.viewportFrame;h.x=s.x*o,h.y=s.y*o,h.width=s.width*o,h.height=s.height*o,t||(h.y=r.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(a,h),this.renderer.projection.update(s,e,o,!a),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(s)}clear(t,e){const s=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,r=Y.shared.setValue(t||s);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&r.premultiply(r.alpha);const n=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,o=n.width!==a.width||n.height!==a.height;if(o){let{x:h,y:l,width:u,height:c}=this.viewportFrame;h=Math.round(h),l=Math.round(l),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,u,c)}this.renderer.framebuffer.clear(r.red,r.green,r.blue,r.alpha,e),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}An.extension={type:D.RendererSystem,name:"renderTexture"},U.add(An);class Hd{}class ph{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function Vd(i,t){const e={},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let r=0;rl>u?1:-1);for(let l=0;l({data:n,offset:0,dataLen:0,dirty:0}));let e=0,s=0,r=0;for(let n=0;n1&&(e=Math.max(e,16)*a.data.size),a.dataLen=e,s%e!==0&&s<16){const o=s%e%16;s+=o,r+=o}s+e>16?(r=Math.ceil(r/16)*16,a.offset=r,r+=e,s=e):(a.offset=r,s+=e,r+=e)}return r=Math.ceil(r/16)*16,{uboElements:t,size:r}}function vh(i,t){const e=[];for(const s in i)t[s]&&e.push(t[s]);return e.sort((s,r)=>s.index-r.index),e}function yh(i,t){if(!i.autoManage)return{size:0,syncFunc:Xd};const e=vh(i.uniforms,t),{uboElements:s,size:r}=_h(e),n=[` + var v = null; + var v2 = null; + var cv = null; + var t = 0; + var gl = renderer.gl + var index = 0; + var data = buffer.data; + `];for(let a=0;a1){const c=Wo(o.data.type),d=Math.max(gh[o.data.type]/16,1),f=c/d,p=(4-f%4)%4;n.push(` + cv = ud.${l}.value; + v = uv.${l}; + offset = ${o.offset/4}; + + t = 0; + + for(var i=0; i < ${o.data.size*d}; i++) + { + for(var j = 0; j < ${f}; j++) + { + data[offset++] = v[t++]; + } + offset += ${p}; + } + + `)}else{const c=zd[o.data.type];n.push(` + cv = ud.${l}.value; + v = uv.${l}; + offset = ${o.offset/4}; + ${c}; + `)}}return n.push(` + renderer.buffer.update(buffer); + `),{size:r,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(` +`))}}let Wd=0;const Gi={textureCount:0,uboCount:0};class wn{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Wd++}systemCheck(){if(!Zo())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const s=t.program,r=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==s&&(this.program=s,this.gl.useProgram(r.program)),e||(Gi.textureCount=0,Gi.uboCount=0,this.syncUniformGroup(t.uniformGroup,Gi)),r}setUniforms(t){const e=this.shader.program,s=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(s.uniformData,t,this.renderer)}syncUniformGroup(t,e){const s=this.getGlProgram();(!t.static||t.dirtyId!==s.uniformDirtyGroups[t.id])&&(s.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,s,e))}syncUniforms(t,e,s){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,s)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Ed(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const s=this.getGlProgram();if(!t.static||t.dirtyId!==0||!s.uniformGroups[t.id]){t.dirtyId=0;const r=s.uniformGroups[t.id]||this.createSyncBufferGroup(t,s,e);t.buffer.update(),r(s.uniformData,t.uniforms,this.renderer,Gi,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,s.uniformBufferBindings[e])}createSyncBufferGroup(t,e,s){const{gl:r}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,s);e.uniformBufferBindings[s]=this.shader.uniformBindCount,r.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(t,this.shader.program.uniformData,"ubo");let o=this._uboCache[a];if(o||(o=this._uboCache[a]=yh(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(o.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,s){const r=t.uniforms,n=[`${s}-`];for(const a in r)n.push(a),e[a]&&n.push(e[a].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,s=t.program,r=mh(e,s);return s.glPrograms[this.renderer.CONTEXT_UID]=r,r}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}wn.extension={type:D.RendererSystem,name:"shader"},U.add(wn);class Ps{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.3.0 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}Ps.defaultOptions={hello:!1},Ps.extension={type:[D.RendererSystem,D.CanvasRendererSystem],name:"startup"},U.add(Ps);function Yd(i,t=[]){return t[C.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.ADD]=[i.ONE,i.ONE],t[C.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.NONE]=[0,0],t[C.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[C.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[C.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[C.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[C.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[C.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[C.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[C.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[C.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[C.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[C.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}const qd=0,Kd=1,Zd=2,Qd=3,Jd=4,tf=5,xh=class Ta{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=C.NONE,this._blendEq=!1,this.map=[],this.map[qd]=this.setBlend,this.map[Kd]=this.setOffset,this.map[Zd]=this.setCullFace,this.map[Qd]=this.setDepthTest,this.map[Jd]=this.setFrontFace,this.map[tf]=this.setDepthMask,this.checks=[],this.defaultState=new ee,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Yd(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,s=0;for(;e;)e&1&&this.map[s].call(this,!!(t.data&1<>1,s++;this.stateId=t.data}for(let e=0;et.systems[n]),r=[...s,...Object.keys(t.systems).filter(n=>!s.includes(n))];for(const n of r)this.addSystem(t.systems[n],n)}addRunners(...t){t.forEach(e=>{this.runners[e]=new Pt(e)})}addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const r in this.runners)this.runners[r].add(s);return this}emitWithCustomOptions(t,e){const s=Object.keys(this._systemsHash);t.items.forEach(r=>{const n=s.find(a=>this._systemsHash[a]===r);r[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const Ms=class br{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=br.defaultMaxIdle,this.checkCountMax=br.defaultCheckCountMax,this.mode=br.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==ci.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let s=!1;for(let r=0;rthis.maxIdle&&(t.destroyTexture(n,!0),e[r]=null,s=!0)}if(s){let r=0;for(let n=0;n=0;r--)this.unload(t.children[r])}destroy(){this.renderer=null}};Ms.defaultMode=ci.AUTO,Ms.defaultMaxIdle=3600,Ms.defaultCheckCountMax=600,Ms.extension={type:D.RendererSystem,name:"textureGC"};let Ae=Ms;U.add(Ae);class $i{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=$.UNSIGNED_BYTE,this.internalFormat=M.RGBA,this.samplerType=0}}function ef(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:k.FLOAT,[i.RGBA]:k.FLOAT,[i.ALPHA]:k.FLOAT,[i.LUMINANCE]:k.FLOAT,[i.LUMINANCE_ALPHA]:k.FLOAT,[i.R8]:k.FLOAT,[i.R8_SNORM]:k.FLOAT,[i.RG8]:k.FLOAT,[i.RG8_SNORM]:k.FLOAT,[i.RGB8]:k.FLOAT,[i.RGB8_SNORM]:k.FLOAT,[i.RGB565]:k.FLOAT,[i.RGBA4]:k.FLOAT,[i.RGB5_A1]:k.FLOAT,[i.RGBA8]:k.FLOAT,[i.RGBA8_SNORM]:k.FLOAT,[i.RGB10_A2]:k.FLOAT,[i.RGB10_A2UI]:k.FLOAT,[i.SRGB8]:k.FLOAT,[i.SRGB8_ALPHA8]:k.FLOAT,[i.R16F]:k.FLOAT,[i.RG16F]:k.FLOAT,[i.RGB16F]:k.FLOAT,[i.RGBA16F]:k.FLOAT,[i.R32F]:k.FLOAT,[i.RG32F]:k.FLOAT,[i.RGB32F]:k.FLOAT,[i.RGBA32F]:k.FLOAT,[i.R11F_G11F_B10F]:k.FLOAT,[i.RGB9_E5]:k.FLOAT,[i.R8I]:k.INT,[i.R8UI]:k.UINT,[i.R16I]:k.INT,[i.R16UI]:k.UINT,[i.R32I]:k.INT,[i.R32UI]:k.UINT,[i.RG8I]:k.INT,[i.RG8UI]:k.UINT,[i.RG16I]:k.INT,[i.RG16UI]:k.UINT,[i.RG32I]:k.INT,[i.RG32UI]:k.UINT,[i.RGB8I]:k.INT,[i.RGB8UI]:k.UINT,[i.RGB16I]:k.INT,[i.RGB16UI]:k.UINT,[i.RGB32I]:k.INT,[i.RGB32UI]:k.UINT,[i.RGBA8I]:k.INT,[i.RGBA8UI]:k.UINT,[i.RGBA16I]:k.INT,[i.RGBA16UI]:k.UINT,[i.RGBA32I]:k.INT,[i.RGBA32UI]:k.UINT,[i.DEPTH_COMPONENT16]:k.FLOAT,[i.DEPTH_COMPONENT24]:k.FLOAT,[i.DEPTH_COMPONENT32F]:k.FLOAT,[i.DEPTH_STENCIL]:k.FLOAT,[i.DEPTH24_STENCIL8]:k.FLOAT,[i.DEPTH32F_STENCIL8]:k.FLOAT}:t={[i.RGB]:k.FLOAT,[i.RGBA]:k.FLOAT,[i.ALPHA]:k.FLOAT,[i.LUMINANCE]:k.FLOAT,[i.LUMINANCE_ALPHA]:k.FLOAT,[i.DEPTH_STENCIL]:k.FLOAT},t}function sf(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[$.UNSIGNED_BYTE]:{[M.RGBA]:i.RGBA8,[M.RGB]:i.RGB8,[M.RG]:i.RG8,[M.RED]:i.R8,[M.RGBA_INTEGER]:i.RGBA8UI,[M.RGB_INTEGER]:i.RGB8UI,[M.RG_INTEGER]:i.RG8UI,[M.RED_INTEGER]:i.R8UI,[M.ALPHA]:i.ALPHA,[M.LUMINANCE]:i.LUMINANCE,[M.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[$.BYTE]:{[M.RGBA]:i.RGBA8_SNORM,[M.RGB]:i.RGB8_SNORM,[M.RG]:i.RG8_SNORM,[M.RED]:i.R8_SNORM,[M.RGBA_INTEGER]:i.RGBA8I,[M.RGB_INTEGER]:i.RGB8I,[M.RG_INTEGER]:i.RG8I,[M.RED_INTEGER]:i.R8I},[$.UNSIGNED_SHORT]:{[M.RGBA_INTEGER]:i.RGBA16UI,[M.RGB_INTEGER]:i.RGB16UI,[M.RG_INTEGER]:i.RG16UI,[M.RED_INTEGER]:i.R16UI,[M.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[$.SHORT]:{[M.RGBA_INTEGER]:i.RGBA16I,[M.RGB_INTEGER]:i.RGB16I,[M.RG_INTEGER]:i.RG16I,[M.RED_INTEGER]:i.R16I},[$.UNSIGNED_INT]:{[M.RGBA_INTEGER]:i.RGBA32UI,[M.RGB_INTEGER]:i.RGB32UI,[M.RG_INTEGER]:i.RG32UI,[M.RED_INTEGER]:i.R32UI,[M.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[$.INT]:{[M.RGBA_INTEGER]:i.RGBA32I,[M.RGB_INTEGER]:i.RGB32I,[M.RG_INTEGER]:i.RG32I,[M.RED_INTEGER]:i.R32I},[$.FLOAT]:{[M.RGBA]:i.RGBA32F,[M.RGB]:i.RGB32F,[M.RG]:i.RG32F,[M.RED]:i.R32F,[M.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[$.HALF_FLOAT]:{[M.RGBA]:i.RGBA16F,[M.RGB]:i.RGB16F,[M.RG]:i.RG16F,[M.RED]:i.R16F},[$.UNSIGNED_SHORT_5_6_5]:{[M.RGB]:i.RGB565},[$.UNSIGNED_SHORT_4_4_4_4]:{[M.RGBA]:i.RGBA4},[$.UNSIGNED_SHORT_5_5_5_1]:{[M.RGBA]:i.RGB5_A1},[$.UNSIGNED_INT_2_10_10_10_REV]:{[M.RGBA]:i.RGB10_A2,[M.RGBA_INTEGER]:i.RGB10_A2UI},[$.UNSIGNED_INT_10F_11F_11F_REV]:{[M.RGB]:i.R11F_G11F_B10F},[$.UNSIGNED_INT_5_9_9_9_REV]:{[M.RGB]:i.RGB9_E5},[$.UNSIGNED_INT_24_8]:{[M.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[$.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[M.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[$.UNSIGNED_BYTE]:{[M.RGBA]:i.RGBA,[M.RGB]:i.RGB,[M.ALPHA]:i.ALPHA,[M.LUMINANCE]:i.LUMINANCE,[M.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[$.UNSIGNED_SHORT_5_6_5]:{[M.RGB]:i.RGB},[$.UNSIGNED_SHORT_4_4_4_4]:{[M.RGBA]:i.RGBA},[$.UNSIGNED_SHORT_5_5_5_1]:{[M.RGBA]:i.RGBA}},t}class Cn{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new X,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=sf(t),this.samplerTypes=ef(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let r=0;r=0;--n){const a=e[n];a&&a._glTextures[r].samplerType!==k.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(t){const e=new $i(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){var s,r,n;e.internalFormat=(r=(s=this.internalFormats[t.type])==null?void 0:s[t.format])!=null?r:t.format,e.samplerType=(n=this.samplerTypes[e.internalFormat])!=null?n:k.FLOAT,this.webGLVersion===2&&t.type===$.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var e;const s=t._glTextures[this.CONTEXT_UID];if(!s)return;const r=this.renderer;if(this.initTextureType(t,s),(e=t.resource)!=null&&e.upload(r,t,s))s.samplerType!==k.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,a=t.realHeight,o=r.gl;(s.width!==n||s.height!==a||s.dirtyId<0)&&(s.width=n,s.height=a,o.texImage2D(t.target,0,s.internalFormat,n,a,0,t.format,s.type,null))}t.dirtyStyleId!==s.dirtyStyleId&&this.updateTextureStyle(t),s.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:s}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),s.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const r=this.managedTextures.indexOf(t);r!==-1&&Oe(this.managedTextures,r,1)}}updateTextureStyle(t){var e;const s=t._glTextures[this.CONTEXT_UID];s&&((t.mipmap===Ht.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?s.mipmap=!1:s.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?s.wrapMode=Zt.CLAMP:s.wrapMode=t.wrapMode,(e=t.resource)!=null&&e.style(this.renderer,t,s)||this.setStyle(t,s),s.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const s=this.gl;if(e.mipmap&&t.mipmap!==Ht.ON_MANUAL&&s.generateMipmap(t.target),s.texParameteri(t.target,s.TEXTURE_WRAP_S,e.wrapMode),s.texParameteri(t.target,s.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===Bt.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===Bt.LINEAR){const n=Math.min(t.anisotropicLevel,s.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===Bt.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(t.target,s.TEXTURE_MAG_FILTER,t.scaleMode===Bt.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}Cn.extension={type:D.RendererSystem,name:"texture"},U.add(Cn);class Rn{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glTransformFeedbacks[s]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,r)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:s,renderer:r}=this;e&&r.shader.bind(e),s.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:s,CONTEXT_UID:r}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[r]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let a=0;at in i?rf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Hi=(i,t)=>{for(var e in t||(t={}))nf.call(t,e)&&Eh(i,e,t[e]);if(Th)for(var e of Th(t))af.call(t,e)&&Eh(i,e,t[e]);return i};N.PREFER_ENV=be.WEBGL2,N.STRICT_TEXTURE_CACHE=!1,N.RENDER_OPTIONS=Hi(Hi(Hi(Hi({},Rs.defaultOptions),Cs.defaultOptions),Ds.defaultOptions),Ps.defaultOptions),Object.defineProperties(N,{WRAP_MODE:{get(){return X.defaultOptions.wrapMode},set(i){X.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return X.defaultOptions.scaleMode},set(i){X.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return X.defaultOptions.mipmap},set(i){X.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return X.defaultOptions.anisotropicLevel},set(i){X.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return Tt.defaultResolution},set(i){Tt.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return Tt.defaultMultisample},set(i){Tt.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return Ee.defaultMaxTextures},set(i){Ee.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return Ee.defaultBatchSize},set(i){Ee.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return Ee.canUploadSameBuffer},set(i){Ee.canUploadSameBuffer=i}},GC_MODE:{get(){return Ae.defaultMode},set(i){Ae.defaultMode=i}},GC_MAX_IDLE:{get(){return Ae.defaultMaxIdle},set(i){Ae.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return Ae.defaultCheckCountMax},set(i){Ae.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return se.defaultVertexPrecision},set(i){se.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return se.defaultFragmentPrecision},set(i){se.defaultFragmentPrecision=i}}});var pe=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(pe||{});class In{constructor(t,e=null,s=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=s,this.once=r}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const Ah=class Dt{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new In(null,null,1/0),this.deltaMS=1/Dt.targetFPMS,this.elapsedMS=1/Dt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,s=pe.NORMAL){return this._addListener(new In(t,e,s))}addOnce(t,e,s=pe.NORMAL){return this._addListener(new In(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(!e)t.connect(s);else{for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s.match(t,e)?s=s.destroy():s=s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?xt.shared:new xt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Pn.extension=D.Application,U.add(Pn);const wh=[];U.handleByList(D.Renderer,wh);function Sh(i){for(const t of wh)if(t.test(i))return new t(i);throw new Error("Unable to auto-detect a suitable renderer.")}var of=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,hf=`attribute vec2 aVertexPosition; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +uniform vec4 inputSize; +uniform vec4 outputFrame; + +vec4 filterVertexPosition( void ) +{ + vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + + return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); +} + +vec2 filterTextureCoord( void ) +{ + return aVertexPosition * (outputFrame.zw * inputSize.zw); +} + +void main(void) +{ + gl_Position = filterVertexPosition(); + vTextureCoord = filterTextureCoord(); +} +`;const Ch=of,Mn=hf;class Dn{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const s=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,s)}else{const s=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,s)}e>=ft.HIGH?this.multisample=ft.HIGH:e>=ft.MEDIUM?this.multisample=ft.MEDIUM:e>=ft.LOW?this.multisample=ft.LOW:this.multisample=ft.NONE}destroy(){}}Dn.extension={type:D.RendererSystem,name:"_multisample"},U.add(Dn);class lf{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class On{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glBuffers[s]||this.createGLBuffer(t);e.bindBuffer(t.type,r.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:s,CONTEXT_UID:r}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,s){const{gl:r,CONTEXT_UID:n}=this;s=s||0;const a=t._glBuffers[n]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,a.buffer,s*256,256)}update(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glBuffers[s]||this.createGLBuffer(t);if(t._updateID!==r.updateID)if(r.updateID=t._updateID,e.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const s=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),s&&(e||r.deleteBuffer(s.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let s=0;se.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:s}=this.items[0];return this.resize(e,s),this.update(),Promise.resolve(this)}),this._load}}class Rh extends Fn{constructor(t,e){const{width:s,height:r}=e||{};let n,a;Array.isArray(t)?(n=t,a=t.length):a=t,super(a,{width:s,height:r}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=Me.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:r,itemDirtyIds:n,items:a}=this,{gl:o}=t;s.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,r,0,e.format,s.type,null);for(let h=0;h0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=Me.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,s){const r=this.itemDirtyIds;for(let n=0;n{if(this.url===null){t(this);return}try{const s=await N.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const r=await s.blob();if(this.destroyed)return;const n=await createImageBitmap(r,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===At.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(s){if(this.destroyed)return;e(s),this.onError.emit(s)}}),this._load)}upload(t,e,s){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,s)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap!="undefined"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){var t;return $e._EMPTY=(t=$e._EMPTY)!=null?t:N.ADAPTER.createCanvas(0,0),$e._EMPTY}}const Ln=class Tr extends fe{constructor(t,e){e=e||{},super(N.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},Tr.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const t=new Image;fe.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,s=t.height;if(!e||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let r=e*this.scale,n=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(r=this._overrideWidth||this._overrideHeight/s*e,n=this._overrideHeight||this._overrideWidth/e*s),r=Math.round(r),n=Math.round(n);const a=this.source;a.width=r,a.height=n,a._pixiId=`canvas_${Te()}`,a.getContext("2d").drawImage(t,0,0,e,s,0,0,r,n),this._resolve(),this._resolve=null}}static getSize(t){const e=Tr.SVG_SIZE.exec(t),s={};return e&&(s[e[1]]=Math.round(parseFloat(e[3])),s[e[5]]=Math.round(parseFloat(e[7]))),s}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&Tr.SVG_XML.test(t)}};Ln.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let Xi=Ln;const Un=class Aa extends fe{constructor(t,e){if(e=e||{},!(t instanceof HTMLVideoElement)){const s=document.createElement("video");e.autoLoad!==!1&&s.setAttribute("preload","auto"),e.playsinline!==!1&&(s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline","")),e.muted===!0&&(s.setAttribute("muted",""),s.muted=!0),e.loop===!0&&s.setAttribute("loop",""),e.autoPlay!==!1&&s.setAttribute("autoplay",""),typeof t=="string"&&(t=[t]);const r=t[0].src||t[0];fe.crossOrigin(s,r,e.crossorigin);for(let n=0;n{this.valid?e(this):(this._resolve=e,this._reject=s,t.load())}),this._load}_onError(t){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.source;return!t.paused&&!t.ended&&this._isSourceReady()}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!e&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()}dispose(){this._configureAutoUpdate();const t=this.source;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(xt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(xt.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(xt.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,e){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||Aa.TYPES.includes(e)}};Un.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],Un.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let kn=Un;Ei.push($e,un,Nn,kn,Xi,xs,Ph,Rh);class uf{constructor(){this._glTransformFeedbacks={},this.buffers=[],this.disposeRunner=new Pt("disposeTransformFeedback")}bindBuffer(t,e){this.buffers[t]=e}destroy(){this.disposeRunner.emit(this,!1)}}const cf="7.3.0";X.prototype.getDrawableSource=function(){const i=this.resource;return i?i.bitmap||i.source:null},Ni.prototype._canvasRenderTarget=null,L.prototype.patternCache=null,L.prototype.tintCache=null;let Os;function Mh(i){const t=N.ADAPTER.createCanvas(6,1),e=t.getContext("2d");return e.fillStyle=i,e.fillRect(0,0,6,1),t}function Gn(){if(typeof document=="undefined")return!1;if(Os!==void 0)return Os;const i=Mh("#ff00ff"),t=Mh("#ffff00"),e=N.ADAPTER.createCanvas(6,1).getContext("2d");e.globalCompositeOperation="multiply",e.drawImage(i,0,0),e.drawImage(t,2,0);const s=e.getImageData(2,0,1,1);if(!s)Os=!1;else{const r=s.data;Os=r[0]===255&&r[1]===0&&r[2]===0}return Os}function df(i=[]){return Gn()?(i[C.NORMAL]="source-over",i[C.ADD]="lighter",i[C.MULTIPLY]="multiply",i[C.SCREEN]="screen",i[C.OVERLAY]="overlay",i[C.DARKEN]="darken",i[C.LIGHTEN]="lighten",i[C.COLOR_DODGE]="color-dodge",i[C.COLOR_BURN]="color-burn",i[C.HARD_LIGHT]="hard-light",i[C.SOFT_LIGHT]="soft-light",i[C.DIFFERENCE]="difference",i[C.EXCLUSION]="exclusion",i[C.HUE]="hue",i[C.SATURATION]="saturation",i[C.COLOR]="color",i[C.LUMINOSITY]="luminosity"):(i[C.NORMAL]="source-over",i[C.ADD]="lighter",i[C.MULTIPLY]="source-over",i[C.SCREEN]="source-over",i[C.OVERLAY]="source-over",i[C.DARKEN]="source-over",i[C.LIGHTEN]="source-over",i[C.COLOR_DODGE]="source-over",i[C.COLOR_BURN]="source-over",i[C.HARD_LIGHT]="source-over",i[C.SOFT_LIGHT]="source-over",i[C.DIFFERENCE]="source-over",i[C.EXCLUSION]="source-over",i[C.HUE]="source-over",i[C.SATURATION]="source-over",i[C.COLOR]="source-over",i[C.LUMINOSITY]="source-over"),i[C.NORMAL_NPM]=i[C.NORMAL],i[C.ADD_NPM]=i[C.ADD],i[C.SCREEN_NPM]=i[C.SCREEN],i[C.SRC_IN]="source-in",i[C.SRC_OUT]="source-out",i[C.SRC_ATOP]="source-atop",i[C.DST_OVER]="destination-over",i[C.DST_IN]="destination-in",i[C.DST_OUT]="destination-out",i[C.DST_ATOP]="destination-atop",i[C.XOR]="xor",i[C.SUBTRACT]="source-over",i}const ff=new tt;class $n{constructor(t){this.activeResolution=1,this.smoothProperty="imageSmoothingEnabled",this.blendModes=df(),this._activeBlendMode=null,this._projTransform=null,this._outerBlend=!1,this.renderer=t}init(){const t=this.renderer.background.alpha<1;if(this.rootContext=this.renderer.view.getContext("2d",{alpha:t}),this.activeContext=this.rootContext,!this.rootContext.imageSmoothingEnabled){const e=this.rootContext;e.webkitImageSmoothingEnabled?this.smoothProperty="webkitImageSmoothingEnabled":e.mozImageSmoothingEnabled?this.smoothProperty="mozImageSmoothingEnabled":e.oImageSmoothingEnabled?this.smoothProperty="oImageSmoothingEnabled":e.msImageSmoothingEnabled&&(this.smoothProperty="msImageSmoothingEnabled")}}setContextTransform(t,e,s){let r=t;const n=this._projTransform,a=this.activeResolution;s=s||a,n&&(r=ff,r.copyFrom(t),r.prepend(n)),e?this.activeContext.setTransform(r.a*s,r.b*s,r.c*s,r.d*s,r.tx*a|0,r.ty*a|0):this.activeContext.setTransform(r.a*s,r.b*s,r.c*s,r.d*s,r.tx*a,r.ty*a)}clear(t,e){const{activeContext:s,renderer:r}=this,n=t?Y.shared.setValue(t):this.renderer.background.backgroundColor;s.clearRect(0,0,r.width,r.height),t&&(s.globalAlpha=e!=null?e:this.renderer.background.alpha,s.fillStyle=n.toHex(),s.fillRect(0,0,r.width,r.height),s.globalAlpha=1)}setBlendMode(t,e){const s=t===C.SRC_IN||t===C.SRC_OUT||t===C.DST_IN||t===C.DST_ATOP;!e&&s&&(t=C.NORMAL),this._activeBlendMode!==t&&(this._activeBlendMode=t,this._outerBlend=s,this.activeContext.globalCompositeOperation=this.blendModes[t])}resize(){this.smoothProperty&&(this.rootContext[this.smoothProperty]=X.defaultOptions.scaleMode===Bt.LINEAR)}invalidateBlendMode(){this._activeBlendMode=this.blendModes.indexOf(this.activeContext.globalCompositeOperation)}destroy(){this.renderer=null,this.rootContext=null,this.activeContext=null,this.smoothProperty=null}}$n.extension={type:D.CanvasRendererSystem,name:"canvasContext"},U.add($n);class Hn{constructor(t){this._foundShapes=[],this.renderer=t}pushMask(t){const e=this.renderer,s=t.maskObject||t;e.canvasContext.activeContext.save();const r=this._foundShapes;if(this.recursiveFindShapes(s,r),r.length>0){const n=e.canvasContext.activeContext;n.beginPath();for(let a=0;a0){u=0,d=h[0],f=h[1];for(let p=2;p+2=0;m-=2)e.lineTo(h[m],h[m+1])}l[p].shape.closeStroke&&e.closePath()}}h[0]===h[h.length-2]&&h[1]===h[h.length-1]&&e.closePath()}else if(o.type===it.RECT)e.rect(o.x,o.y,o.width,o.height),e.closePath();else if(o.type===it.CIRC)e.arc(o.x,o.y,o.radius,0,2*Math.PI),e.closePath();else if(o.type===it.ELIP){const h=o.width*2,l=o.height*2,u=o.x-h/2,c=o.y-l/2,d=.5522848,f=h/2*d,p=l/2*d,m=u+h,g=c+l,_=u+h/2,x=c+l/2;e.moveTo(u,x),e.bezierCurveTo(u,x-p,_-f,c,_,c),e.bezierCurveTo(_+f,c,m,x-p,m,x),e.bezierCurveTo(m,x+p,_+f,g,_,g),e.bezierCurveTo(_-f,g,u,x+p,u,x),e.closePath()}else if(o.type===it.RREC){const h=o.x,l=o.y,u=o.width,c=o.height;let d=o.radius;const f=Math.min(u,c)/2;d=d>f?f:d,e.moveTo(h,l+d),e.lineTo(h,l+c-d),e.quadraticCurveTo(h,l+c,h+d,l+c),e.lineTo(h+u-d,l+c),e.quadraticCurveTo(h+u,l+c,h+u,l+c-d),e.lineTo(h+u,l+d),e.quadraticCurveTo(h+u,l,h+u-d,l),e.lineTo(h+d,l),e.quadraticCurveTo(h,l,h,l+d),e.closePath()}}}popMask(t){t.canvasContext.activeContext.restore(),t.canvasContext.invalidateBlendMode()}destroy(){}}Hn.extension={type:D.CanvasRendererSystem,name:"mask"},U.add(Hn);class Vn{constructor(t){this.renderer=t}render(t,e){const s=this.renderer;if(!s.view)return;const r=s.canvasContext;let n,a,o,h;e&&(n=e.renderTexture,a=e.clear,o=e.transform,h=e.skipUpdateTransform),this.renderingToScreen=!n,s.emit("prerender");const l=s.resolution;n?(n=n.castToBaseTexture(),n._canvasRenderTarget||(n._canvasRenderTarget=new ys(n.width,n.height,n.resolution),n.resource=new Nn(n._canvasRenderTarget.canvas),n.valid=!0),r.activeContext=n._canvasRenderTarget.context,s.canvasContext.activeResolution=n._canvasRenderTarget.resolution):(r.activeContext=r.rootContext,r.activeResolution=l);const u=r.activeContext;if(r._projTransform=o||null,n||(this.lastObjectRendered=t),!h){const d=t.enableTempParent();t.updateTransform(),t.disableTempParent(d)}if(u.save(),u.setTransform(1,0,0,1,0,0),u.globalAlpha=1,r._activeBlendMode=C.NORMAL,r._outerBlend=!1,u.globalCompositeOperation=r.blendModes[C.NORMAL],a!=null?a:s.background.clearBeforeRender)if(this.renderingToScreen){u.clearRect(0,0,s.width,s.height);const d=s.background;d.alpha>0&&(u.globalAlpha=d.backgroundColor.alpha,u.fillStyle=d.backgroundColor.toHex(),u.fillRect(0,0,s.width,s.height),u.globalAlpha=1)}else n=n,n._canvasRenderTarget.clear(),n.clear.alpha>0&&(u.globalAlpha=n.clear.alpha,u.fillStyle=n.clear.toHex(),u.fillRect(0,0,n.realWidth,n.realHeight),u.globalAlpha=1);const c=r.activeContext;r.activeContext=u,t.renderCanvas(s),r.activeContext=c,u.restore(),r.activeResolution=l,r._projTransform=null,s.emit("postrender")}destroy(){this.lastObjectRendered=null,this.render=null}}Vn.extension={type:D.CanvasRendererSystem,name:"objectRenderer"},U.add(Vn);const{deprecation:pf}=Po,zi=class wa extends Sn{constructor(t){super(),this.type=li.CANVAS,this.rendererLogId="Canvas",t=Object.assign({},N.RENDER_OPTIONS,t);const e={runners:["init","destroy","contextChange","resolutionChange","reset","update","postrender","prerender","resize"],systems:wa.__systems,priority:["textureGenerator","background","_view","_plugin","startup","mask","canvasContext","objectRenderer"]};this.setup(e),"useContextAlpha"in t&&(t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=wa.__plugins,this.options=t,this.startup.run(this.options)}static test(){return!0}generateTexture(t,e){return this.textureGenerator.generateTexture(t,e)}reset(){}render(t,e){this.objectRenderer.render(t,e)}clear(){this.canvasContext.clear()}destroy(t){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:t}),super.destroy()}get plugins(){return this._plugin.plugins}resize(t,e){this._view.resizeView(t,e)}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(t){this._view.resolution=t,this.runners.resolutionChange.emit(t)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get clearBeforeRender(){return this.background.clearBeforeRender}get blendModes(){return this.canvasContext.blendModes}get maskManager(){return pf("7.0.0","renderer.maskManager has been deprecated, please use renderer.mask instead"),this.mask}get refresh(){return!0}get rootContext(){return this.canvasContext.rootContext}get context(){return this.canvasContext.activeContext}get smoothProperty(){return this.canvasContext.smoothProperty}setBlendMode(t,e){this.canvasContext.setBlendMode(t,e)}invalidateBlendMode(){this.canvasContext.invalidateBlendMode()}setContextTransform(t,e,s){this.canvasContext.setContextTransform(t,e,s)}get backgroundColor(){return this.background.color}set backgroundColor(t){this.background.color=t}get backgroundAlpha(){return this.background.alpha}set backgroundAlpha(t){this.background.alpha=t}get preserveDrawingBuffer(){return!1}get useContextAlpha(){return!1}};zi.extension={type:D.Renderer,priority:0},zi.__plugins={},zi.__systems={};let Bs=zi;U.handleByMap(D.CanvasRendererPlugin,Bs.__plugins),U.handleByMap(D.CanvasRendererSystem,Bs.__systems),U.add(Bs);const gt={canvas:null,getTintedCanvas:(i,t)=>{const e=i.texture,s=Y.shared.setValue(t).toHex();e.tintCache=e.tintCache||{};const r=e.tintCache[s];let n;if(r){if(r.tintId===e._updateID)return e.tintCache[s];n=e.tintCache[s]}else n=N.ADAPTER.createCanvas();if(gt.tintMethod(e,t,n),n.tintId=e._updateID,gt.convertTintToImage&&n.toDataURL!==void 0){const a=new Image;a.src=n.toDataURL(),e.tintCache[s]=a}else e.tintCache[s]=n;return n},getTintedPattern:(i,t)=>{const e=Y.shared.setValue(t).toHex();i.patternCache=i.patternCache||{};let s=i.patternCache[e];return(s==null?void 0:s.tintId)===i._updateID||(gt.canvas||(gt.canvas=N.ADAPTER.createCanvas()),gt.tintMethod(i,t,gt.canvas),s=gt.canvas.getContext("2d").createPattern(gt.canvas,"repeat"),s.tintId=i._updateID,i.patternCache[e]=s),s},tintWithMultiply:(i,t,e)=>{const s=e.getContext("2d"),r=i._frame.clone(),n=i.baseTexture.resolution;r.x*=n,r.y*=n,r.width*=n,r.height*=n,e.width=Math.ceil(r.width),e.height=Math.ceil(r.height),s.save(),s.fillStyle=Y.shared.setValue(t).toHex(),s.fillRect(0,0,r.width,r.height),s.globalCompositeOperation="multiply";const a=i.baseTexture.getDrawableSource();s.drawImage(a,r.x,r.y,r.width,r.height,0,0,r.width,r.height),s.globalCompositeOperation="destination-atop",s.drawImage(a,r.x,r.y,r.width,r.height,0,0,r.width,r.height),s.restore()},tintWithOverlay:(i,t,e)=>{const s=e.getContext("2d"),r=i._frame.clone(),n=i.baseTexture.resolution;r.x*=n,r.y*=n,r.width*=n,r.height*=n,e.width=Math.ceil(r.width),e.height=Math.ceil(r.height),s.save(),s.globalCompositeOperation="copy",s.fillStyle=`#${`00000${(t|0).toString(16)}`.slice(-6)}`,s.fillRect(0,0,r.width,r.height),s.globalCompositeOperation="destination-atop",s.drawImage(i.baseTexture.getDrawableSource(),r.x,r.y,r.width,r.height,0,0,r.width,r.height),s.restore()},tintWithPerPixel:(i,t,e)=>{const s=e.getContext("2d"),r=i._frame.clone(),n=i.baseTexture.resolution;r.x*=n,r.y*=n,r.width*=n,r.height*=n,e.width=Math.ceil(r.width),e.height=Math.ceil(r.height),s.save(),s.globalCompositeOperation="copy",s.drawImage(i.baseTexture.getDrawableSource(),r.x,r.y,r.width,r.height,0,0,r.width,r.height),s.restore();const[a,o,h]=Y.shared.setValue(t).toArray(),l=s.getImageData(0,0,r.width,r.height),u=l.data;for(let c=0;cY.shared.setValue(i).round(gt.cacheStepsPerColorChannel).toNumber(),cacheStepsPerColorChannel:8,convertTintToImage:!1,canUseMultiply:Gn(),tintMethod:null};gt.tintMethod=gt.canUseMultiply?gt.tintWithMultiply:gt.tintWithPerPixel;class Fs{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(t){return this.minX>this.maxX||this.minY>this.maxY?z.EMPTY:(t=t||new z(0,0,1,1),t.x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)}addPoint(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)}addPointMatrix(t,e){const{a:s,b:r,c:n,d:a,tx:o,ty:h}=t,l=s*e.x+n*e.y+o,u=r*e.x+a*e.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)}addQuad(t){let e=this.minX,s=this.minY,r=this.maxX,n=this.maxY,a=t[0],o=t[1];e=ar?a:r,n=o>n?o:n,a=t[2],o=t[3],e=ar?a:r,n=o>n?o:n,a=t[4],o=t[5],e=ar?a:r,n=o>n?o:n,a=t[6],o=t[7],e=ar?a:r,n=o>n?o:n,this.minX=e,this.minY=s,this.maxX=r,this.maxY=n}addFrame(t,e,s,r,n){this.addFrameMatrix(t.worldTransform,e,s,r,n)}addFrameMatrix(t,e,s,r,n){const a=t.a,o=t.b,h=t.c,l=t.d,u=t.tx,c=t.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=a*e+h*s+u,_=o*e+l*s+c;d=gp?g:p,m=_>m?_:m,g=a*r+h*s+u,_=o*r+l*s+c,d=gp?g:p,m=_>m?_:m,g=a*e+h*n+u,_=o*e+l*n+c,d=gp?g:p,m=_>m?_:m,g=a*r+h*n+u,_=o*r+l*n+c,d=gp?g:p,m=_>m?_:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(t,e,s){let r=this.minX,n=this.minY,a=this.maxX,o=this.maxY;for(let h=e;ha?l:a,o=u>o?u:o}this.minX=r,this.minY=n,this.maxX=a,this.maxY=o}addVertices(t,e,s,r){this.addVerticesMatrix(t.worldTransform,e,s,r)}addVerticesMatrix(t,e,s,r,n=0,a=n){const o=t.a,h=t.b,l=t.c,u=t.d,c=t.tx,d=t.ty;let f=this.minX,p=this.minY,m=this.maxX,g=this.maxY;for(let _=s;_r?t.maxX:r,this.maxY=t.maxY>n?t.maxY:n}addBoundsMask(t,e){const s=t.minX>e.minX?t.minX:e.minX,r=t.minY>e.minY?t.minY:e.minY,n=t.maxXl?n:l,this.maxY=a>u?a:u}}addBoundsMatrix(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)}addBoundsArea(t,e){const s=t.minX>e.x?t.minX:e.x,r=t.minY>e.y?t.minY:e.y,n=t.maxXl?n:l,this.maxY=a>u?a:u}}pad(t=0,e=t){this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)}addFramePad(t,e,s,r,n,a){t-=n,e-=a,s+=n,r+=a,this.minX=this.minXs?this.maxX:s,this.minY=this.minYr?this.maxY:r}}class ot extends Ye{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Pi,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new Fs,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){const e=Object.keys(t);for(let s=0;s1)for(let e=0;ethis.children.length)throw new Error(`${t}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t}swapChildren(t,e){if(t===e)return;const s=this.getChildIndex(t),r=this.getChildIndex(e);this.children[s]=e,this.children[r]=t,this.onChildrenChange(s=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(t);Oe(this.children,s,1),this.children.splice(e,0,t),this.onChildrenChange(e)}getChildAt(t){if(t<0||t>=this.children.length)throw new Error(`getChildAt: Index (${t}) does not exist.`);return this.children[t]}removeChild(...t){if(t.length>1)for(let e=0;e0&&n<=r){a=this.children.splice(s,n);for(let o=0;o1&&this.children.sort(gf),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let t=0,e=this.children.length;t0&&e.height>0))return;let s,r;this.cullArea?(s=this.cullArea,r=this.worldTransform):this._render!==Sa.prototype._render&&(s=this.getBounds(!0));const n=t.projection.transform;if(n&&(r?(r=mf.copyFrom(r),r.prepend(n)):r=n),s&&e.intersects(s,r))this._render(t);else if(this.cullArea)return;for(let a=0,o=this.children.length;a=r&&Ns.x=n&&Ns.y=r&&Ls.x=n&&Ls.y1?Wt.from(yf,vf,e):Wt.from(Bh,xf,e)}render(t){const e=this.renderer,s=this.quad;let r=s.vertices;r[0]=r[6]=t._width*-t.anchor.x,r[1]=r[3]=t._height*-t.anchor.y,r[2]=r[4]=t._width*(1-t.anchor.x),r[5]=r[7]=t._height*(1-t.anchor.y);const n=t.uvRespectAnchor?t.anchor.x:0,a=t.uvRespectAnchor?t.anchor.y:0;r=s.uvs,r[0]=r[6]=-n,r[1]=r[3]=-a,r[2]=r[4]=1-n,r[5]=r[7]=1-a,s.invalidate();const o=t._texture,h=o.baseTexture,l=h.alphaMode>0,u=t.tileTransform.localTransform,c=t.uvMatrix;let d=h.isPowerOfTwo&&o.frame.width===h.width&&o.frame.height===h.height;d&&(h._glTextures[e.CONTEXT_UID]?d=h.wrapMode!==Zt.CLAMP:h.wrapMode===Zt.CLAMP&&(h.wrapMode=Zt.REPEAT));const f=d?this.simpleShader:this.shader,p=o.width,m=o.height,g=t._width,_=t._height;Yi.set(u.a*p/g,u.b*p/_,u.c*m/g,u.d*m/_,u.tx/g,u.ty/_),Yi.invert(),d?Yi.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=Yi.toArray(!0),f.uniforms.uColor=Y.shared.setValue(t.tint).premultiply(t.worldAlpha,l).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=t.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,e.shader.bind(f),e.geometry.bind(s),this.state.blendMode=$r(t.blendMode,l),e.state.set(this.state),e.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}jn.extension={name:"tilingSprite",type:D.RendererPlugin},U.add(jn);const qi=new tt,Us=new tt,ie=[new K,new K,new K,new K];Wi.prototype._renderCanvas=function(i){const t=this._texture;if(!t.baseTexture.valid)return;const e=i.canvasContext.activeContext,s=this.worldTransform,r=t.baseTexture,n=r.getDrawableSource(),a=r.resolution;if(this._textureID!==this._texture._updateID||this._cachedTint!==this.tintValue){this._textureID=this._texture._updateID;const d=new ys(t._frame.width,t._frame.height,a);this.tintValue!==16777215?(this._tintedCanvas=gt.getTintedCanvas(this,this.tintValue),d.context.drawImage(this._tintedCanvas,0,0)):d.context.drawImage(n,-t._frame.x*a,-t._frame.y*a),this._cachedTint=this.tintValue,this._canvasPattern=d.context.createPattern(d.canvas,"repeat")}e.globalAlpha=this.worldAlpha,i.canvasContext.setBlendMode(this.blendMode),this.tileTransform.updateLocalTransform();const o=this.tileTransform.localTransform,h=this._width,l=this._height;qi.identity(),Us.copyFrom(o),this.uvRespectAnchor||Us.translate(-this.anchor.x*h,-this.anchor.y*l),Us.scale(1/a,1/a),qi.prepend(Us),qi.prepend(s),i.canvasContext.setContextTransform(qi),e.fillStyle=this._canvasPattern;const u=this.anchor.x*-h,c=this.anchor.y*-l;ie[0].set(u,c),ie[1].set(u+h,c),ie[2].set(u+h,c+l),ie[3].set(u,c+l);for(let d=0;d<4;d++)Us.applyInverse(ie[d],ie[d]);e.beginPath(),e.moveTo(ie[0].x,ie[0].y);for(let d=1;d<4;d++)e.lineTo(ie[d].x,ie[d].y);e.closePath(),e.fill()};class Fh extends St{constructor(t=1500,e,s=16384,r=!1){super();const n=16384;s>n&&(s=n),this._properties=[!1,!0,!1,!1,!1],this._maxSize=t,this._batchSize=s,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=C.NORMAL,this.autoResize=r,this.roundPixels=!0,this.baseTexture=null,this.setProperties(e),this._tintColor=new Y(0),this.tintRgb=new Float32Array(3),this.tint=16777215}setProperties(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])}updateTransform(){this.displayObjectUpdateTransform()}get tint(){return this._tintColor.value}set tint(t){this._tintColor.setValue(t),this._tintColor.toRgbArray(this.tintRgb)}render(t){!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable||(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",()=>this.onChildrenChange(0))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))}onChildrenChange(t){const e=Math.floor(t/this._batchSize);for(;this._bufferUpdateIDs.lengths&&!t.autoResize&&(a=s);let o=t._buffers;o||(o=t._buffers=this.generateBuffers(t));const h=e[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=$r(t.blendMode,l),n.state.set(this.state);const u=n.gl,c=t.worldTransform.copyTo(this.tempMatrix);c.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=c.toArray(!0),this.shader.uniforms.uColor=Y.shared.setValue(t.tintRgb).premultiply(t.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,p=0;fr&&(m=r),p>=o.length&&o.push(this._generateOneMoreBuffer(t));const g=o[p];g.uploadDynamic(e,f,m);const _=t._bufferUpdateIDs[p]||0;d=d||g._updateID<_,d&&(g._updateID=t._updateID,g.uploadStatic(e,f,m)),n.geometry.bind(g.geometry),u.drawElements(u.TRIANGLES,m*6,u.UNSIGNED_SHORT,0)}}generateBuffers(t){const e=[],s=t._maxSize,r=t._batchSize,n=t._properties;for(let a=0;a0);r[a]=l,r[a+n]=l,r[a+n*2]=l,r[a+n*3]=l,a+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Xn.extension={name:"particle",type:D.RendererPlugin},U.add(Xn),Fh.prototype.renderCanvas=function(i){if(!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable)return;const t=i.canvasContext.activeContext,e=this.worldTransform;let s=!0,r=0,n=0,a=0,o=0;i.canvasContext.setBlendMode(this.blendMode),t.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(let h=0;h(i[i.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",i[i.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",i))(ks||{});const Ki={willReadFrequently:!0},re=class G{static get experimentalLetterSpacingSupported(){let t=G._experimentalLetterSpacingSupported;if(t!==void 0){const e=N.ADAPTER.getCanvasRenderingContext2D().prototype;t=G._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,s,r,n,a,o,h,l){this.text=t,this.style=e,this.width=s,this.height=r,this.lines=n,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=h,this.fontProperties=l}static measureText(t,e,s,r=G._canvas){s=s==null?e.wordWrap:s;const n=e.toFontString(),a=G.measureFont(n);a.fontSize===0&&(a.fontSize=e.fontSize,a.ascent=e.fontSize);const o=r.getContext("2d",Ki);o.font=n;const h=(s?G.wordWrap(t,e,r):t).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let u=0;for(let p=0;p0&&(r?n-=e:n+=(G.graphemeSegmenter(t).length-1)*e),n}static wordWrap(t,e,s=G._canvas){const r=s.getContext("2d",Ki);let n=0,a="",o="";const h=Object.create(null),{letterSpacing:l,whiteSpace:u}=e,c=G.collapseSpaces(u),d=G.collapseNewlines(u);let f=!c;const p=e.wordWrapWidth+l,m=G.tokenize(t);for(let g=0;gp)if(a!==""&&(o+=G.addLine(a),a="",n=0),G.canBreakWords(_,e.breakWords)){const v=G.wordWrapSplit(_);for(let b=0;bp&&(o+=G.addLine(a),f=!1,a="",n=0),a+=T,n+=A}}else{a.length>0&&(o+=G.addLine(a),a="",n=0);const v=g===m.length-1;o+=G.addLine(_,!v),f=!1,a="",n=0}else x+n>p&&(f=!1,o+=G.addLine(a),a="",n=0),(a.length>0||!G.isBreakingSpace(_)||f)&&(a+=_,n+=x)}return o+=G.addLine(a,!1),o}static addLine(t,e=!0){return t=G.trimRight(t),t=e?`${t} +`:t,t}static getFromCache(t,e,s,r){let n=s[t];return typeof n!="number"&&(n=G._measureText(t,e,r)+e,s[t]=n),n}static collapseSpaces(t){return t==="normal"||t==="pre-line"}static collapseNewlines(t){return t==="normal"}static trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const s=t[e];if(!G.isBreakingSpace(s))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t!="string"?!1:G._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:G._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){const e=[];let s="";if(typeof t!="string")return e;for(let r=0;ro;--d){for(let m=0;m{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const i=new Intl.Segmenter;return t=>[...i.segment(t)].map(e=>e.segment)}return i=>[...i]})(),re.experimentalLetterSpacing=!1,re._fonts={},re._newlines=[10,13],re._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let me=re;const Af=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Lh=class ai{constructor(t){this.styleID=0,this.reset(),Wn(this,t,t)}clone(){const t={};return Wn(t,this,ai.defaultStyle),new ai(t)}reset(){Wn(this,ai.defaultStyle,ai.defaultStyle)}get align(){return this._align}set align(t){this._align!==t&&(this._align=t,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(t){const e=zn(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)}get fill(){return this._fill}set fill(t){const e=zn(t);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(t){wf(this._fillGradientStops,t)||(this._fillGradientStops=t,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(t){this.fontFamily!==t&&(this._fontFamily=t,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize!==t&&(this._fontSize=t,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle!==t&&(this._fontStyle=t,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant!==t&&(this._fontVariant=t,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight!==t&&(this._fontWeight=t,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing!==t&&(this._letterSpacing=t,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight!==t&&(this._lineHeight=t,this.styleID++)}get leading(){return this._leading}set leading(t){this._leading!==t&&(this._leading=t,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(t){this._lineJoin!==t&&(this._lineJoin=t,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(t){this._miterLimit!==t&&(this._miterLimit=t,this.styleID++)}get padding(){return this._padding}set padding(t){this._padding!==t&&(this._padding=t,this.styleID++)}get stroke(){return this._stroke}set stroke(t){const e=zn(t);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(t){this._strokeThickness!==t&&(this._strokeThickness=t,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline!==t&&(this._textBaseline=t,this.styleID++)}get trim(){return this._trim}set trim(t){this._trim!==t&&(this._trim=t,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace!==t&&(this._whiteSpace=t,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap!==t&&(this._wordWrap=t,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth!==t&&(this._wordWrapWidth=t,this.styleID++)}toFontString(){const t=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let s=e.length-1;s>=0;s--){let r=e[s].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!Af.includes(r)&&(r=`"${r}"`),e[s]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${t} ${e.join(",")}`}};Lh.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:ks.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let ge=Lh;function zn(i){const t=Y.shared,e=s=>{const r=t.setValue(s);return r.alpha===1?r.toHex():r.toRgbaString()};return Array.isArray(i)?i.map(e):e(i)}function wf(i,t){if(!Array.isArray(i)||!Array.isArray(t)||i.length!==t.length)return!1;for(let e=0;e0&&p>m&&(g=(m+p)/2);const _=m+d,x=s.lineHeight*(f+1);let v=_;f+1=e&&(a=i-o-1),h=h.replace("%value%",t[a].toString()),r+=h,r+=` +`}return s=s.replace("%blur%",r),s=s.replace("%size%",i.toString()),s}const Df=` + attribute vec2 aVertexPosition; + + uniform mat3 projectionMatrix; + + uniform float strength; + + varying vec2 vBlurTexCoords[%size%]; + + uniform vec4 inputSize; + uniform vec4 outputFrame; + + vec4 filterVertexPosition( void ) + { + vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + + return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + } + + vec2 filterTextureCoord( void ) + { + return aVertexPosition * (outputFrame.zw * inputSize.zw); + } + + void main(void) + { + gl_Position = filterVertexPosition(); + + vec2 textureCoord = filterTextureCoord(); + %blur% + }`;function Of(i,t){const e=Math.ceil(i/2);let s=Df,r="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let a=0;a 0.0) { + c.rgb /= c.a; + } + + vec4 result; + + result.r = (m[0] * c.r); + result.r += (m[1] * c.g); + result.r += (m[2] * c.b); + result.r += (m[3] * c.a); + result.r += m[4]; + + result.g = (m[5] * c.r); + result.g += (m[6] * c.g); + result.g += (m[7] * c.b); + result.g += (m[8] * c.a); + result.g += m[9]; + + result.b = (m[10] * c.r); + result.b += (m[11] * c.g); + result.b += (m[12] * c.b); + result.b += (m[13] * c.a); + result.b += m[14]; + + result.a = (m[15] * c.r); + result.a += (m[16] * c.g); + result.a += (m[17] * c.b); + result.a += (m[18] * c.a); + result.a += m[19]; + + vec3 rgb = mix(c.rgb, result.rgb, uAlpha); + + // Premultiply alpha again. + rgb *= result.a; + + gl_FragColor = vec4(rgb, result.a); +} +`;class Ji extends Tt{constructor(){const t={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(Mn,Bf,t),this.alpha=1}_loadMatrix(t,e=!1){let s=t;e&&(this._multiply(s,this.uniforms.m,t),s=this._colorMatrix(s)),this.uniforms.m=s}_multiply(t,e,s){return t[0]=e[0]*s[0]+e[1]*s[5]+e[2]*s[10]+e[3]*s[15],t[1]=e[0]*s[1]+e[1]*s[6]+e[2]*s[11]+e[3]*s[16],t[2]=e[0]*s[2]+e[1]*s[7]+e[2]*s[12]+e[3]*s[17],t[3]=e[0]*s[3]+e[1]*s[8]+e[2]*s[13]+e[3]*s[18],t[4]=e[0]*s[4]+e[1]*s[9]+e[2]*s[14]+e[3]*s[19]+e[4],t[5]=e[5]*s[0]+e[6]*s[5]+e[7]*s[10]+e[8]*s[15],t[6]=e[5]*s[1]+e[6]*s[6]+e[7]*s[11]+e[8]*s[16],t[7]=e[5]*s[2]+e[6]*s[7]+e[7]*s[12]+e[8]*s[17],t[8]=e[5]*s[3]+e[6]*s[8]+e[7]*s[13]+e[8]*s[18],t[9]=e[5]*s[4]+e[6]*s[9]+e[7]*s[14]+e[8]*s[19]+e[9],t[10]=e[10]*s[0]+e[11]*s[5]+e[12]*s[10]+e[13]*s[15],t[11]=e[10]*s[1]+e[11]*s[6]+e[12]*s[11]+e[13]*s[16],t[12]=e[10]*s[2]+e[11]*s[7]+e[12]*s[12]+e[13]*s[17],t[13]=e[10]*s[3]+e[11]*s[8]+e[12]*s[13]+e[13]*s[18],t[14]=e[10]*s[4]+e[11]*s[9]+e[12]*s[14]+e[13]*s[19]+e[14],t[15]=e[15]*s[0]+e[16]*s[5]+e[17]*s[10]+e[18]*s[15],t[16]=e[15]*s[1]+e[16]*s[6]+e[17]*s[11]+e[18]*s[16],t[17]=e[15]*s[2]+e[16]*s[7]+e[17]*s[12]+e[18]*s[17],t[18]=e[15]*s[3]+e[16]*s[8]+e[17]*s[13]+e[18]*s[18],t[19]=e[15]*s[4]+e[16]*s[9]+e[17]*s[14]+e[18]*s[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const s=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}tint(t,e){const[s,r,n]=Y.shared.setValue(t).toArray(),a=[s,0,0,0,0,0,r,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(a,e)}greyscale(t,e){const s=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const s=Math.cos(t),r=Math.sin(t),n=Math.sqrt,a=1/3,o=n(a),h=s+(1-s)*a,l=a*(1-s)-o*r,u=a*(1-s)+o*r,c=a*(1-s)+o*r,d=s+a*(1-s),f=a*(1-s)-o*r,p=a*(1-s)-o*r,m=a*(1-s)+o*r,g=s+a*(1-s),_=[h,l,u,0,0,c,d,f,0,0,p,m,g,0,0,0,0,0,1,0];this._loadMatrix(_,e)}contrast(t,e){const s=(t||0)+1,r=-.5*(s-1),n=[s,0,0,0,r,0,s,0,0,r,0,0,s,0,r,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const s=t*2/3+1,r=(s-1)*-.5,n=[s,r,r,0,0,r,s,r,0,0,r,r,s,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,s,r,n){t=t||.2,e=e||.15,s=s||16770432,r=r||3375104;const a=Y.shared,[o,h,l]=a.setValue(s).toArray(),[u,c,d]=a.setValue(r).toArray(),f=[.3,.59,.11,0,0,o,h,l,t,0,u,c,d,e,0,o-u,h-c,l-d,0,0];this._loadMatrix(f,n)}night(t,e){t=t||.1;const s=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(s,e)}predator(t,e){const s=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(s,e)}lsd(t){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)}get matrix(){return this.uniforms.m}set matrix(t){this.uniforms.m=t}get alpha(){return this.uniforms.uAlpha}set alpha(t){this.uniforms.uAlpha=t}}Ji.prototype.grayscale=Ji.prototype.greyscale;var Ff=`varying vec2 vFilterCoord; +varying vec2 vTextureCoord; + +uniform vec2 scale; +uniform mat2 rotation; +uniform sampler2D uSampler; +uniform sampler2D mapSampler; + +uniform highp vec4 inputSize; +uniform vec4 inputClamp; + +void main(void) +{ + vec4 map = texture2D(mapSampler, vFilterCoord); + + map -= 0.5; + map.xy = scale * inputSize.zw * (rotation * map.xy); + + gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw)); +} +`,Nf=`attribute vec2 aVertexPosition; + +uniform mat3 projectionMatrix; +uniform mat3 filterMatrix; + +varying vec2 vTextureCoord; +varying vec2 vFilterCoord; + +uniform vec4 inputSize; +uniform vec4 outputFrame; + +vec4 filterVertexPosition( void ) +{ + vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + + return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); +} + +vec2 filterTextureCoord( void ) +{ + return aVertexPosition * (outputFrame.zw * inputSize.zw); +} + +void main(void) +{ + gl_Position = filterVertexPosition(); + vTextureCoord = filterTextureCoord(); + vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy; +} +`;class Hh extends Tt{constructor(t,e){const s=new tt;t.renderable=!1,super(Nf,Ff,{mapSampler:t._texture,filterMatrix:s,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=t,this.maskMatrix=s,e==null&&(e=20),this.scale=new K(e,e)}apply(t,e,s,r){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const n=this.maskSprite.worldTransform,a=Math.sqrt(n.a*n.a+n.b*n.b),o=Math.sqrt(n.c*n.c+n.d*n.d);a!==0&&o!==0&&(this.uniforms.rotation[0]=n.a/a,this.uniforms.rotation[1]=n.b/a,this.uniforms.rotation[2]=n.c/o,this.uniforms.rotation[3]=n.d/o),t.applyFilter(this,e,s,r)}get map(){return this.uniforms.mapSampler}set map(t){this.uniforms.mapSampler=t}}var Lf=`varying vec2 v_rgbNW; +varying vec2 v_rgbNE; +varying vec2 v_rgbSW; +varying vec2 v_rgbSE; +varying vec2 v_rgbM; + +varying vec2 vFragCoord; +uniform sampler2D uSampler; +uniform highp vec4 inputSize; + + +/** + Basic FXAA implementation based on the code on geeks3d.com with the + modification that the texture2DLod stuff was removed since it's + unsupported by WebGL. + + -- + + From: + https://github.com/mitsuhiko/webgl-meincraft + + Copyright (c) 2011 by Armin Ronacher. + + Some rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * The names of the contributors may not be used to endorse or + promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FXAA_REDUCE_MIN +#define FXAA_REDUCE_MIN (1.0/ 128.0) +#endif +#ifndef FXAA_REDUCE_MUL +#define FXAA_REDUCE_MUL (1.0 / 8.0) +#endif +#ifndef FXAA_SPAN_MAX +#define FXAA_SPAN_MAX 8.0 +#endif + +//optimized version for mobile, where dependent +//texture reads can be a bottleneck +vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP, + vec2 v_rgbNW, vec2 v_rgbNE, + vec2 v_rgbSW, vec2 v_rgbSE, + vec2 v_rgbM) { + vec4 color; + vec3 rgbNW = texture2D(tex, v_rgbNW).xyz; + vec3 rgbNE = texture2D(tex, v_rgbNE).xyz; + vec3 rgbSW = texture2D(tex, v_rgbSW).xyz; + vec3 rgbSE = texture2D(tex, v_rgbSE).xyz; + vec4 texColor = texture2D(tex, v_rgbM); + vec3 rgbM = texColor.xyz; + vec3 luma = vec3(0.299, 0.587, 0.114); + float lumaNW = dot(rgbNW, luma); + float lumaNE = dot(rgbNE, luma); + float lumaSW = dot(rgbSW, luma); + float lumaSE = dot(rgbSE, luma); + float lumaM = dot(rgbM, luma); + float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE))); + float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE))); + + mediump vec2 dir; + dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE)); + dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE)); + + float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * + (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN); + + float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce); + dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), + max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), + dir * rcpDirMin)) * inverseVP; + + vec3 rgbA = 0.5 * ( + texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz + + texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz); + vec3 rgbB = rgbA * 0.5 + 0.25 * ( + texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz + + texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz); + + float lumaB = dot(rgbB, luma); + if ((lumaB < lumaMin) || (lumaB > lumaMax)) + color = vec4(rgbA, texColor.a); + else + color = vec4(rgbB, texColor.a); + return color; +} + +void main() { + + vec4 color; + + color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); + + gl_FragColor = color; +} +`,Uf=` +attribute vec2 aVertexPosition; + +uniform mat3 projectionMatrix; + +varying vec2 v_rgbNW; +varying vec2 v_rgbNE; +varying vec2 v_rgbSW; +varying vec2 v_rgbSE; +varying vec2 v_rgbM; + +varying vec2 vFragCoord; + +uniform vec4 inputSize; +uniform vec4 outputFrame; + +vec4 filterVertexPosition( void ) +{ + vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + + return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); +} + +void texcoords(vec2 fragCoord, vec2 inverseVP, + out vec2 v_rgbNW, out vec2 v_rgbNE, + out vec2 v_rgbSW, out vec2 v_rgbSE, + out vec2 v_rgbM) { + v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP; + v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP; + v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP; + v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP; + v_rgbM = vec2(fragCoord * inverseVP); +} + +void main(void) { + + gl_Position = filterVertexPosition(); + + vFragCoord = aVertexPosition * outputFrame.zw; + + texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); +} +`;class Vh extends Tt{constructor(){super(Uf,Lf)}}var kf=`precision highp float; + +varying vec2 vTextureCoord; +varying vec4 vColor; + +uniform float uNoise; +uniform float uSeed; +uniform sampler2D uSampler; + +float rand(vec2 co) +{ + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); +} + +void main() +{ + vec4 color = texture2D(uSampler, vTextureCoord); + float randomValue = rand(gl_FragCoord.xy * uSeed); + float diff = (randomValue - 0.5) * uNoise; + + // Un-premultiply alpha before applying the color matrix. See issue #3539. + if (color.a > 0.0) { + color.rgb /= color.a; + } + + color.r += diff; + color.g += diff; + color.b += diff; + + // Premultiply alpha again. + color.rgb *= color.a; + + gl_FragColor = color; +} +`;class jh extends Tt{constructor(t=.5,e=Math.random()){super(Mn,kf,{uNoise:0,uSeed:0}),this.noise=t,this.seed=e}get noise(){return this.uniforms.uNoise}set noise(t){this.uniforms.uNoise=t}get seed(){return this.uniforms.uSeed}set seed(t){this.uniforms.uSeed=t}}const Yn={AlphaFilter:Gh,BlurFilter:$h,BlurFilterPass:Qi,ColorMatrixFilter:Ji,DisplacementFilter:Hh,FXAAFilter:Vh,NoiseFilter:jh};Object.entries(Yn).forEach(([i,t])=>{Object.defineProperty(Yn,i,{get(){return ro("7.1.0",`filters.${i} has moved to ${i}`),t}})});let Gf=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this.tickerAdded||!this.domElement||(xt.system.add(this.tickerUpdate,this,pe.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(xt.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events.rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY}))}tickerUpdate(t){this._deltaTime+=t,!(this._deltaTimes.priority-r.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let s=0,r=e.length;s=0;r--)if(t.currentTarget=s[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,s=this._allInteractiveElements){if(s.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const r=Array.isArray(e)?e:[e];for(let n=s.length-1;n>=0;n--)r.forEach(a=>{t.currentTarget=s[n],this.notifyTarget(t,a)})}propagationPath(t){const e=[t];for(let s=0;s<$f&&t!==this.rootTarget;s++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}hitTestMoveRecursive(t,e,s,r,n,a=!1){let o=!1;if(this._interactivePrune(t))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(we.pauseUpdate=!1),t.interactiveChildren&&t.children){const u=t.children;for(let c=u.length-1;c>=0;c--){const d=u[c],f=this.hitTestMoveRecursive(d,this._isInteractive(e)?e:d.eventMode,s,r,n,a||n(t,s));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=t.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),o=!0}}}const h=this._isInteractive(e),l=t.isInteractive();return l&&l&&this._allInteractiveElements.push(t),a||this._hitElements.length>0?null:o?this._hitElements:h&&!n(t,s)&&r(t,s)?l?[t]:[]:null}hitTestRecursive(t,e,s,r,n){if(this._interactivePrune(t)||n(t,s))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(we.pauseUpdate=!1),t.interactiveChildren&&t.children){const h=t.children;for(let l=h.length-1;l>=0;l--){const u=h[l],c=this.hitTestRecursive(u,this._isInteractive(e)?e:u.eventMode,s,r,n);if(c){if(c.length>0&&!c[c.length-1].parent)continue;const d=t.isInteractive();return(c.length>0||d)&&c.push(t),c}}}const a=this._isInteractive(e),o=t.isInteractive();return a&&r(t,s)?o?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!!(!t||t.isMask||!t.visible||!t.renderable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren||t.isMask)}hitPruneFn(t,e){var s;if(t.hitArea&&(t.worldTransform.applyInverse(e,qn),!t.hitArea.contains(qn.x,qn.y)))return!0;if(t._mask){const r=t._mask.isMaskData?t._mask.maskObject:t._mask;if(r&&!((s=r.containsPoint)!=null&&s.call(r,e)))return!0}return!1}hitTestFn(t,e){return t.eventMode==="passive"?!1:t.hitArea?!0:t.containsPoint?t.containsPoint(e):!1}notifyTarget(t,e){var s,r;e=e!=null?e:t.type;const n=`on${e}`;(r=(s=t.currentTarget)[n])==null||r.call(s,t);const a=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,a),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}mapPointerDown(t){if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.createPointerEvent(t);if(this.dispatchEvent(e,"pointerdown"),e.pointerType==="touch")this.dispatchEvent(e,"touchstart");else if(e.pointerType==="mouse"||e.pointerType==="pen"){const r=e.button===2;this.dispatchEvent(e,r?"rightdown":"mousedown")}const s=this.trackingData(t.pointerId);s.pressTargetsByButton[t.button]=e.composedPath(),this.freeEvent(e)}mapPointerMove(t){var e,s,r;if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const n=this.createPointerEvent(t);this._isPointerMoveEvent=!1;const a=n.pointerType==="mouse"||n.pointerType==="pen",o=this.trackingData(t.pointerId),h=this.findMountedTarget(o.overTargets);if(((e=o.overTargets)==null?void 0:e.length)>0&&h!==n.target){const c=t.type==="mousemove"?"mouseout":"pointerout",d=this.createPointerEvent(t,c,h);if(this.dispatchEvent(d,"pointerout"),a&&this.dispatchEvent(d,"mouseout"),!n.composedPath().includes(h)){const f=this.createPointerEvent(t,"pointerleave",h);for(f.eventPhase=f.AT_TARGET;f.target&&!n.composedPath().includes(f.target);)f.currentTarget=f.target,this.notifyTarget(f),a&&this.notifyTarget(f,"mouseleave"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(d)}if(h!==n.target){const c=t.type==="mousemove"?"mouseover":"pointerover",d=this.clonePointerEvent(n,c);this.dispatchEvent(d,"pointerover"),a&&this.dispatchEvent(d,"mouseover");let f=h==null?void 0:h.parent;for(;f&&f!==this.rootTarget.parent&&f!==n.target;)f=f.parent;if(!f||f===this.rootTarget.parent){const p=this.clonePointerEvent(n,"pointerenter");for(p.eventPhase=p.AT_TARGET;p.target&&p.target!==h&&p.target!==this.rootTarget.parent;)p.currentTarget=p.target,this.notifyTarget(p),a&&this.notifyTarget(p,"mouseenter"),p.target=p.target.parent;this.freeEvent(p)}this.freeEvent(d)}const l=[],u=(s=this.enableGlobalMoveEvents)!=null?s:!0;this.moveOnAll?l.push("pointermove"):this.dispatchEvent(n,"pointermove"),u&&l.push("globalpointermove"),n.pointerType==="touch"&&(this.moveOnAll?l.splice(1,0,"touchmove"):this.dispatchEvent(n,"touchmove"),u&&l.push("globaltouchmove")),a&&(this.moveOnAll?l.splice(1,0,"mousemove"):this.dispatchEvent(n,"mousemove"),u&&l.push("globalmousemove"),this.cursor=(r=n.target)==null?void 0:r.cursor),l.length>0&&this.all(n,l),this._allInteractiveElements.length=0,this._hitElements.length=0,o.overTargets=n.composedPath(),this.freeEvent(n)}mapPointerOver(t){var e;if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const s=this.trackingData(t.pointerId),r=this.createPointerEvent(t),n=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),n&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=(e=r.target)==null?void 0:e.cursor);const a=this.clonePointerEvent(r,"pointerenter");for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),n&&this.notifyTarget(a,"mouseenter"),a.target=a.target.parent;s.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(a)}mapPointerOut(t){if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId);if(e.overTargets){const s=t.pointerType==="mouse"||t.pointerType==="pen",r=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",r);this.dispatchEvent(n),s&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(t,"pointerleave",r);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),s&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(a)}this.cursor=null}mapPointerUp(t){if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=performance.now(),s=this.createPointerEvent(t);if(this.dispatchEvent(s,"pointerup"),s.pointerType==="touch")this.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const o=s.button===2;this.dispatchEvent(s,o?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),n=this.findMountedTarget(r.pressTargetsByButton[t.button]);let a=n;if(n&&!s.composedPath().includes(n)){let o=n;for(;o&&!s.composedPath().includes(o);){if(s.currentTarget=o,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")this.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const h=s.button===2;this.notifyTarget(s,h?"rightupoutside":"mouseupoutside")}o=o.parent}delete r.pressTargetsByButton[t.button],a=o}if(a){const o=this.clonePointerEvent(s,"click");o.target=a,o.path=null,r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:o.target,timeStamp:e});const h=r.clicksByButton[t.button];if(h.target===o.target&&e-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=o.target,h.timeStamp=e,o.detail=h.clickCount,o.pointerType==="mouse"){const l=o.button===2;this.dispatchEvent(o,l?"rightclick":"click")}else o.pointerType==="touch"&&this.dispatchEvent(o,"tap");this.dispatchEvent(o,"pointertap"),this.freeEvent(o)}this.freeEvent(s)}mapPointerUpOutside(t){if(!(t instanceof kt)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const e=this.trackingData(t.pointerId),s=this.findMountedTarget(e.pressTargetsByButton[t.button]),r=this.createPointerEvent(t);if(s){let n=s;for(;n;)r.currentTarget=n,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch"?this.notifyTarget(r,"touchendoutside"):(r.pointerType==="mouse"||r.pointerType==="pen")&&this.notifyTarget(r,r.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(r)}mapWheel(t){if(!(t instanceof He)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let s=1;st in i?Vf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,zf=(i,t)=>{for(var e in t||(t={}))jf.call(t,e)&&Wh(i,e,t[e]);if(zh)for(var e of zh(t))Xf.call(t,e)&&Wh(i,e,t[e]);return i};const Wf=1,Yf={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Kn=class Ra{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Xh(null),we.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new kt(null),this.rootWheelEvent=new He(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy(zf({},Ra.defaultEventFeatures),{set:(e,s,r)=>(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=r),e[s]=r,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){var e,s;const{view:r,resolution:n}=this.renderer;this.setTargetElement(r),this.resolution=n,Ra._defaultEventMode=(e=t.eventMode)!=null?e:"auto",Object.assign(this.features,(s=t.eventFeatures)!=null?s:{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===t)return;this.currentCursor=t;const s=this.cursorStyles[t];if(s)switch(typeof s){case"string":e&&(this.domElement.style.cursor=s);break;case"function":s(t);break;case"object":e&&Object.assign(this.domElement.style,s);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this.rootPointerEvent}onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let s=0,r=e.length;s0&&(e=t.composedPath()[0]);const s=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(t);for(let n=0,a=r.length;n{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(t=this.renderer.view.parentNode)==null||t.appendChild(this.div))}deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(t=this.div.parentNode)==null||t.removeChild(this.div))}updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this.addChild(t),t.renderId=this.renderId);const e=t.children;if(e)for(let s=0;s title : ${t.title}
tabIndex: ${t.tabIndex}`}capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:s}=this.renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>s&&(t.height=s-t.y)}addChild(t){let e=this.pool.pop();e||(e=document.createElement("button"),e.style.width=`${er}px`,e.style.height=`${er}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=Zh.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`displayObject ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{displayObject:s}=t.target,r=this.renderer.events.rootBoundary,n=Object.assign(new Je(r),{target:s});r.rootTarget=this.renderer.lastObjectRendered,e.forEach(a=>r.dispatchEvent(n,a))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===qf&&this.activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}Zn.extension={name:"accessibility",type:[D.RendererPlugin,D.CanvasRendererPlugin]},U.add(Zn);const Jh=class Ia{constructor(t){this.stage=new St,t=Object.assign({forceCanvas:!1},t),this.renderer=Sh(t),Ia._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){var t;return(t=this.renderer)==null?void 0:t.view}get screen(){var t;return(t=this.renderer)==null?void 0:t.screen}destroy(t,e){const s=Ia._plugins.slice(0);s.reverse(),s.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Jh._plugins=[];let tl=Jh;U.handleByList(D.Application,tl._plugins);class Qn{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let e,s;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,s=globalThis.innerHeight;else{const{clientWidth:r,clientHeight:n}=this._resizeTo;e=r,s=n}this.renderer.resize(e,s),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Qn.extension=D.Application,U.add(Qn);const el={loader:D.LoadParser,resolver:D.ResolveParser,cache:D.CacheParser,detection:D.DetectionParser};U.handle(D.Asset,i=>{const t=i.ref;Object.entries(el).filter(([e])=>!!t[e]).forEach(([e,s])=>{var r;return U.add(Object.assign(t[e],{extension:(r=t[e].extension)!=null?r:s}))})},i=>{const t=i.ref;Object.keys(el).filter(e=>!!t[e]).forEach(e=>U.remove(t[e]))});class ep{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let s=0;s(Array.isArray(i)||(i=[i]),t?i.map(e=>typeof e=="string"?t(e):e):i),sr=(i,t)=>{const e=t.split("?")[1];return e&&(i+=`?${e}`),i};function sl(i,t,e,s,r){const n=t[e];for(let a=0;a{const a=n.substring(1,n.length-1).split(",");r.push(a)}),sl(i,r,0,e,s)}else s.push(i);return s}const $s=i=>!Array.isArray(i);let sp=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){return this._cache.get(t)}set(t,e){const s=Gt(t);let r;for(let o=0;o{r[o]=e}));const n=Object.keys(r),a={cacheKeys:n,keys:s};if(s.forEach(o=>{this._cacheMap.set(o,a)}),n.forEach(o=>{this._cache.has(o)&&this._cache.get(o),this._cache.set(o,r[o])}),e instanceof L){const o=e;s.forEach(h=>{o.baseTexture!==L.EMPTY.baseTexture&&X.addToCache(o.baseTexture,h),L.addToCache(o,h)})}}remove(t){if(!this._cacheMap.has(t))return;const e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}};const Se=new sp;var ip=Object.defineProperty,rp=Object.defineProperties,np=Object.getOwnPropertyDescriptors,rl=Object.getOwnPropertySymbols,ap=Object.prototype.hasOwnProperty,op=Object.prototype.propertyIsEnumerable,nl=(i,t,e)=>t in i?ip(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,hp=(i,t)=>{for(var e in t||(t={}))ap.call(t,e)&&nl(i,e,t[e]);if(rl)for(var e of rl(t))op.call(t,e)&&nl(i,e,t[e]);return i},lp=(i,t)=>rp(i,np(t));class up{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,s)=>(this._parsersValidated=!1,t[e]=s,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const s={promise:null,parser:null};return s.promise=(async()=>{var r,n;let a=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser]),!o){for(let h=0;h({alias:[l],src:l})),o=a.length,h=a.map(async l=>{const u=bt.toAbsolute(l.src);if(!r[l.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,l)),r[l.src]=await this.promiseCache[u].promise,e&&e(++s/o)}catch(c){throw delete this.promiseCache[u],delete r[l.src],new Error(`[Loader.load] Failed to load ${u}. +${c}`)}});return await Promise.all(h),n?r[a[0].src]:r}async unload(t){const e=Gt(t,s=>({alias:[s],src:s})).map(async s=>{var r,n;const a=bt.toAbsolute(s.src),o=this.promiseCache[a];if(o){const h=await o.promise;delete this.promiseCache[a],(n=(r=o.parser)==null?void 0:r.unload)==null||n.call(r,h,s,this)}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(t[e.name],lp(hp({},t),{[e.name]:e})),{})}}var $t=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))($t||{});const cp=".json",dp="application/json",al={extension:{type:D.LoadParser,priority:$t.Low},name:"loadJson",test(i){return Ve(i,dp)||_e(i,cp)},async load(i){return await(await N.ADAPTER.fetch(i)).json()}};U.add(al);const fp=".txt",pp="text/plain",ol={name:"loadTxt",extension:{type:D.LoadParser,priority:$t.Low},test(i){return Ve(i,pp)||_e(i,fp)},async load(i){return await(await N.ADAPTER.fetch(i)).text()}};U.add(ol);var mp=Object.defineProperty,gp=Object.defineProperties,_p=Object.getOwnPropertyDescriptors,hl=Object.getOwnPropertySymbols,vp=Object.prototype.hasOwnProperty,yp=Object.prototype.propertyIsEnumerable,ll=(i,t,e)=>t in i?mp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,xp=(i,t)=>{for(var e in t||(t={}))vp.call(t,e)&&ll(i,e,t[e]);if(hl)for(var e of hl(t))yp.call(t,e)&&ll(i,e,t[e]);return i},bp=(i,t)=>gp(i,_p(t));const Tp=["normal","bold","100","200","300","400","500","600","700","800","900"],Ep=[".ttf",".otf",".woff",".woff2"],Ap=["font/ttf","font/otf","font/woff","font/woff2"],wp=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function ul(i){const t=bt.extname(i),e=bt.basename(i,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let s=e.length>0;for(const n of e)if(!n.match(wp)){s=!1;break}let r=e.join(" ");return s||(r=`"${r.replace(/[\\"]/g,"\\$&")}"`),r}const cl={extension:{type:D.LoadParser,priority:$t.Low},name:"loadWebFont",test(i){return Ve(i,Ap)||_e(i,Ep)},async load(i,t){var e,s,r,n,a,o;const h=N.ADAPTER.getFontFaceSet();if(h){const l=[],u=(s=(e=t.data)==null?void 0:e.family)!=null?s:ul(i),c=(a=(n=(r=t.data)==null?void 0:r.weights)==null?void 0:n.filter(f=>Tp.includes(f)))!=null?a:["normal"],d=(o=t.data)!=null?o:{};for(let f=0;fN.ADAPTER.getFontFaceSet().delete(t))}};U.add(cl);let dl=0,Jn;const Sp="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",Cp={id:"checkImageBitmap",code:` + async function checkImageBitmap() + { + try + { + if (typeof createImageBitmap !== 'function') return false; + + const response = await fetch('${Sp}'); + const imageBlob = await response.blob(); + const imageBitmap = await createImageBitmap(imageBlob); + + return imageBitmap.width === 1 && imageBitmap.height === 1; + } + catch (e) + { + return false; + } + } + checkImageBitmap().then((result) => { self.postMessage(result); }); + `},Rp={id:"loadImageBitmap",code:` + async function loadImageBitmap(url) + { + const response = await fetch(url); + + if (!response.ok) + { + throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \` + + \`\${response.status} \${response.statusText}\`); + } + + const imageBlob = await response.blob(); + const imageBitmap = await createImageBitmap(imageBlob); + + return imageBitmap; + } + self.onmessage = async (event) => + { + try + { + const imageBitmap = await loadImageBitmap(event.data.data[0]); + + self.postMessage({ + data: imageBitmap, + uuid: event.data.uuid, + id: event.data.id, + }, [imageBitmap]); + } + catch(e) + { + self.postMessage({ + error: e, + uuid: event.data.uuid, + id: event.data.id, + }); + } + };`};let ta,Ip=class{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const e=URL.createObjectURL(new Blob([Cp.code],{type:"application/javascript"})),s=new Worker(e);s.addEventListener("message",r=>{s.terminate(),URL.revokeObjectURL(e),t(r.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t){return this._run("loadImageBitmap",[t])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){Jn===void 0&&(Jn=navigator.hardwareConcurrency||4);let t=this.workerPool.pop();return!t&&this._createdWorkers{this.complete(e.data),this.returnWorker(e.target),this.next()})),t}returnWorker(t){this.workerPool.push(t)}complete(t){t.error!==void 0?this.resolveHash[t.uuid].reject(t.error):this.resolveHash[t.uuid].resolve(t.data),this.resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const s=new Promise((r,n)=>{this.queue.push({id:t,arguments:e,resolve:r,reject:n})});return this.next(),s}next(){if(!this.queue.length)return;const t=this.getWorker();if(!t)return;const e=this.queue.pop(),s=e.id;this.resolveHash[dl]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:dl++,id:s})}};const fl=new Ip;function ts(i,t,e){i.resource.internal=!0;const s=new L(i),r=()=>{delete t.promiseCache[e],Se.has(e)&&Se.remove(e)};return s.baseTexture.once("destroyed",()=>{e in t.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),r())}),s.once("destroyed",()=>{i.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),r())}),s}var Pp=Object.defineProperty,pl=Object.getOwnPropertySymbols,Mp=Object.prototype.hasOwnProperty,Dp=Object.prototype.propertyIsEnumerable,ml=(i,t,e)=>t in i?Pp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,gl=(i,t)=>{for(var e in t||(t={}))Mp.call(t,e)&&ml(i,e,t[e]);if(pl)for(var e of pl(t))Dp.call(t,e)&&ml(i,e,t[e]);return i};const Op=[".jpeg",".jpg",".png",".webp",".avif"],Bp=["image/jpeg","image/png","image/webp","image/avif"];async function _l(i){const t=await N.ADAPTER.fetch(i);if(!t.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${t.status} ${t.statusText}`);const e=await t.blob();return await createImageBitmap(e)}const Hs={name:"loadTextures",extension:{type:D.LoadParser,priority:$t.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return Ve(i,Bp)||_e(i,Op)},async load(i,t,e){var s,r;const n=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let a;n?this.config.preferWorkers&&await fl.isImageBitmapSupported()?a=await fl.loadImageBitmap(i):a=await _l(i):a=await new Promise((l,u)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=i,c.complete?l(c):(c.onload=()=>l(c),c.onerror=d=>u(d))});const o=gl({},t.data);(s=o.resolution)!=null||(o.resolution=te(i)),n&&((r=o.resourceOptions)==null?void 0:r.ownsImageBitmap)===void 0&&(o.resourceOptions=gl({},o.resourceOptions),o.resourceOptions.ownsImageBitmap=!0);const h=new X(a,o);return h.resource.src=i,ts(h,e,i)},unload(i){i.destroy(!0)}};U.add(Hs);var Fp=Object.defineProperty,vl=Object.getOwnPropertySymbols,Np=Object.prototype.hasOwnProperty,Lp=Object.prototype.propertyIsEnumerable,yl=(i,t,e)=>t in i?Fp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Up=(i,t)=>{for(var e in t||(t={}))Np.call(t,e)&&yl(i,e,t[e]);if(vl)for(var e of vl(t))Lp.call(t,e)&&yl(i,e,t[e]);return i};const kp=".svg",Gp="image/svg+xml",xl={extension:{type:D.LoadParser,priority:$t.High},name:"loadSVG",test(i){return Ve(i,Gp)||_e(i,kp)},async testParse(i){return Xi.test(i)},async parse(i,t,e){var s;const r=new Xi(i,(s=t==null?void 0:t.data)==null?void 0:s.resourceOptions);await r.load();const n=new X(r,Up({resolution:te(i)},t==null?void 0:t.data));return n.resource.src=t.src,ts(n,e,t.src)},async load(i,t){return(await N.ADAPTER.fetch(i)).text()},unload:Hs.unload};U.add(xl);var $p=Object.defineProperty,bl=Object.getOwnPropertySymbols,Hp=Object.prototype.hasOwnProperty,Vp=Object.prototype.propertyIsEnumerable,Tl=(i,t,e)=>t in i?$p(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,El=(i,t)=>{for(var e in t||(t={}))Hp.call(t,e)&&Tl(i,e,t[e]);if(bl)for(var e of bl(t))Vp.call(t,e)&&Tl(i,e,t[e]);return i};const jp=[".mp4",".m4v",".webm",".ogv"],Xp=["video/mp4","video/webm","video/ogg"],Al={name:"loadVideo",extension:{type:D.LoadParser,priority:$t.High},config:{defaultAutoPlay:!0},test(i){return Ve(i,Xp)||_e(i,jp)},async load(i,t,e){var s;let r;const n=await(await N.ADAPTER.fetch(i)).blob(),a=URL.createObjectURL(n);try{const o=El({autoPlay:this.config.defaultAutoPlay},(s=t==null?void 0:t.data)==null?void 0:s.resourceOptions),h=new kn(a,o);await h.load();const l=new X(h,El({alphaMode:await no(),resolution:te(i)},t==null?void 0:t.data));l.resource.src=i,r=ts(l,e,i),r.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(a)})}catch(o){throw URL.revokeObjectURL(a),o}return r},unload(i){i.destroy(!0)}};U.add(Al);var zp=Object.defineProperty,Wp=Object.defineProperties,Yp=Object.getOwnPropertyDescriptors,wl=Object.getOwnPropertySymbols,qp=Object.prototype.hasOwnProperty,Kp=Object.prototype.propertyIsEnumerable,Sl=(i,t,e)=>t in i?zp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,es=(i,t)=>{for(var e in t||(t={}))qp.call(t,e)&&Sl(i,e,t[e]);if(wl)for(var e of wl(t))Kp.call(t,e)&&Sl(i,e,t[e]);return i},Cl=(i,t)=>Wp(i,Yp(t));class Zp{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){var e,s,r;if(this._bundleIdConnector=(e=t.connector)!=null?e:this._bundleIdConnector,this._createBundleAssetId=(s=t.createBundleAssetId)!=null?s:this._createBundleAssetId,this._extractAssetIdFromBundle=(r=t.extractAssetIdFromBundle)!=null?r:this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`).join("&")}}addManifest(t){this._manifest,this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];Array.isArray(e)?e.forEach(r=>{var n,a;const o=(n=r.src)!=null?n:r.srcs,h=(a=r.alias)!=null?a:r.name;let l;if(typeof h=="string"){const u=this._createBundleAssetId(t,h);s.push(u),l=[h,u]}else{const u=h.map(c=>this._createBundleAssetId(t,c));s.push(...u),l=[...h,...u]}this.add(Cl(es({},r),{alias:l,src:o}))}):Object.keys(e).forEach(r=>{var n;const a=[r,this._createBundleAssetId(t,r)];if(typeof e[r]=="string")this.add({alias:a,src:e[r]});else if(Array.isArray(e[r]))this.add({alias:a,src:e[r]});else{const o=e[r],h=(n=o.src)!=null?n:o.srcs;this.add(Cl(es({},o),{alias:a,src:Array.isArray(h)?h:[h]}))}s.push(...a)}),this._bundles[t]=s}add(t,e,s,r,n){const a=[];typeof t=="string"||Array.isArray(t)&&typeof t[0]=="string"?a.push({alias:t,src:e,data:s,format:r,loadParser:n}):Array.isArray(t)?a.push(...t):a.push(t);let o;Gt(a).forEach(h=>{const{alias:l,name:u,src:c,srcs:d}=h;let{data:f,format:p,loadParser:m}=h;const g=Gt(c||d).map(v=>typeof v=="string"?il(v):Array.isArray(v)?v:[v]),_=Gt(l||u),x=[];g.forEach(v=>{v.forEach(b=>{var T,R,w;let A={};if(typeof b!="object"){A.src=b;for(let S=0;S{this._assetMap[v]=x})})}resolveBundle(t){const e=$s(t);t=Gt(t);const s={};return t.forEach(r=>{const n=this._bundles[r];if(n){const a=this.resolve(n),o={};for(const h in a){const l=a[h];o[this._extractAssetIdFromBundle(r,h)]=l}s[r]=o}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const r in e)s[r]=e[r].src;return s}return e.src}resolve(t){const e=$s(t);t=Gt(t);const s={};return t.forEach(r=>{var n;if(!this._resolverHash[r])if(this._assetMap[r]){let a=this._assetMap[r];const o=a[0],h=this._getPreferredOrder(a);h==null||h.priority.forEach(l=>{h.params[l].forEach(u=>{const c=a.filter(d=>d[l]?d[l]===u:!1);c.length&&(a=c)})}),this._resolverHash[r]=(n=a[0])!=null?n:o}else this._resolverHash[r]=this.buildResolvedAsset({alias:[r],src:r},{});s[r]=this._resolverHash[r]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;en.params.format.includes(s.format));if(r)return r}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}buildResolvedAsset(t,e){var s;const{aliases:r,data:n,loadParser:a,format:o}=e;return(this._basePath||this._rootPath)&&(t.src=bt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=(s=r!=null?r:t.alias)!=null?s:[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data=es(es({},n||{}),t.data),t.loadParser=a!=null?a:t.loadParser,t.format=o!=null?o:t.src.split(".").pop(),t.srcs=t.src,t.name=t.alias,t}}class Rl{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Zp,this.loader=new up,this.cache=Se,this._backgroundLoader=new ep(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var e,s,r;if(this._initialized)return;if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let h=t.manifest;typeof h=="string"&&(h=await this.load(h)),this.resolver.addManifest(h)}const n=(s=(e=t.texturePreference)==null?void 0:e.resolution)!=null?s:1,a=typeof n=="number"?[n]:n,o=await this._detectFormats({preferredFormats:(r=t.texturePreference)==null?void 0:r.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:o,resolution:a}}),t.preferences&&this.setPreferences(t.preferences)}add(t,e,s,r,n){this.resolver.add(t,e,s,r,n)}async load(t,e){this._initialized||await this.init();const s=$s(t),r=Gt(t).map(o=>{if(typeof o!="string"){this.add(o);const h=o.src||o.srcs,l=o.alias||o.name;return l&&Array.isArray(l)?l[0]:h&&Array.isArray(h)?h[0]:l||h}return this.resolver.hasKey(o)||this.add({alias:o,src:o}),o}),n=this.resolver.resolve(r),a=await this._mapLoadToResolve(n,e);return s?a[r[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let s=!1;typeof t=="string"&&(s=!0,t=[t]);const r=this.resolver.resolveBundle(t),n={},a=Object.keys(r);let o=0,h=0;const l=()=>{e==null||e(++o/h)},u=a.map(c=>{const d=r[c];return h+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(f=>{n[c]=f})});return await Promise.all(u),s?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(s=>{this._backgroundLoader.add(Object.values(s))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return Se.get(t);const e={};for(let s=0;s{const l=n[o.src],u=[o.src];o.alias&&u.push(...o.alias),a[r[h]]=l,Se.set(u,l)}),a}async unload(t){this._initialized||await this.init();const e=Gt(t).map(r=>typeof r!="string"?r.src:r),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=Gt(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(r=>this._unloadFromResolved(e[r]));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(s=>{Se.remove(s.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const s of t.detections)t.skipDetections||await s.test()?e=await s.add(e):t.skipDetections||(e=await s.remove(e));return e=e.filter((s,r)=>e.indexOf(s)===r),e}get detections(){return this._detections}get preferWorkers(){return Hs.config.preferWorkers}set preferWorkers(t){this.setPreferences({preferWorkers:t})}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(s=>s in t).forEach(s=>{e.config[s]=t[s]})})}}const Vs=new Rl;U.handleByList(D.LoadParser,Vs.loader.parsers).handleByList(D.ResolveParser,Vs.resolver.parsers).handleByList(D.CacheParser,Vs.cache.parsers).handleByList(D.DetectionParser,Vs.detections);const Il={extension:D.CacheParser,test:i=>Array.isArray(i)&&i.every(t=>t instanceof L),getCacheableAssets:(i,t)=>{const e={};return i.forEach(s=>{t.forEach((r,n)=>{e[s+(n===0?"":n+1)]=r})}),e}};U.add(Il);const Pl={extension:{type:D.DetectionParser,priority:1},test:async()=>{const i="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=";return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i})},add:async i=>[...i,"avif"],remove:async i=>i.filter(t=>t!=="avif")};U.add(Pl);const Ml={extension:{type:D.DetectionParser,priority:0},test:async()=>{const i="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=";return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=i})},add:async i=>[...i,"webp"],remove:async i=>i.filter(t=>t!=="webp")};U.add(Ml);const Dl=["png","jpg","jpeg"],Ol={extension:{type:D.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...Dl],remove:async i=>i.filter(t=>!Dl.includes(t))};U.add(Ol);const Qp="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function ea(i){return Qp?!1:document.createElement("video").canPlayType(i)!==""}const Bl={extension:{type:D.DetectionParser,priority:0},test:async()=>ea("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(t=>t!=="webm")};U.add(Bl);const Fl={extension:{type:D.DetectionParser,priority:0},test:async()=>ea("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(t=>t!=="mp4"&&t!=="m4v")};U.add(Fl);const Nl={extension:{type:D.DetectionParser,priority:0},test:async()=>ea("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(t=>t!=="ogv")};U.add(Nl);const Ll={extension:D.ResolveParser,test:Hs.test,parse:i=>{var t,e;return{resolution:parseFloat((e=(t=N.RETINA_PREFIX.exec(i))==null?void 0:t[1])!=null?e:"1"),format:i.split(".").pop(),src:i}}};U.add(Ll);var Ct=(i=>(i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",i))(Ct||{});const js={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35986:1,34798:1,37808:1};let ve,ss;function Ul(){ss={s3tc:ve.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:ve.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:ve.getExtension("WEBGL_compressed_texture_etc"),etc1:ve.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:ve.getExtension("WEBGL_compressed_texture_pvrtc")||ve.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:ve.getExtension("WEBGL_compressed_texture_atc"),astc:ve.getExtension("WEBGL_compressed_texture_astc")}}const kl={extension:{type:D.DetectionParser,priority:2},test:async()=>{const i=N.ADAPTER.createCanvas().getContext("webgl");return i?(ve=i,!0):!1},add:async i=>{ss||Ul();const t=[];for(const e in ss)ss[e]&&t.push(e);return[...t,...i]},remove:async i=>(ss||Ul(),i.filter(t=>!(t in ss)))};U.add(kl);class Gl extends xs{constructor(t,e={width:1,height:1,autoLoad:!0}){let s,r;typeof t=="string"?(s=t,r=new Uint8Array):(s=null,r=t),super(r,e),this.origin=s,this.buffer=r?new Ti(r):null,this._load=null,this.loaded=!1,this.origin!==null&&e.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(t){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(t=>t.blob()).then(t=>t.arrayBuffer()).then(t=>(this.data=new Uint32Array(t),this.buffer=new Ti(t),this.loaded=!0,this.onBlobLoaded(t),this.update(),this)),this._load)}}class Ce extends Gl{constructor(t,e){super(t,e),this.format=e.format,this.levels=e.levels||1,this._width=e.width,this._height=e.height,this._extension=Ce._formatToExtension(this.format),(e.levelBuffers||this.buffer)&&(this._levelBuffers=e.levelBuffers||Ce._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(t,e,s){const r=t.gl;if(!t.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;r.pixelStorei(r.UNPACK_ALIGNMENT,4);for(let n=0,a=this.levels;n=33776&&t<=33779)return"s3tc";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")}static _createLevelBuffers(t,e,s,r,n,a,o){const h=new Array(s);let l=t.byteOffset,u=a,c=o,d=u+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*js[e];for(let m=0;m1?u:d,levelHeight:s>1?c:f,levelBuffer:new Uint8Array(t.buffer,l,p)},l+=p,u=u>>1||1,c=c>>1||1,d=u+r-1&~(r-1),f=c+n-1&~(n-1),p=d*f*js[e];return h}}const sa=4,ir=124,Jp=32,$l=20,tm=542327876,rr={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},em={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},nr={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},sm=1,im=2,rm=4,nm=64,am=512,om=131072,hm=827611204,lm=861165636,um=894720068,cm=808540228,dm=4,fm={[hm]:Ct.COMPRESSED_RGBA_S3TC_DXT1_EXT,[lm]:Ct.COMPRESSED_RGBA_S3TC_DXT3_EXT,[um]:Ct.COMPRESSED_RGBA_S3TC_DXT5_EXT},pm={70:Ct.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Ct.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Ct.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Ct.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Ct.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Ct.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Ct.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Ct.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Ct.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function Hl(i){const t=new Uint32Array(i);if(t[0]!==tm)throw new Error("Invalid DDS file magic word");const e=new Uint32Array(i,0,ir/Uint32Array.BYTES_PER_ELEMENT),s=e[rr.HEIGHT],r=e[rr.WIDTH],n=e[rr.MIPMAP_COUNT],a=new Uint32Array(i,rr.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,Jp/Uint32Array.BYTES_PER_ELEMENT),o=a[sm];if(o&rm){const h=a[em.FOURCC];if(h!==cm){const x=fm[h],v=sa+ir,b=new Uint8Array(i,v);return[new Ce(b,{format:x,width:r,height:s,levels:n})]}const l=sa+ir,u=new Uint32Array(t.buffer,l,$l/Uint32Array.BYTES_PER_ELEMENT),c=u[nr.DXGI_FORMAT],d=u[nr.RESOURCE_DIMENSION],f=u[nr.MISC_FLAG],p=u[nr.ARRAY_SIZE],m=pm[c];if(m===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(f===dm)throw new Error("DDSParser does not support cubemap textures");if(d===6)throw new Error("DDSParser does not supported 3D texture data");const g=new Array,_=sa+ir+$l;if(p===1)g.push(new Uint8Array(i,_));else{const x=js[m];let v=0,b=r,T=s;for(let w=0;w>>1,T=T>>>1}let R=_;for(let w=0;wnew Ce(x,{format:m,width:r,height:s,levels:n}))}throw o&nm?new Error("DDSParser does not support uncompressed texture data."):o&am?new Error("DDSParser does not supported YUV uncompressed texture data."):o&om?new Error("DDSParser does not support single-channel (lumninance) texture data!"):o&im?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const Vl=[171,75,84,88,32,49,49,187,13,10,26,10],mm=67305985,qt={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},ia=64,ra={[$.UNSIGNED_BYTE]:1,[$.UNSIGNED_SHORT]:2,[$.INT]:4,[$.UNSIGNED_INT]:4,[$.FLOAT]:4,[$.HALF_FLOAT]:8},jl={[M.RGBA]:4,[M.RGB]:3,[M.RG]:2,[M.RED]:1,[M.LUMINANCE]:1,[M.LUMINANCE_ALPHA]:2,[M.ALPHA]:1},Xl={[$.UNSIGNED_SHORT_4_4_4_4]:2,[$.UNSIGNED_SHORT_5_5_5_1]:2,[$.UNSIGNED_SHORT_5_6_5]:2};function zl(i,t,e=!1){const s=new DataView(t);if(!gm(i,s))return null;const r=s.getUint32(qt.ENDIANNESS,!0)===mm,n=s.getUint32(qt.GL_TYPE,r),a=s.getUint32(qt.GL_FORMAT,r),o=s.getUint32(qt.GL_INTERNAL_FORMAT,r),h=s.getUint32(qt.PIXEL_WIDTH,r),l=s.getUint32(qt.PIXEL_HEIGHT,r)||1,u=s.getUint32(qt.PIXEL_DEPTH,r)||1,c=s.getUint32(qt.NUMBER_OF_ARRAY_ELEMENTS,r)||1,d=s.getUint32(qt.NUMBER_OF_FACES,r),f=s.getUint32(qt.NUMBER_OF_MIPMAP_LEVELS,r),p=s.getUint32(qt.BYTES_OF_KEY_VALUE_DATA,r);if(l===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(c!==1)throw new Error("WebGL does not support array textures");const m=4,g=4,_=h+3&-4,x=l+3&-4,v=new Array(c);let b=h*l;n===0&&(b=_*x);let T;if(n!==0?ra[n]?T=ra[n]*jl[a]:T=Xl[n]:T=js[o],T===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const R=e?vm(s,p,r):null;let w=b*T,A=h,S=l,I=_,H=x,B=ia+p;for(let E=0;E1||n!==0?A:I,levelHeight:f>1||n!==0?S:H,levelBuffer:new Uint8Array(t,V,w)},V+=w}B+=P+4,B=B%4!==0?B+4-B%4:B,A=A>>1||1,S=S>>1||1,I=A+m-1&~(m-1),H=S+g-1&~(g-1),w=I*H*T}return n!==0?{uncompressed:v.map(E=>{let P=E[0].levelBuffer,V=!1;return n===$.FLOAT?P=new Float32Array(E[0].levelBuffer.buffer,E[0].levelBuffer.byteOffset,E[0].levelBuffer.byteLength/4):n===$.UNSIGNED_INT?(V=!0,P=new Uint32Array(E[0].levelBuffer.buffer,E[0].levelBuffer.byteOffset,E[0].levelBuffer.byteLength/4)):n===$.INT&&(V=!0,P=new Int32Array(E[0].levelBuffer.buffer,E[0].levelBuffer.byteOffset,E[0].levelBuffer.byteLength/4)),{resource:new xs(P,{width:E[0].levelWidth,height:E[0].levelHeight}),type:n,format:V?_m(a):a}}),kvData:R}:{compressed:v.map(E=>new Ce(null,{format:o,width:h,height:l,levels:f,levelBuffers:E})),kvData:R}}function gm(i,t){for(let e=0;et-r){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;ht in i?ym(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Tm=(i,t)=>{for(var e in t||(t={}))xm.call(t,e)&&Yl(i,e,t[e]);if(Wl)for(var e of Wl(t))bm.call(t,e)&&Yl(i,e,t[e]);return i};const ql={extension:{type:D.LoadParser,priority:$t.High},name:"loadDDS",test(i){return _e(i,".dds")},async load(i,t,e){const s=await(await N.ADAPTER.fetch(i)).arrayBuffer(),r=Hl(s).map(n=>{const a=new X(n,Tm({mipmap:Ht.OFF,alphaMode:At.NO_PREMULTIPLIED_ALPHA,resolution:te(i)},t.data));return ts(a,e,i)});return r.length===1?r[0]:r},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};U.add(ql);var Em=Object.defineProperty,Kl=Object.getOwnPropertySymbols,Am=Object.prototype.hasOwnProperty,wm=Object.prototype.propertyIsEnumerable,Zl=(i,t,e)=>t in i?Em(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Sm=(i,t)=>{for(var e in t||(t={}))Am.call(t,e)&&Zl(i,e,t[e]);if(Kl)for(var e of Kl(t))wm.call(t,e)&&Zl(i,e,t[e]);return i};const Ql={extension:{type:D.LoadParser,priority:$t.High},name:"loadKTX",test(i){return _e(i,".ktx")},async load(i,t,e){const s=await(await N.ADAPTER.fetch(i)).arrayBuffer(),{compressed:r,uncompressed:n,kvData:a}=zl(i,s),o=r!=null?r:n,h=Sm({mipmap:Ht.OFF,alphaMode:At.NO_PREMULTIPLIED_ALPHA,resolution:te(i)},t.data),l=o.map(u=>{var c;o===n&&Object.assign(h,{type:u.type,format:u.format});const d=(c=u.resource)!=null?c:u,f=new X(d,h);return f.ktxKeyValueData=a,ts(f,e,i)});return l.length===1?l[0]:l},unload(i){Array.isArray(i)?i.forEach(t=>t.destroy(!0)):i.destroy(!0)}};U.add(Ql);const Jl={extension:D.ResolveParser,test:i=>{const t=i.split("?")[0].split(".").pop();return["basis","ktx","dds"].includes(t)},parse:i=>{var t,e,s,r;if(i.split("?")[0].split(".").pop()==="ktx"){const n=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(n.some(a=>i.endsWith(a)))return{resolution:parseFloat((e=(t=N.RETINA_PREFIX.exec(i))==null?void 0:t[1])!=null?e:"1"),format:n.find(a=>i.endsWith(a)),src:i}}return{resolution:parseFloat((r=(s=N.RETINA_PREFIX.exec(i))==null?void 0:s[1])!=null?r:"1"),format:i.split(".").pop(),src:i}}};U.add(Jl);const ar=new z,Cm=4,tu=class oi{constructor(t){this.renderer=t,this._rendererPremultipliedAlpha=!1}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}async image(t,e,s,r){const n=new Image;return n.src=await this.base64(t,e,s,r),n}async base64(t,e,s,r){const n=this.canvas(t,r);if(n.toBlob!==void 0)return new Promise((a,o)=>{n.toBlob(h=>{if(!h){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(h)},e,s)});if(n.toDataURL!==void 0)return n.toDataURL(e,s);if(n.convertToBlob!==void 0){const a=await n.convertToBlob({type:e,quality:s});return new Promise((o,h)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=h,l.readAsDataURL(a)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);a&&oi._flipY(s,r,n),o&&oi._unpremultiplyAlpha(s);const h=new ys(r,n,1),l=new ImageData(new Uint8ClampedArray(s.buffer),r,n);return h.context.putImageData(l,0,0),h.canvas}pixels(t,e){const{pixels:s,width:r,height:n,flipY:a,premultipliedAlpha:o}=this._rawPixels(t,e);return a&&oi._flipY(s,r,n),o&&oi._unpremultiplyAlpha(s),s}_rawPixels(t,e){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let r,n=!1,a=!1,o,h=!1;t&&(t instanceof Yt?o=t:(o=s.generateTexture(t,{region:e,resolution:s.resolution,multisample:s.multisample}),h=!0,e&&(ar.width=e.width,ar.height=e.height,e=ar)));const l=s.gl;if(o){if(r=o.baseTexture.resolution,e=e!=null?e:o.frame,n=!1,a=o.baseTexture.alphaMode>0&&o.baseTexture.format===M.RGBA,!h){s.renderTexture.bind(o);const f=o.framebuffer.glFramebuffers[s.CONTEXT_UID];f.blitFramebuffer&&s.framebuffer.bind(f.blitFramebuffer)}}else r=s.resolution,e||(e=ar,e.width=s.width/r,e.height=s.height/r),n=!0,a=this._rendererPremultipliedAlpha,s.renderTexture.bind();const u=Math.max(Math.round(e.width*r),1),c=Math.max(Math.round(e.height*r),1),d=new Uint8Array(Cm*u*c);return l.readPixels(Math.round(e.x*r),Math.round(e.y*r),u,c,l.RGBA,l.UNSIGNED_BYTE,d),h&&(o==null||o.destroy(!0)),{pixels:d,width:u,height:c,flipY:n,premultipliedAlpha:a}}destroy(){this.renderer=null}static _flipY(t,e,s){const r=e<<2,n=s>>1,a=new Uint8Array(r);for(let o=0;o=0&&o>=0&&r>=0&&n>=0)){t.length=0;return}const h=Math.ceil(2.3*Math.sqrt(a+o)),l=h*8+(r?4:0)+(n?4:0);if(t.length=l,l===0)return;if(h===0){t.length=8,t[0]=t[6]=e+r,t[1]=t[3]=s+n,t[2]=t[4]=e-r,t[5]=t[7]=s-n;return}let u=0,c=h*4+(r?2:0)+2,d=c,f=l;{const p=r+a,m=n,g=e+p,_=e-p,x=s+m;if(t[u++]=g,t[u++]=x,t[--c]=x,t[--c]=_,n){const v=s-m;t[d++]=_,t[d++]=v,t[--f]=v,t[--f]=g}}for(let p=1;p0||t&&s<=0){const r=e/2;for(let n=r+r%2;n=6){su(e,!1);const a=[];for(let l=0;l=0&&n>=0&&a.push(e,s,e+r,s,e+r,s+n,e,s+n)},triangulate(i,t){const e=i.points,s=t.points;if(e.length===0)return;const r=s.length/2;s.push(e[0],e[1],e[2],e[3],e[6],e[7],e[4],e[5]),t.indices.push(r,r+1,r+2,r+1,r+2,r+3)}},ru={build(i){Xs.build(i)},triangulate(i,t){Xs.triangulate(i,t)}};var Mt=(i=>(i.MITER="miter",i.BEVEL="bevel",i.ROUND="round",i))(Mt||{}),ye=(i=>(i.BUTT="butt",i.ROUND="round",i.SQUARE="square",i))(ye||{});const Re={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(i,t=20){if(!this.adaptive||!i||isNaN(i))return t;let e=Math.ceil(i/this.maxLength);return ethis.maxSegments&&(e=this.maxSegments),e}},Rm=Re;class aa{static curveTo(t,e,s,r,n,a){const o=a[a.length-2],h=a[a.length-1]-e,l=o-t,u=r-e,c=s-t,d=Math.abs(h*c-l*u);if(d<1e-8||n===0)return(a[a.length-2]!==t||a[a.length-1]!==e)&&a.push(t,e),null;const f=h*h+l*l,p=u*u+c*c,m=h*u+l*c,g=n*Math.sqrt(f)/d,_=n*Math.sqrt(p)/d,x=g*m/f,v=_*m/p,b=g*c+_*l,T=g*u+_*h,R=l*(_+x),w=h*(_+x),A=c*(g+v),S=u*(g+v),I=Math.atan2(w-T,R-b),H=Math.atan2(S-T,A-b);return{cx:b+t,cy:T+e,radius:n,startAngle:I,endAngle:H,anticlockwise:l*u>c*h}}static arc(t,e,s,r,n,a,o,h,l){const u=o-a,c=Re._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/Ts)*40),d=u/(c*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=c-1,_=g%1/g;for(let x=0;x<=g;++x){const v=x+_*x,b=d+a+f*v,T=Math.cos(b),R=-Math.sin(b);l.push((p*T+m*R)*n+s,(p*-R+m*T)*n+r)}}}class nu{constructor(){this.reset()}begin(t,e,s){this.reset(),this.style=t,this.start=e,this.attribStart=s}end(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class or{static curveLength(t,e,s,r,n,a,o,h){let l=0,u=0,c=0,d=0,f=0,p=0,m=0,g=0,_=0,x=0,v=0,b=t,T=e;for(let R=1;R<=10;++R)u=R/10,c=u*u,d=c*u,f=1-u,p=f*f,m=p*f,g=m*t+3*p*u*s+3*f*c*n+d*o,_=m*e+3*p*u*r+3*f*c*a+d*h,x=b-g,v=T-_,b=g,T=_,l+=Math.sqrt(x*x+v*v);return l}static curveTo(t,e,s,r,n,a,o){const h=o[o.length-2],l=o[o.length-1];o.length-=2;const u=Re._segmentsCount(or.curveLength(h,l,t,e,s,r,n,a));let c=0,d=0,f=0,p=0,m=0;o.push(h,l);for(let g=1,_=0;g<=u;++g)_=g/u,c=1-_,d=c*c,f=d*c,p=_*_,m=p*_,o.push(f*h+3*d*_*t+3*c*p*s+m*n,f*l+3*d*_*e+3*c*p*r+m*a)}}function au(i,t,e,s,r,n,a,o){const h=i-e*r,l=t-s*r,u=i+e*n,c=t+s*n;let d,f;a?(d=s,f=-e):(d=-s,f=e);const p=h+d,m=l+f,g=u+d,_=c+f;return o.push(p,m,g,_),2}function je(i,t,e,s,r,n,a,o){const h=e-i,l=s-t;let u=Math.atan2(h,l),c=Math.atan2(r-i,n-t);o&&uc&&(c+=Math.PI*2);let d=u;const f=c-u,p=Math.abs(f),m=Math.sqrt(h*h+l*l),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,_=f/g;if(d+=_,o){a.push(i,t,e,s);for(let x=1,v=d;x=0&&(n.join===Mt.ROUND?d+=je(v,b,v-w*E,b-A*E,v-S*E,b-I*E,u,!1)+4:d+=2,u.push(v-S*P,b-I*P,v+S*E,b+I*E));continue}const st=(-w+_)*(-A+b)-(-w+v)*(-A+x),et=(-S+T)*(-I+b)-(-S+v)*(-I+R),rt=(W*et-F*st)/Q,lt=(O*st-ht*et)/Q,_t=(rt-v)*(rt-v)+(lt-b)*(lt-b),nt=v+(rt-v)*E,ut=b+(lt-b)*E,mt=v-(rt-v)*P,vt=b-(lt-b)*P,ne=Math.min(W*W+ht*ht,F*F+O*O),ae=J?E:P,ii=ne+ae*ae*m,ug=_t<=ii;let vr=n.join;if(vr===Mt.MITER&&_t/m>g&&(vr=Mt.BEVEL),ug)switch(vr){case Mt.MITER:{u.push(nt,ut,mt,vt);break}case Mt.BEVEL:{J?u.push(nt,ut,v+w*P,b+A*P,nt,ut,v+S*P,b+I*P):u.push(v-w*E,b-A*E,mt,vt,v-S*E,b-I*E,mt,vt),d+=2;break}case Mt.ROUND:{J?(u.push(nt,ut,v+w*P,b+A*P),d+=je(v,b,v+w*P,b+A*P,v+S*P,b+I*P,u,!0)+4,u.push(nt,ut,v+S*P,b+I*P)):(u.push(v-w*E,b-A*E,mt,vt),d+=je(v,b,v-w*E,b-A*E,v-S*E,b-I*E,u,!1)+4,u.push(v-S*E,b-I*E,mt,vt));break}}else{switch(u.push(v-w*E,b-A*E,v+w*P,b+A*P),vr){case Mt.MITER:{J?u.push(mt,vt,mt,vt):u.push(nt,ut,nt,ut),d+=2;break}case Mt.ROUND:{J?d+=je(v,b,v+w*P,b+A*P,v+S*P,b+I*P,u,!0)+2:d+=je(v,b,v-w*E,b-A*E,v-S*E,b-I*E,u,!1)+2;break}}u.push(v-S*E,b-I*E,v+S*P,b+I*P),d+=2}}_=s[(c-2)*2],x=s[(c-2)*2+1],v=s[(c-1)*2],b=s[(c-1)*2+1],w=-(x-b),A=_-v,H=Math.sqrt(w*w+A*A),w/=H,A/=H,w*=p,A*=p,u.push(v-w*E,b-A*E,v+w*P,b+A*P),h||(n.cap===ye.ROUND?d+=je(v-w*(E-P)*.5,b-A*(E-P)*.5,v-w*E,b-A*E,v+w*P,b+A*P,u,!1)+2:n.cap===ye.SQUARE&&(d+=au(v,b,w,A,E,P,!1,u)));const V=t.indices,q=Re.epsilon*Re.epsilon;for(let j=f;j0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(t,e=null,s=null,r=null){const n=new Ws(t,e,s,r);return this.graphicsData.push(n),this.dirty++,this}drawHole(t,e=null){if(!this.graphicsData.length)return null;const s=new Ws(t,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=r.lineStyle,r.holes.push(s),this.dirty++,this}destroy(){super.destroy();for(let t=0;t0&&(s=this.batches[this.batches.length-1],r=s.style);for(let h=this.shapeIndex;h65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&o===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=o?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(t,e){return!(!t||!e||t.texture.baseTexture!==e.texture.baseTexture||t.color+t.alpha!==e.color+e.alpha||!!t.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let t=0,e=this.graphicsData.length;t65535*2)return!1;const t=this.batches;for(let e=0;e0&&(r=zs.pop(),r||(r=new Ai,r.texArray=new Bi),this.drawCalls.push(r)),r.start=u,r.size=0,r.texArray.count=0,r.type=l),m.touched=1,m._batchEnabled=t,m._batchLocation=n,m.wrapMode=Zt.REPEAT,r.texArray.elements[r.texArray.count++]=m,n++)),r.size+=d.size,u+=d.size,o=m._batchLocation,this.addColors(e,p.color,p.alpha,d.attribSize,d.attribStart),this.addTextureIds(s,o,d.attribSize,d.attribStart)}X._globalBatch=t,this.packAttributes()}packAttributes(){const t=this.points,e=this.uvs,s=this.colors,r=this.textureIds,n=new ArrayBuffer(t.length*3*4),a=new Float32Array(n),o=new Uint32Array(n);let h=0;for(let l=0;l0&&t.alpha>0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._lineStyle,{visible:s},t)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Be,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Be,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this}lineTo(t,e){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points,r=s[s.length-2],n=s[s.length-1];return(r!==t||n!==e)&&s.push(t,e),this}_initCurve(t=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[t,e]):this.moveTo(t,e)}quadraticCurveTo(t,e,s,r){this._initCurve();const n=this.currentPath.points;return n.length===0&&this.moveTo(0,0),hr.curveTo(t,e,s,r,n),this}bezierCurveTo(t,e,s,r,n,a){return this._initCurve(),or.curveTo(t,e,s,r,n,a,this.currentPath.points),this}arcTo(t,e,s,r,n){this._initCurve(t,e);const a=this.currentPath.points,o=aa.curveTo(t,e,s,r,n,a);if(o){const{cx:h,cy:l,radius:u,startAngle:c,endAngle:d,anticlockwise:f}=o;this.arc(h,l,u,c,d,f)}return this}arc(t,e,s,r,n,a=!1){if(r===n)return this;if(!a&&n<=r?n+=Ts:a&&r<=n&&(r+=Ts),n-r===0)return this;const o=t+Math.cos(r)*s,h=e+Math.sin(r)*s,l=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const c=Math.abs(u[u.length-2]-o),d=Math.abs(u[u.length-1]-h);c0;return s?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:s},t)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(t,e,s,r){return this.drawShape(new z(t,e,s,r))}drawRoundedRect(t,e,s,r,n){return this.drawShape(new Ri(t,e,s,r,n))}drawCircle(t,e,s){return this.drawShape(new Si(t,e,s))}drawEllipse(t,e,s,r){return this.drawShape(new Ci(t,e,s,r))}drawPolygon(...t){let e,s=!0;const r=t[0];r.points?(s=r.closeStroke,e=r.points):Array.isArray(t[0])?e=t[0]:e=t;const n=new Be(e);return n.closeStroke=s,this.drawShape(n),this}drawShape(t){return this._holeMode?this._geometry.drawHole(t,this._matrix):this._geometry.drawShape(t,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const t=this._geometry.graphicsData;return t.length===1&&t[0].shape.type===it.RECT&&!t[0].matrix&&!t[0].holes.length&&!(t[0].lineStyle.visible&&t[0].lineStyle.width)}_render(t){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(t)):(t.batch.flush(),this._renderDirect(t))}_populateBatches(){const t=this._geometry,e=this.blendMode,s=t.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=t.batchDirty,this.batches.length=s,this.vertexData=new Float32Array(t.points);for(let r=0;r0){const p=h.x-t[d].x,m=h.y-t[d].y,g=Math.sqrt(p*p+m*m);h=t[d],o+=g/l}else o=d/(u-1);n[f]=o,n[f+1]=0,n[f+2]=o,n[f+3]=1}let c=0;for(let d=0;d0?this.textureScale*this._width/2:this._width/2;for(let l=0;l1&&(d=1);const f=Math.sqrt(r*r+n*n);f<1e-6?(r=0,n=0):(r/=f,n/=f,r*=h,n*=h),a[c]=u.x+r,a[c+1]=u.y+n,a[c+2]=u.x-r,a[c+3]=u.y-n,e=u}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}}class pu extends Et{constructor(t,e,s){const r=new du(t.width,t.height,e,s),n=new Xe(L.WHITE);super(r,n),this.texture=t,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;const t=this.geometry,{width:e,height:s}=this.shader.texture;this.autoResize&&(t.width!==e||t.height!==s)&&(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())}set texture(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))}get texture(){return this.shader.texture}_render(t){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),super._render(t)}destroy(t){this.shader.texture.off("update",this.textureUpdated,this),super.destroy(t)}}const cr=10;class Ks extends pu{constructor(t,e,s,r,n){var a,o,h,l,u,c,d,f;super(L.WHITE,4,4),this._origWidth=t.orig.width,this._origHeight=t.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=(o=e!=null?e:(a=t.defaultBorders)==null?void 0:a.left)!=null?o:cr,this._rightWidth=(l=r!=null?r:(h=t.defaultBorders)==null?void 0:h.right)!=null?l:cr,this._topHeight=(c=s!=null?s:(u=t.defaultBorders)==null?void 0:u.top)!=null?c:cr,this._bottomHeight=(f=n!=null?n:(d=t.defaultBorders)==null?void 0:d.bottom)!=null?f:cr,this.texture=t}textureUpdated(){this._textureID=this.shader.texture._updateID,this._refresh()}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}updateHorizontalVertices(){const t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height}updateVerticalVertices(){const t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width}_getMinScale(){const t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,s=this._topHeight+this._bottomHeight,r=this._height>s?1:this._height/s;return Math.min(e,r)}get width(){return this._width}set width(t){this._width=t,this._refresh()}get height(){return this._height}set height(t){this._height=t,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this._refresh()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this._refresh()}_refresh(){const t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;const s=1/this._origWidth,r=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=s*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-s*this._rightWidth,e[9]=e[11]=e[13]=e[15]=r*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class mu extends Et{constructor(t=L.EMPTY,e,s,r,n){const a=new qs(e,s,r);a.getBuffer("aVertexPosition").static=!1;const o=new Xe(t);super(a,o,null,n),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer("aVertexPosition").data}set vertices(t){this.geometry.getBuffer("aVertexPosition").data=t}_render(t){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),super._render(t)}}class gu extends Et{constructor(t,e,s=0){const r=new fu(t.height,e,s),n=new Xe(t);s>0&&(t.baseTexture.wrapMode=Zt.REPEAT),super(r,n),this.autoUpdate=!0}_render(t){const e=this.geometry;(this.autoUpdate||e._width!==this.shader.texture.height)&&(e._width=this.shader.texture.height,e.update()),super._render(t)}}class _u{constructor(t){this.maxItemsPerFrame=t,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-- >0}}function Bm(i,t){var e;let s=!1;if((e=i==null?void 0:i._textures)!=null&&e.length){for(let r=0;r{this.queue&&this.prepareItems()},this.registerFindHook(km),this.registerFindHook(Gm),this.registerFindHook(Bm),this.registerFindHook(Fm),this.registerFindHook(Nm),this.registerUploadHook(Lm),this.registerUploadHook(Um)}upload(t){return new Promise(e=>{t&&this.add(t),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,xt.system.addOnce(this.tick,this,pe.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const t=this.queue[0];let e=!1;if(t&&!t._destroyed){for(let s=0,r=this.uploadHooks.length;s=0;e--)this.add(t.children[e]);return this}destroy(){this.ticking&&xt.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};vu.uploadsPerFrame=4;let Zs=vu;Object.defineProperties(N,{UPLOADS_PER_FRAME:{get(){return Zs.uploadsPerFrame},set(i){Zs.uploadsPerFrame=i}}});function yu(i,t){return t instanceof X?(t._glTextures[i.CONTEXT_UID]||i.texture.bind(t),!0):!1}function $m(i,t){if(!(t instanceof rs))return!1;const{geometry:e}=t;t.finishPoly(),e.updateBatches();const{batches:s}=e;for(let r=0;r=this._durations[this.currentFrame];)r-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=r/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrames)&&this.onLoop(),this.updateTexture())}updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(t){this.stop(),super.destroy(t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let s=0;sthis.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(xt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(xt.shared.add(this.update,this),this._isConnectedToTicker=!0))}}const xu=class hi{constructor(t,e,s=null){this.linkedSheets=[],this._texture=t instanceof L?t:null,this.baseTexture=t instanceof X?t:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const r=this.baseTexture.resource;this.resolution=this._updateResolution(s||(r?r.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(t=null){const{scale:e}=this.data.meta;let s=te(t,null);return s===null&&(s=parseFloat(e!=null?e:"1")),s!==1&&this.baseTexture.setResolution(s),s}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=hi.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=hi.BATCH_SIZE;for(;e-t{this._batchIndex*hi.BATCH_SIZE{s[r]=t}),Object.keys(t.textures).forEach(r=>{s[r]=t.textures[r]}),!e){const r=bt.dirname(i[0]);t.linkedSheets.forEach((n,a)=>{const o=bu([`${r}/${t.data.meta.related_multi_packs[a]}`],n,!0);Object.assign(s,o)})}return s}const Tu={extension:D.Asset,cache:{test:i=>i instanceof fa,getCacheableAssets:(i,t)=>bu(i,t,!1)},resolver:{test:i=>{const t=i.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&jm.includes(s)},parse:i=>{var t,e;const s=i.split(".");return{resolution:parseFloat((e=(t=N.RETINA_PREFIX.exec(i))==null?void 0:t[1])!=null?e:"1"),format:s[s.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:D.LoadParser,priority:$t.Normal},async testParse(i,t){return bt.extname(t.src).toLowerCase()===".json"&&!!i.frames},async parse(i,t,e){var s,r;let n=bt.dirname(t.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");let a=n+i.meta.image;a=sr(a,t.src);const o=(await e.load([a]))[a],h=new fa(o.baseTexture,i,t.src);await h.parse();const l=(s=i==null?void 0:i.meta)==null?void 0:s.related_multi_packs;if(Array.isArray(l)){const u=[];for(const d of l){if(typeof d!="string")continue;let f=n+d;(r=t.data)!=null&&r.ignoreMultiPack||(f=sr(f,t.src),u.push(e.load({src:f,data:{ignoreMultiPack:!0}})))}const c=await Promise.all(u);h.linkedSheets=c,c.forEach(d=>{d.linkedSheets=[h].concat(h.linkedSheets.filter(f=>f!==d))})}return h},unload(i){i.destroy(!0)}}};U.add(Tu);class Qs{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Js{static test(t){return typeof t=="string"&&t.startsWith("info face=")}static parse(t){const e=t.match(/^[a-z]+\s+.+$/gm),s={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in e){const a=e[n].match(/^[a-z]+/gm)[0],o=e[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in o){const u=o[l].split("="),c=u[0],d=u[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;h[c]=p}s[a].push(h)}const r=new Qs;return s.info.forEach(n=>r.info.push({face:n.face,size:parseInt(n.size,10)})),s.common.forEach(n=>r.common.push({lineHeight:parseInt(n.lineHeight,10)})),s.page.forEach(n=>r.page.push({id:parseInt(n.id,10),file:n.file})),s.char.forEach(n=>r.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),s.kerning.forEach(n=>r.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),s.distanceField.forEach(n=>r.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),r}}class fr{static test(t){const e=t;return typeof t!="string"&&"getElementsByTagName"in t&&e.getElementsByTagName("page").length&&e.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(t){const e=new Qs,s=t.getElementsByTagName("info"),r=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),a=t.getElementsByTagName("char"),o=t.getElementsByTagName("kerning"),h=t.getElementsByTagName("distanceField");for(let l=0;l")?fr.test(N.ADAPTER.parseXML(t)):!1}static parse(t){return fr.parse(N.ADAPTER.parseXML(t))}}const pa=[Js,fr,pr];function Eu(i){for(let t=0;tt in i?Ym(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,qm=(i,t)=>{for(var e in t||(t={}))wu.call(t,e)&&Cu(i,e,t[e]);if(gr)for(var e of gr(t))Su.call(t,e)&&Cu(i,e,t[e]);return i},Km=(i,t)=>{var e={};for(var s in i)wu.call(i,s)&&t.indexOf(s)<0&&(e[s]=i[s]);if(i!=null&&gr)for(var s of gr(i))t.indexOf(s)<0&&Su.call(i,s)&&(e[s]=i[s]);return e};const Ie=class oe{constructor(t,e,s){var r,n;const[a]=t.info,[o]=t.common,[h]=t.page,[l]=t.distanceField,u=te(h.file),c={};this._ownsTextures=s,this.font=a.face,this.size=a.size,this.lineHeight=o.lineHeight/u,this.chars={},this.pageTextures=c;for(let d=0;d=l-B*o){if(g===0)throw new Error(`[BitmapFont] textureHeight ${l}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${S}')`);--A,_=null,x=null,v=null,g=0,m=0,b=0;continue}if(b=Math.max(B+I.fontProperties.descent,b),E*o+m>=f){if(m===0)throw new Error(`[BitmapFont] textureWidth ${h}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${S}')`);--A,g+=b*o,g=Math.ceil(g),m=0,b=0;continue}zm(_,x,I,m,g,o,d);const P=mr(I.text);p.char.push({id:P,page:R.length-1,x:m/o,y:g/o,width:E,height:B,xoffset:0,yoffset:0,xadvance:H-(d.dropShadow?d.dropShadowDistance:0)-(d.stroke?d.strokeThickness:0)}),m+=(E+2*a)*o,m=Math.ceil(m)}if(!(s!=null&&s.skipKerning))for(let A=0,S=c.length;A 0.99) {\r + alpha = 1.0;\r + }\r +\r + // Gamma correction for coverage-like alpha\r + float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r + float gamma = mix(1.0, 1.0 / 2.2, luma);\r + float coverage = pow(uColor.a * alpha, gamma); \r +\r + // NPM Textures, NPM outputs\r + gl_FragColor = vec4(uColor.rgb, coverage);\r +}\r +`,Qm=`// Mesh material default fragment\r +attribute vec2 aVertexPosition;\r +attribute vec2 aTextureCoord;\r +\r +uniform mat3 projectionMatrix;\r +uniform mat3 translationMatrix;\r +uniform mat3 uTextureMatrix;\r +\r +varying vec2 vTextureCoord;\r +\r +void main(void)\r +{\r + gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r +\r + vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r +}\r +`;const Ru=[],Iu=[],Pu=[],Mu=class $u extends St{constructor(t,e={}){super();const{align:s,tint:r,maxWidth:n,letterSpacing:a,fontName:o,fontSize:h}=Object.assign({},$u.styleDefaults,e);if(!xe.available[o])throw new Error(`Missing BitmapFont "${o}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=s,this._tintColor=new Y(r),this._font=void 0,this._fontName=o,this._fontSize=h,this.text=t,this._maxWidth=n,this._maxLineHeight=0,this._letterSpacing=a,this._anchor=new de(()=>{this.dirty=!0},this,0,0),this._roundPixels=N.ROUND_PIXELS,this.dirty=!0,this._resolution=N.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var t;const e=xe.available[this._fontName],s=this.fontSize,r=s/e.size,n=new K,a=[],o=[],h=[],l=this._text.replace(/(?:\r\n|\r)/g,` +`)||" ",u=Au(l),c=this._maxWidth*e.size/s,d=e.distanceFieldType==="none"?Ru:Iu;let f=null,p=0,m=0,g=0,_=-1,x=0,v=0,b=0,T=0;for(let B=0;B0&&n.x>c&&(++v,Oe(a,1+_-v,1+B-_),B=_,_=-1,o.push(x),h.push(a.length>0?a[a.length-1].prevSpaces:0),m=Math.max(m,x),g++,n.x=0,n.y+=e.lineHeight,f=null,T=0)}const R=u[u.length-1];R!=="\r"&&R!==` +`&&(/(?:\s)/.test(R)&&(p=x),o.push(p),m=Math.max(m,p),h.push(-1));const w=[];for(let B=0;B<=g;B++){let E=0;this._align==="right"?E=m-o[B]:this._align==="center"?E=(m-o[B])/2:this._align==="justify"&&(E=h[B]<0?0:(m-o[B])/h[B]),w.push(E)}const A=a.length,S={},I=[],H=this._activePagesMeshData;d.push(...H);for(let B=0;B6*P)||E.vertices.lengthe[r.mesh.texture.baseTexture.uid]).forEach(r=>{r.mesh.texture=L.EMPTY});for(const r in e)e[r].destroy(),delete e[r];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(t)}};Mu.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};let Jm=Mu;const tg=[".xml",".fnt"],Du={extension:{type:D.LoadParser,priority:$t.Normal},name:"loadBitmapFont",test(i){return tg.includes(bt.extname(i).toLowerCase())},async testParse(i){return Js.test(i)||pr.test(i)},async parse(i,t,e){const s=Js.test(i)?Js.parse(i):pr.parse(i),{src:r}=t,{page:n}=s,a=[];for(let l=0;lo[l]);return xe.install(s,h,!0)},async load(i,t){return(await N.ADAPTER.fetch(i)).text()},unload(i){i.destroy()}};U.add(Du);var eg=Object.defineProperty,sg=Object.defineProperties,ig=Object.getOwnPropertyDescriptors,Ou=Object.getOwnPropertySymbols,rg=Object.prototype.hasOwnProperty,ng=Object.prototype.propertyIsEnumerable,Bu=(i,t,e)=>t in i?eg(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ag=(i,t)=>{for(var e in t||(t={}))rg.call(t,e)&&Bu(i,e,t[e]);if(Ou)for(var e of Ou(t))ng.call(t,e)&&Bu(i,e,t[e]);return i},og=(i,t)=>sg(i,ig(t));const ma=class os extends ge{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(t){return new os(Object.keys(os.defaultOptions).reduce((e,s)=>og(ag({},e),{[s]:t[s]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(t=>{URL.revokeObjectURL(t.src),t.refs--,t.refs===0&&(t.fontFace&&document.fonts.delete(t.fontFace),delete os.availableFonts[t.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,e={}){const{availableFonts:s}=os;if(s[t]){const r=s[t];return this._fonts.push(r),r.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return N.ADAPTER.fetch(t).then(r=>r.blob()).then(async r=>new Promise((n,a)=>{const o=URL.createObjectURL(r),h=new FileReader;h.onload=()=>n([o,h.result]),h.onerror=a,h.readAsDataURL(r)})).then(async([r,n])=>{const a=Object.assign({family:bt.basename(t,bt.extname(t)),weight:"normal",style:"normal",display:"auto",src:r,dataSrc:n,refs:1,originalUrl:t,fontFace:null},e);s[t]=a,this._fonts.push(a),this.styleID++;const o=new FontFace(a.family,`url(${a.src})`,{weight:a.weight,style:a.style,display:a.display});a.fontFace=o,await o.load(),document.fonts.add(o),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...t){const e=t.filter(s=>!this._overrides.includes(s));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...t){const e=t.filter(s=>this._overrides.includes(s));e.length>0&&(this._overrides=this._overrides.filter(s=>!e.includes(s)),this.styleID++)}toCSS(t){return[`transform: scale(${t})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?"break-all":"break-word"}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce((t,e)=>`${t} + @font-face { + font-family: "${e.family}"; + src: url('${e.dataSrc}'); + font-weight: ${e.weight}; + font-style: ${e.style}; + font-display: ${e.display}; + }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(t){this._stylesheet!==t&&(this._stylesheet=t,this.styleID++)}normalizeColor(t){return Array.isArray(t)&&(t=To(t)),typeof t=="number"?bo(t):t}dropShadowToCSS(){let t=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,s=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),r=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);t.startsWith("#")&&e<1&&(t+=(e*255|0).toString(16).padStart(2,"0"));const n=`${s}px ${r}px`;return this.dropShadowBlur>0?`text-shadow: ${n} ${this.dropShadowBlur}px ${t}`:`text-shadow: ${n} ${t}`}reset(){Object.assign(this,os.defaultOptions)}onBeforeDraw(){const{fontsDirty:t}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&t?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:t}=N.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(t)}set fillGradientStops(t){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(t){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(t){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(t){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(t){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(t){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(t){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};ma.availableFonts={},ma.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};let _r=ma;const ti=class hs extends Ut{constructor(t="",e={}){var s;super(L.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const r=new Image,n=L.from(r,{scaleMode:N.SCALE_MODE,resourceOptions:{autoLoad:!1}});n.orig=new z,n.trim=new z,this.texture=n;const a="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",h=document.createElementNS(a,"svg"),l=document.createElementNS(a,"foreignObject"),u=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");l.setAttribute("width","10000"),l.setAttribute("height","10000"),l.style.overflow="hidden",h.appendChild(l),this.maxWidth=hs.defaultMaxWidth,this.maxHeight=hs.defaultMaxHeight,this._domElement=u,this._styleElement=c,this._svgRoot=h,this._foreignObject=l,this._foreignObject.appendChild(c),this._foreignObject.appendChild(u),this._image=r,this._loadImage=new Image,this._autoResolution=hs.defaultAutoResolution,this._resolution=(s=hs.defaultResolution)!=null?s:N.RESOLUTION,this.text=t,this.style=e}measureText(t){var e,s;const{text:r,style:n,resolution:a}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},t);Object.assign(this._domElement,{innerHTML:r,style:n.toCSS(a)}),this._styleElement.textContent=n.toGlobalCSS(),document.body.appendChild(this._svgRoot);const o=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:h,height:l}=o,u=Math.min(this.maxWidth,Math.ceil(h)),c=Math.min(this.maxHeight,Math.ceil(l));return this._svgRoot.setAttribute("width",u.toString()),this._svgRoot.setAttribute("height",c.toString()),r!==this._text&&(this._domElement.innerHTML=this._text),n!==this._style&&(Object.assign(this._domElement,{style:(e=this._style)==null?void 0:e.toCSS(a)}),this._styleElement.textContent=(s=this._style)==null?void 0:s.toGlobalCSS()),{width:u+n.padding*2,height:c+n.padding*2}}async updateText(t=!0){const{style:e,_image:s,_loadImage:r}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&t)return;const{width:n,height:a}=this.measureText();s.width=r.width=Math.ceil(Math.max(1,n)),s.height=r.height=Math.ceil(Math.max(1,a)),this._updateID++;const o=this._updateID;await new Promise(h=>{r.onload=async()=>{if(o/gi,"

").replace(/
/gi,"
").replace(/ /gi," ")}};ti.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},ti.defaultMaxWidth=2024,ti.defaultMaxHeight=2024,ti.defaultAutoResolution=!0;let hg=ti;const Pe=new z;class ga{constructor(t){this.renderer=t}async image(t,e,s,r){const n=new Image;return n.src=await this.base64(t,e,s,r),n}async base64(t,e,s,r){const n=this.canvas(t,r);if(n.toBlob!==void 0)return new Promise((a,o)=>{n.toBlob(h=>{if(!h){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>a(l.result),l.onerror=o,l.readAsDataURL(h)},e,s)});if(n.toDataURL!==void 0)return n.toDataURL(e,s);if(n.convertToBlob!==void 0){const a=await n.convertToBlob({type:e,quality:s});return new Promise((o,h)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=h,l.readAsDataURL(a)})}throw new Error("CanvasExtract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t,e){const s=this.renderer;if(!s)throw new Error("The CanvasExtract has already been destroyed");let r,n,a;t&&(t instanceof Yt?a=t:(a=s.generateTexture(t,{region:e,resolution:s.resolution}),e&&(Pe.width=e.width,Pe.height=e.height,e=Pe))),a?(r=a.baseTexture._canvasRenderTarget.context,n=a.baseTexture._canvasRenderTarget.resolution,e=e!=null?e:a.frame):(r=s.canvasContext.rootContext,n=s._view.resolution,e||(e=Pe,e.width=s.width/n,e.height=s.height/n));const o=Math.round(e.x*n),h=Math.round(e.y*n),l=Math.max(Math.round(e.width*n),1),u=Math.max(Math.round(e.height*n),1),c=new ys(l,u,1),d=r.getImageData(o,h,l,u);return c.context.putImageData(d,0,0),c.canvas}pixels(t,e){const s=this.renderer;if(!s)throw new Error("The CanvasExtract has already been destroyed");let r,n,a;t&&(t instanceof Yt?a=t:(a=s.generateTexture(t,{region:e,resolution:s.resolution}),e&&(Pe.width=e.width,Pe.height=e.height,e=Pe))),a?(r=a.baseTexture._canvasRenderTarget.context,n=a.baseTexture._canvasRenderTarget.resolution,e=e!=null?e:a.frame):(r=s.canvasContext.rootContext,n=s.resolution,e||(e=Pe,e.width=s.width/n,e.height=s.height/n));const o=Math.round(e.x*n),h=Math.round(e.y*n),l=Math.max(Math.round(e.width*n),1),u=Math.max(Math.round(e.height*n),1);return r.getImageData(o,h,l,u).data}destroy(){this.renderer=null}}ga.extension={name:"extract",type:D.CanvasRendererSystem},U.add(ga);let _a;const ei=new tt;rs.prototype.generateCanvasTexture=function(i,t=1){const e=this.getLocalBounds(new z);e.width=Math.max(e.width,1/t),e.height=Math.max(e.height,1/t);const s=Yt.create({width:e.width,height:e.height,scaleMode:i,resolution:t});_a||(_a=new Bs),this.transform.updateLocalTransform(),this.transform.localTransform.copyTo(ei),ei.invert(),ei.tx-=e.x,ei.ty-=e.y,_a.render(this,{renderTexture:s,clear:!0,transform:ei});const r=L.from(s.baseTexture._canvasRenderTarget.canvas,{scaleMode:i});return r.baseTexture.setResolution(t),r},rs.prototype.cachedGraphicsData=[],rs.prototype._renderCanvas=function(i){this.isMask!==!0&&(this.finishPoly(),i.plugins.graphics.render(this))};class si{static offsetPolygon(t,e){const s=[],r=t.length;e=si.isPolygonClockwise(t)?e:-1*e;for(let n=0;n0}}class va{constructor(t){this._svgMatrix=null,this._tempMatrix=new tt,this.renderer=t}_calcCanvasStyle(t,e){let s;return t.texture&&t.texture.baseTexture!==L.WHITE.baseTexture?t.texture.valid?(s=gt.getTintedPattern(t.texture,e),this.setPatternTransform(s,t.matrix||tt.IDENTITY)):s="#808080":s=`#${`00000${(e|0).toString(16)}`.slice(-6)}`,s}render(t){const e=this.renderer,s=e.canvasContext.activeContext,r=t.worldAlpha,n=t.transform.worldTransform;e.canvasContext.setContextTransform(n),e.canvasContext.setBlendMode(t.blendMode);const a=t.geometry.graphicsData;let o,h;const l=Y.shared.setValue(t.tint).toArray();for(let u=0;u0){A=[],b=0,R=x[0],w=x[1];for(let S=2;S+2=0;I-=2)s.lineTo(x[I],x[I+1])}v[S].shape.closeStroke&&s.closePath(),A[S]=T*b<0}}f.visible&&(s.globalAlpha=f.alpha*r,s.fillStyle=o,s.fill()),p.visible&&this.paintPolygonStroke(_,p,h,v,A,r,s)}else if(c.type===it.RECT){const _=d;if(f.visible&&(s.globalAlpha=f.alpha*r,s.fillStyle=o,s.fillRect(_.x,_.y,_.width,_.height)),p.visible){const x=p.width*(.5-(1-p.alignment)),v=_.width+2*x,b=_.height+2*x;s.globalAlpha=p.alpha*r,s.strokeStyle=h,s.strokeRect(_.x-x,_.y-x,v,b)}}else if(c.type===it.CIRC){const _=d;if(s.beginPath(),s.arc(_.x,_.y,_.radius,0,2*Math.PI),s.closePath(),f.visible&&(s.globalAlpha=f.alpha*r,s.fillStyle=o,s.fill()),p.visible){if(p.alignment!==.5){const x=p.width*(.5-(1-p.alignment));s.beginPath(),s.arc(_.x,_.y,_.radius+x,0,2*Math.PI),s.closePath()}s.globalAlpha=p.alpha*r,s.strokeStyle=h,s.stroke()}}else if(c.type===it.ELIP){const _=d,x=p.alignment===1;if(x||this.paintEllipse(_,f,p,o,r,s),p.visible){if(p.alignment!==.5){const v=.5522848,b=p.width*(.5-(1-p.alignment)),T=(_.width+b)*2,R=(_.height+b)*2,w=_.x-T/2,A=_.y-R/2,S=T/2*v,I=R/2*v,H=w+T,B=A+R,E=w+T/2,P=A+R/2;s.beginPath(),s.moveTo(w,P),s.bezierCurveTo(w,P-I,E-S,A,E,A),s.bezierCurveTo(E+S,A,H,P-I,H,P),s.bezierCurveTo(H,P+I,E+S,B,E,B),s.bezierCurveTo(E-S,B,w,P+I,w,P),s.closePath()}s.globalAlpha=p.alpha*r,s.strokeStyle=h,s.stroke()}x&&this.paintEllipse(_,f,p,o,r,s)}else if(c.type===it.RREC){const _=d,x=p.alignment===1;if(x||this.paintRoundedRectangle(_,f,p,o,r,s),p.visible){if(p.alignment!==.5){const v=_.width,b=_.height,T=p.width*(.5-(1-p.alignment)),R=_.x-T,w=_.y-T,A=_.width+2*T,S=_.height+2*T,I=T*(p.alignment>=1?Math.min(A/v,S/b):Math.min(v/A,b/S));let H=_.radius+I;const B=Math.min(A,S)/2;H=H>B?B:H,s.beginPath(),s.moveTo(R,w+H),s.lineTo(R,w+S-H),s.quadraticCurveTo(R,w+S,R+H,w+S),s.lineTo(R+A-H,w+S),s.quadraticCurveTo(R+A,w+S,R+A,w+S-H),s.lineTo(R+A,w+H),s.quadraticCurveTo(R+A,w,R+A-H,w),s.lineTo(R+H,w),s.quadraticCurveTo(R,w,R,w+H),s.closePath()}s.globalAlpha=p.alpha*r,s.strokeStyle=h,s.stroke()}x&&this.paintRoundedRectangle(_,f,p,o,r,s)}}}paintPolygonStroke(t,e,s,r,n,a,o){if(e.alignment!==.5){const h=e.width*(.5-(1-e.alignment));let l=si.offsetPolygon(t.points,h),u;o.beginPath(),o.moveTo(l[0],l[1]);for(let c=2;c=0;d-=2)o.lineTo(l[d],l[d+1])}r[c].shape.closeStroke&&o.closePath()}}o.globalAlpha=e.alpha*a,o.strokeStyle=s,o.stroke()}paintEllipse(t,e,s,r,n,a){const o=t.width*2,h=t.height*2,l=t.x-o/2,u=t.y-h/2,c=.5522848,d=o/2*c,f=h/2*c,p=l+o,m=u+h,g=l+o/2,_=u+h/2;s.alignment===0&&a.save(),a.beginPath(),a.moveTo(l,_),a.bezierCurveTo(l,_-f,g-d,u,g,u),a.bezierCurveTo(g+d,u,p,_-f,p,_),a.bezierCurveTo(p,_+f,g+d,m,g,m),a.bezierCurveTo(g-d,m,l,_+f,l,_),a.closePath(),s.alignment===0&&a.clip(),e.visible&&(a.globalAlpha=e.alpha*n,a.fillStyle=r,a.fill()),s.alignment===0&&a.restore()}paintRoundedRectangle(t,e,s,r,n,a){const o=t.x,h=t.y,l=t.width,u=t.height;let c=t.radius;const d=Math.min(l,u)/2;c=c>d?d:c,s.alignment===0&&a.save(),a.beginPath(),a.moveTo(o,h+c),a.lineTo(o,h+u-c),a.quadraticCurveTo(o,h+u,o+c,h+u),a.lineTo(o+l-c,h+u),a.quadraticCurveTo(o+l,h+u,o+l,h+u-c),a.lineTo(o+l,h+c),a.quadraticCurveTo(o+l,h,o+l-c,h),a.lineTo(o+c,h),a.quadraticCurveTo(o,h,o,h+c),a.closePath(),s.alignment===0&&a.clip(),e.visible&&(a.globalAlpha=e.alpha*n,a.fillStyle=r,a.fill()),s.alignment===0&&a.restore()}setPatternTransform(t,e){if(this._svgMatrix!==!1){if(!this._svgMatrix){const s=document.createElementNS("http://www.w3.org/2000/svg","svg");if(s!=null&&s.createSVGMatrix&&(this._svgMatrix=s.createSVGMatrix()),!this._svgMatrix||!t.setTransform){this._svgMatrix=!1;return}}this._svgMatrix.a=e.a,this._svgMatrix.b=e.b,this._svgMatrix.c=e.c,this._svgMatrix.d=e.d,this._svgMatrix.e=e.tx,this._svgMatrix.f=e.ty,t.setTransform(this._svgMatrix.inverse())}}destroy(){this.renderer=null,this._svgMatrix=null,this._tempMatrix=null}}va.extension={name:"graphics",type:D.CanvasRendererPlugin},U.add(va),Object.defineProperties(N,{MESH_CANVAS_PADDING:{get(){return Et.defaultCanvasPadding},set(i){Et.defaultCanvasPadding=i}}}),Xe.prototype._renderCanvas=function(i,t){i.plugins.mesh.render(t)},Ks.prototype._cachedTint=16777215,Ks.prototype._tintedCanvas=null,Ks.prototype._canvasUvs=null,Ks.prototype._renderCanvas=function(i){const t=i.canvasContext.activeContext,e=this.worldTransform,s=this.tintValue!==16777215,r=this.texture;if(!r.valid)return;s&&this._cachedTint!==this.tintValue&&(this._cachedTint=this.tintValue,this._tintedCanvas=gt.getTintedCanvas(this,this.tintValue));const n=s?this._tintedCanvas:r.baseTexture.getDrawableSource();this._canvasUvs||(this._canvasUvs=[0,0,0,0,0,0,0,0]);const a=this.vertices,o=this._canvasUvs,h=s?0:r.frame.x,l=s?0:r.frame.y,u=h+r.frame.width,c=l+r.frame.height;o[0]=h,o[1]=h+this._leftWidth,o[2]=u-this._rightWidth,o[3]=u,o[4]=l,o[5]=l+this._topHeight,o[6]=c-this._bottomHeight,o[7]=c;for(let d=0;d<8;d++)o[d]*=r.baseTexture.resolution;t.globalAlpha=this.worldAlpha,i.canvasContext.setBlendMode(this.blendMode),i.canvasContext.setContextTransform(e,this.roundPixels);for(let d=0;d<3;d++)for(let f=0;f<3;f++){const p=f*2+d*8,m=Math.max(1,o[f+1]-o[f]),g=Math.max(1,o[d+5]-o[d+4]),_=Math.max(1,a[p+10]-a[p]),x=Math.max(1,a[p+11]-a[p+1]);t.drawImage(n,o[f],o[d+4],m,g,a[p],a[p+1],_,x)}};let Fu=!1;Et.prototype._cachedTint=16777215,Et.prototype._tintedCanvas=null,Et.prototype._cachedTexture=null,Et.prototype._renderCanvas=function(i){this.shader.uvMatrix&&(this.shader.uvMatrix.update(),this.calculateUvs()),this.material._renderCanvas?this.material._renderCanvas(i,this):Fu||(Fu=!0,globalThis.console.warn("Mesh with custom shaders are not supported in CanvasRenderer."))},Et.prototype._canvasPadding=null,Et.defaultCanvasPadding=0,Object.defineProperty(Et.prototype,"canvasPadding",{get(){var i;return(i=this._canvasPadding)!=null?i:Et.defaultCanvasPadding},set(i){this._canvasPadding=i}}),mu.prototype._renderCanvas=function(i){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),this.shader.update&&this.shader.update(),this.calculateUvs(),this.material._renderCanvas(i,this)},gu.prototype._renderCanvas=function(i){(this.autoUpdate||this.geometry._width!==this.shader.texture.height)&&(this.geometry._width=this.shader.texture.height,this.geometry.update()),this.shader.update&&this.shader.update(),this.calculateUvs(),this.material._renderCanvas(i,this)};class ya{constructor(t){this.renderer=t}render(t){const e=this.renderer,s=t.worldTransform;e.canvasContext.activeContext.globalAlpha=t.worldAlpha,e.canvasContext.setBlendMode(t.blendMode),e.canvasContext.setContextTransform(s,t.roundPixels),t.drawMode!==Ot.TRIANGLES?this._renderTriangleMesh(t):this._renderTriangles(t)}_renderTriangleMesh(t){const e=t.geometry.buffers[0].data.length;for(let s=0;s0){const{a:ht,b:F,c:O,d:Z}=t.worldTransform,Q=(T+R+w)/3,J=(A+S+I)/3;let st=T-Q,et=A-J,rt=ht*st+O*et,lt=F*st+Z*et,_t=Math.sqrt(rt*rt+lt*lt),nt=1+H/_t;T=Q+st*nt,A=J+et*nt,st=R-Q,et=S-J,rt=ht*st+O*et,lt=F*st+Z*et,_t=Math.sqrt(rt*rt+lt*lt),nt=1+H/_t,R=Q+st*nt,S=J+et*nt,st=w-Q,et=I-J,rt=ht*st+O*et,lt=F*st+Z*et,_t=Math.sqrt(rt*rt+lt*lt),nt=1+H/_t,w=Q+st*nt,I=J+et*nt}a.save(),a.beginPath(),a.moveTo(T,A),a.lineTo(R,S),a.lineTo(w,I),a.closePath(),a.clip();const B=m*v+x*_+g*b-v*_-x*g-m*b,E=T*v+x*w+R*b-v*w-x*R-T*b,P=m*R+T*_+g*w-R*_-T*g-m*w,V=m*v*w+x*R*_+T*g*b-T*v*_-x*g*w-m*R*b,q=A*v+x*I+S*b-v*I-x*S-A*b,j=m*S+A*_+g*I-S*_-A*g-m*I,W=m*v*I+x*S*_+A*g*b-A*v*_-x*g*I-m*S*b;a.transform(E/B,q/B,P/B,j/B,V/B,W/B),a.drawImage(p,0,0,d*c.resolution,f*c.resolution,0,0,d,f),a.restore(),this.renderer.canvasContext.invalidateBlendMode()}renderMeshFlat(t){const e=this.renderer.canvasContext.activeContext,s=t.geometry.getBuffer("aVertexPosition").data,r=s.length/2;e.beginPath();for(let n=1;n{if(typeof require=="function"){const e=this._game.getAdditionalOptions(),t=e&&e.electronRemoteRequirePath?e.electronRemoteRequirePath:"@electron/remote";try{return require(t)}catch(i){console.error(`Could not load @electron/remote from "${t}". Error is:`,i)}}return null};this._game=e,this._forceFullscreen=t,this._marginLeft=this._marginTop=this._marginRight=this._marginBottom=0,this._setupOrientation()}createStandardCanvas(e){this._throwIfDisposed();const t=document.createElement("canvas");e.appendChild(t),this.initializeRenderers(t),this.initializeCanvas(t)}initializeRenderers(e){this._throwIfDisposed(),typeof THREE!="undefined"?(this._threeRenderer=new THREE.WebGLRenderer({canvas:e,antialias:this._game.getAntialiasingMode()!=="none"&&(this._game.isAntialisingEnabledOnMobile()||!l.evtTools.common.isMobile()),preserveDrawingBuffer:!0}),this._threeRenderer.useLegacyLights=!0,this._threeRenderer.autoClear=!1,this._threeRenderer.setSize(this._game.getGameResolutionWidth(),this._game.getGameResolutionHeight()),this._pixiRenderer=new PIXI.Renderer({width:this._game.getGameResolutionWidth(),height:this._game.getGameResolutionHeight(),view:e,context:this._threeRenderer.getContext(),clearBeforeRender:!1,preserveDrawingBuffer:!0,antialias:!1,backgroundAlpha:0})):this._pixiRenderer=PIXI.autoDetectRenderer({width:this._game.getGameResolutionWidth(),height:this._game.getGameResolutionHeight(),view:e,preserveDrawingBuffer:!0,antialias:!1}),this._pixiRenderer.plugins.accessibility.destroy(),delete this._pixiRenderer.plugins.accessibility}initializeCanvas(e){this._gameCanvas=e,e.style.position="absolute",e.tabIndex=1,e.style.userSelect="none",e.style.outline="none";const t=document.createElement("div");t.style.position="absolute",t.style.overflow="hidden",t.style.outline="none",t.style.pointerEvents="none",t.addEventListener("scroll",i=>{t.scrollLeft=0,t.scrollTop=0,i.preventDefault()}),e.addEventListener("pointerdown",()=>{e.focus()}),t.style["-webkit-user-select"]="none",e.parentNode?.appendChild(t),this._domElementsContainer=t,this._resizeCanvas(),this._game.getScaleMode()==="nearest"&&(e.style["image-rendering"]="-moz-crisp-edges",e.style["image-rendering"]="-webkit-optimize-contrast",e.style["image-rendering"]="-webkit-crisp-edges",e.style["image-rendering"]="pixelated"),this._game.getPixelsRounding()&&(PIXI.settings.ROUND_PIXELS=!0),window.addEventListener("resize",()=>{this._game.onWindowInnerSizeChanged(),this._resizeCanvas()}),e.focus()}static getWindowInnerWidth(){return typeof window!="undefined"?window.innerWidth:800}static getWindowInnerHeight(){return typeof window!="undefined"?window.innerHeight:800}updateRendererSize(){this._resizeCanvas()}_setupOrientation(){if(typeof window=="undefined"||!window.screen||!window.screen.orientation)return;const e=this._game.getGameData().properties.orientation;try{if(e==="default"){const t=window.screen.orientation.unlock();t&&t.catch(()=>{})}else window.screen.orientation.lock(e).catch(()=>{})}catch(t){u.error("Unexpected error while setting up orientation: ",t)}}_resizeCanvas(){if(!this._pixiRenderer||!this._domElementsContainer)return;(this._pixiRenderer.width!==this._game.getGameResolutionWidth()||this._pixiRenderer.height!==this._game.getGameResolutionHeight())&&(this._pixiRenderer.resize(this._game.getGameResolutionWidth(),this._game.getGameResolutionHeight()),this._threeRenderer&&this._threeRenderer.setSize(this._game.getGameResolutionWidth(),this._game.getGameResolutionHeight()));const e=this._forceFullscreen||this._isFullPage||this._isFullscreen;let t=this._game.getGameResolutionWidth(),i=this._game.getGameResolutionHeight(),o=window.innerWidth-this._marginLeft-this._marginRight,r=window.innerHeight-this._marginTop-this._marginBottom;if(o<0&&(o=0),r<0&&(r=0),e&&!this._keepRatio)t=o,i=r;else if(e&&this._keepRatio||t>o||i>r){let d=o/t;i*d>r&&(d=r/i),t*=d,i*=d}this._gameCanvas&&(this._gameCanvas.style.top=this._marginTop+(r-i)/2+"px",this._gameCanvas.style.left=this._marginLeft+(o-t)/2+"px",this._gameCanvas.style.width=t+"px",this._gameCanvas.style.height=i+"px"),this._domElementsContainer.style.top=this._marginTop+(r-i)/2+"px",this._domElementsContainer.style.left=this._marginLeft+(o-t)/2+"px",this._domElementsContainer.style.width=t+"px",this._domElementsContainer.style.height=i+"px",this._canvasWidth=t,this._canvasHeight=i}keepAspectRatio(e){this._keepRatio!==e&&(this._keepRatio=e,this._resizeCanvas())}setMargins(e,t,i,o){this._throwIfDisposed(),!(this._marginTop===e&&this._marginRight===t&&this._marginBottom===i&&this._marginLeft===o)&&(this._marginTop=e,this._marginRight=t,this._marginBottom=i,this._marginLeft=o,this._resizeCanvas())}setWindowSize(e,t){this._throwIfDisposed();const i=this.getElectronRemote();if(i){const o=i.getCurrentWindow();try{o&&o.setContentSize(e,t)}catch(r){u.error(`Window size setting to width ${e} and height ${t} failed. See error:`,r)}}else u.warn("Window size can't be changed on this platform.")}centerWindow(){this._throwIfDisposed();const e=this.getElectronRemote();if(e){const t=e.getCurrentWindow();try{t&&t.center()}catch(i){u.error("Window centering failed. See error:",i)}}else u.warn("Window can't be centered on this platform.")}setFullScreen(e){if(this._throwIfDisposed(),!this._forceFullscreen&&this._isFullscreen!==e){this._isFullscreen=!!e;const t=this.getElectronRemote();if(t){const i=t.getCurrentWindow();try{i&&i.setFullScreen(this._isFullscreen)}catch(o){u.error(`Full screen setting to ${this._isFullscreen} failed. See error:`,o)}}else this._isFullscreen?document.documentElement.requestFullscreen?document.documentElement.requestFullscreen():document.documentElement.mozRequestFullScreen?document.documentElement.mozRequestFullScreen():document.documentElement.webkitRequestFullScreen&&document.documentElement.webkitRequestFullScreen():document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen();this._resizeCanvas()}}isFullScreen(){const e=this.getElectronRemote();if(e)try{return e.getCurrentWindow().isFullScreen()}catch(t){return u.error("Full screen detection failed. See error:",t),!1}return this._isFullscreen||window.screen.height===window.innerHeight}convertCanvasToDomElementContainerCoords(e,t){const i=t||[0,0];return i[0]=e[0]*this._canvasWidth/this._game.getGameResolutionWidth(),i[1]=e[1]*this._canvasHeight/this._game.getGameResolutionHeight(),i}getCanvasToDomElementContainerHeightScale(){return(this._canvasHeight||1)/this._game.getGameResolutionHeight()}bindStandardEvents(e,t,i){this._throwIfDisposed();const o=this._gameCanvas;if(!o)return;const r=n=>{const s=[n.pageX-o.offsetLeft,n.pageY-o.offsetTop];return s[0]*=this._game.getGameResolutionWidth()/(this._canvasWidth||1),s[1]*=this._game.getGameResolutionHeight()/(this._canvasHeight||1),s},d=n=>{const s=n.pageX-o.offsetLeft,a=n.pageY-o.offsetTop;return 0<=s&&s<(this._canvasWidth||1)&&0<=a&&a<(this._canvasHeight||1)};(function(){isNaN(o.offsetLeft)&&(o.offsetLeft=0,o.offsetTop=0),isNaN(i.body.scrollLeft)&&(i.body.scrollLeft=0,i.body.scrollTop=0),(i.documentElement===void 0||i.documentElement===null)&&(i.documentElement={}),isNaN(i.documentElement.scrollLeft)&&(i.documentElement.scrollLeft=0,i.documentElement.scrollTop=0),isNaN(o.offsetLeft)&&(o.offsetLeft=0,o.offsetTop=0)})();const m=()=>!(i.activeElement===o||i.activeElement===i.body||i.activeElement===null),h=n=>!(n.target===o||n.target===i.body);i.onkeydown=function(n){m()||(f.includes(n.keyCode)&&n.preventDefault(),e.onKeyPressed(n.keyCode,n.location))},i.onkeyup=function(n){m()||(f.includes(n.keyCode)&&n.preventDefault(),e.onKeyReleased(n.keyCode,n.location))};function g(n){switch(n){case 1:return l.InputManager.MOUSE_MIDDLE_BUTTON;case 2:return l.InputManager.MOUSE_RIGHT_BUTTON}return n}o.onmousemove=function(n){const s=r(n);e.onMouseMove(s[0],s[1])},o.onmousedown=function(n){return e.onMouseButtonPressed(g(n.button)),t.focus!==void 0&&t.focus(),!1},o.onmouseup=function(n){return e.onMouseButtonReleased(g(n.button)),!1},o.onmouseleave=function(n){e.onMouseLeave()},o.onmouseenter=function(n){e.onMouseEnter();const s=[l.InputManager.MOUSE_LEFT_BUTTON,l.InputManager.MOUSE_RIGHT_BUTTON,l.InputManager.MOUSE_MIDDLE_BUTTON,l.InputManager.MOUSE_BACK_BUTTON,l.InputManager.MOUSE_FORWARD_BUTTON];for(let a=0,v=s.length;a{this._nextFrameId=requestAnimationFrame(i);const r=t?o-t:0;t=o,e(r)||cancelAnimationFrame(this._nextFrameId)};requestAnimationFrame(i)}stopGameLoop(){cancelAnimationFrame(this._nextFrameId)}getPIXIRenderer(){return this._pixiRenderer}getThreeRenderer(){return this._threeRenderer}getDomElementContainer(){return this._domElementsContainer}openURL(e){if(typeof window!="undefined"){const t=this.getElectron();t?t.shell.openExternal(e):typeof window.cordova!="undefined"&&typeof window.cordova.InAppBrowser!="undefined"?window.cordova.InAppBrowser.open(e,"_system","location=yes"):window.open(e,"_blank")}}stopGame(){const e=this.getElectronRemote();if(e){const t=e.getCurrentWindow();if(t)try{t.close()}catch(i){u.error("Window closing failed. See error:",i)}}else typeof navigator!="undefined"&&navigator.app&&navigator.app.exitApp&&navigator.app.exitApp()}dispose(e){this._pixiRenderer?.destroy(),this._threeRenderer?.dispose(),this._pixiRenderer=null,this._threeRenderer=null,e&&this._gameCanvas&&this._gameCanvas.parentNode?.removeChild(this._gameCanvas),this._gameCanvas=null,this._domElementsContainer?.parentNode?.removeChild(this._domElementsContainer),this._domElementsContainer=null,this._wasDisposed=!0}getCanvas(){return this._gameCanvas}isWebGLSupported(){return!!this._pixiRenderer&&this._pixiRenderer.type===PIXI.RENDERER_TYPE.WEBGL}getElectron(){return typeof require=="function"?require("electron"):null}getGame(){return this._game}_throwIfDisposed(){if(this._wasDisposed)throw"The RuntimeGameRenderer has been disposed and should not be used anymore."}}l.RuntimeGamePixiRenderer=R,l.RuntimeGameRenderer=R})(gdjs||(gdjs={})); +//# sourceMappingURL=runtimegame-pixi-renderer.js.map diff --git a/pixi-renderers/runtimescene-pixi-renderer.js b/pixi-renderers/runtimescene-pixi-renderer.js new file mode 100644 index 0000000000000000000000000000000000000000..c70fffd975a026b990712e436e9bf155e99ca1b1 --- /dev/null +++ b/pixi-renderers/runtimescene-pixi-renderer.js @@ -0,0 +1,3 @@ +var gdjs;(function(o){class _{constructor(t,e){this._profilerText=null;this._showCursorAtNextRender=!1;this._threeRenderer=null;this._layerRenderingMetrics={rendered2DLayersCount:0,rendered3DLayersCount:0};this._runtimeGameRenderer=e,this._runtimeScene=t,this._pixiContainer=new PIXI.Container,this._pixiContainer.sortableChildren=!0,this._threeRenderer=this._runtimeGameRenderer?this._runtimeGameRenderer.getThreeRenderer():null}onGameResolutionResized(){const t=this._runtimeGameRenderer?this._runtimeGameRenderer.getPIXIRenderer():null;if(!t)return;const e=this._runtimeScene.getGame();this._pixiContainer.scale.x=t.width/e.getGameResolutionWidth(),this._pixiContainer.scale.y=t.height/e.getGameResolutionHeight();for(const r of this._runtimeScene._orderedLayers)r.getRenderer().onGameResolutionResized()}onSceneUnloaded(){}render(){const t=this._runtimeGameRenderer;if(!t)return;const e=t.getPIXIRenderer();if(!e)return;const r=this._threeRenderer;if(!(r&&r.xr.isPresenting)){if(this._layerRenderingMetrics.rendered2DLayersCount=0,this._layerRenderingMetrics.rendered3DLayersCount=0,r){r.info.autoReset=!1,r.info.reset();let n=!0,s=!0;r.resetState();for(let c=0;c>8&255]+ee[t>>16&255]+ee[t>>24&255]+"-"+ee[255&e]+ee[e>>8&255]+"-"+ee[e>>16&15|64]+ee[e>>24&255]+"-"+ee[63&n|128]+ee[n>>8&255]+"-"+ee[n>>16&255]+ee[n>>24&255]+ee[255&i]+ee[i>>8&255]+ee[i>>16&255]+ee[i>>24&255]).toLowerCase()}function ae(t,e,n){return Math.max(e,Math.min(n,t))}function oe(t,e){return(t%e+e)%e}function le(t,e,n){return(1-n)*t+n*e}function ce(t){return 0==(t&t-1)&&0!==t}function he(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function ue(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function de(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const pe={DEG2RAD:ie,RAD2DEG:re,generateUUID:se,clamp:ae,euclideanModulo:oe,mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:le,damp:function(t,e,n,i){return le(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(oe(t,2*e)-e)},smoothstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*(3-2*t)},smootherstep:function(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(ne=t);let e=ne+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*ie},radToDeg:function(t){return t*re},isPowerOfTwo:ce,ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:he,setQuaternionFromProperEuler:function(t,e,n,i,r){const s=Math.cos,a=Math.sin,o=s(n/2),l=a(n/2),c=s((e+i)/2),h=a((e+i)/2),u=s((e-i)/2),d=a((e-i)/2),p=s((i-e)/2),m=a((i-e)/2);switch(r){case"XYX":t.set(o*h,l*u,l*d,o*c);break;case"YZY":t.set(l*d,o*h,l*u,o*c);break;case"ZXZ":t.set(l*u,l*d,o*h,o*c);break;case"XZX":t.set(o*h,l*m,l*p,o*c);break;case"YXY":t.set(l*p,o*h,l*m,o*c);break;case"ZYZ":t.set(l*m,l*p,o*h,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:de,denormalize:ue};class me{constructor(t=0,e=0){me.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(ae(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*n-s*i+t.x,this.y=r*i+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class fe{constructor(t,e,n,i,r,s,a,o,l){fe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,a,o,l)}set(t,e,n,i,r,s,a,o,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=a,c[3]=e,c[4]=r,c[5]=o,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[3],o=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],m=i[0],f=i[3],g=i[6],_=i[1],v=i[4],x=i[7],y=i[2],M=i[5],S=i[8];return r[0]=s*m+a*_+o*y,r[3]=s*f+a*v+o*M,r[6]=s*g+a*x+o*S,r[1]=l*m+c*_+h*y,r[4]=l*f+c*v+h*M,r[7]=l*g+c*x+h*S,r[2]=u*m+d*_+p*y,r[5]=u*f+d*v+p*M,r[8]=u*g+d*x+p*S,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8];return e*s*c-e*a*l-n*r*c+n*a*o+i*r*l-i*s*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=c*s-a*l,u=a*o-c*r,d=l*r-s*o,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=h*m,t[1]=(i*l-c*n)*m,t[2]=(a*n-i*s)*m,t[3]=u*m,t[4]=(c*e-i*o)*m,t[5]=(i*r-a*e)*m,t[6]=d*m,t[7]=(n*o-l*e)*m,t[8]=(s*e-n*r)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,s,a){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*s+l*a)+s+t,-i*l,i*o,-i*(-l*s+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(ge.makeScale(t,e)),this}rotate(t){return this.premultiply(ge.makeRotation(-t)),this}translate(t,e){return this.premultiply(ge.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const ge=new fe;function _e(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const ve={Int8Array:Int8Array,Uint8Array:Uint8Array,Uint8ClampedArray:Uint8ClampedArray,Int16Array:Int16Array,Uint16Array:Uint16Array,Int32Array:Int32Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array};function xe(t,e){return new ve[t](e)}function ye(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Me(){const t=ye("canvas");return t.style.display="block",t}const Se={};function be(t){t in Se||(Se[t]=!0,console.warn(t))}const Te=(new fe).set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),Ee=(new fe).set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),we={[Ht]:{transfer:Wt,primaries:jt,toReference:t=>t,fromReference:t=>t},[Gt]:{transfer:Xt,primaries:jt,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[kt]:{transfer:Wt,primaries:qt,toReference:t=>t.applyMatrix3(Ee),fromReference:t=>t.applyMatrix3(Te)},[Vt]:{transfer:Xt,primaries:qt,toReference:t=>t.convertSRGBToLinear().applyMatrix3(Ee),fromReference:t=>t.applyMatrix3(Te).convertLinearToSRGB()}},Ae=new Set([Ht,kt]),Re={enabled:!0,_workingColorSpace:Ht,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!Ae.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(!1===this.enabled||e===n||!e||!n)return t;const i=we[e].toReference;return(0,we[n].fromReference)(i(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return we[t].primaries},getTransfer:function(t){return t===zt?Wt:we[t].transfer}};function Ce(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Le(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let Pe;class Ie{static getDataURL(t){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{void 0===Pe&&(Pe=ye("canvas")),Pe.width=t.width,Pe.height=t.height;const n=Pe.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=Pe}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=ye("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==S)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case R:t.x=t.x-Math.floor(t.x);break;case C:t.x=t.x<0?0:1;break;case L:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case R:t.y=t.y-Math.floor(t.y);break;case C:t.y=t.y<0?0:1;break;case L:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return be("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Gt?Bt:Ft}set encoding(t){be("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=t===Bt?Gt:zt}}Fe.DEFAULT_IMAGE=null,Fe.DEFAULT_MAPPING=S,Fe.DEFAULT_ANISOTROPY=1;class Be{constructor(t=0,e=0,n=0,i=1){Be.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*e+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*e+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*e+s[7]*n+s[11]*i+s[15]*r,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const s=.01,a=.1,o=t.elements,l=o[0],c=o[4],h=o[8],u=o[1],d=o[5],p=o[9],m=o[2],f=o[6],g=o[10];if(Math.abs(c-u)o&&t>_?t_?o=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,e*n);t=Math.sin(t*s)/r,a=Math.sin(a*s)/r}const r=a*n;if(o=o*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+m*r,t===1-a){const t=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=t,l*=t,c*=t,h*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,n,i,r,s){const a=n[i],o=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return t[e]=a*p+c*h+o*d-l*u,t[e+1]=o*p+c*u+l*h-a*d,t[e+2]=l*p+c*d+a*u-o*h,t[e+3]=c*p-a*h-o*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,i=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,l=a(n/2),c=a(i/2),h=a(r/2),u=o(n/2),d=o(i/2),p=o(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],h=e[10],u=n+a+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-o)*t,this._y=(r-l)*t,this._z=(s-i)*t}else if(n>a&&n>h){const t=2*Math.sqrt(1+n-a-h);this._w=(c-o)/t,this._x=.25*t,this._y=(i+s)/t,this._z=(r+l)/t}else if(a>h){const t=2*Math.sqrt(1+a-n-h);this._w=(r-l)/t,this._x=(i+s)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+h-n-a);this._w=(s-i)/t,this._x=(r+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return nMath.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(ae(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,s=t._w,a=e._x,o=e._y,l=e._z,c=e._w;return this._x=n*c+s*a+i*l-r*o,this._y=i*c+s*o+r*a-n*l,this._z=r*c+s*l+n*o-i*a,this._w=s*c-n*a-i*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,s=this._w;let a=s*t._w+n*t._x+i*t._y+r*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*s+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this}const l=Math.sqrt(o),c=Math.atan2(l,a),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=Math.random(),e=Math.sqrt(1-t),n=Math.sqrt(t),i=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(e*Math.cos(i),n*Math.sin(r),n*Math.cos(r),e*Math.sin(i))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class We{constructor(t=0,e=0,n=0){We.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(je.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(je.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,s=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=2*(s*i-a*n),c=2*(a*e-r*i),h=2*(r*n-s*e);return this.x=e+o*l+s*h-a*c,this.y=n+o*c+a*l-r*h,this.z=i+o*h+r*c-s*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(t,Math.min(e,n)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=i*o-r*a,this.y=r*s-n*o,this.z=n*a-i*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Xe.copy(this).projectOnVector(t),this.sub(Xe)}reflect(t){return this.sub(Xe.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(ae(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=2*(Math.random()-.5),e=Math.random()*Math.PI*2,n=Math.sqrt(1-t**2);return this.x=n*Math.cos(e),this.y=n*Math.sin(e),this.z=t,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Xe=new We,je=new ke;class qe{constructor(t=new We(1/0,1/0,1/0),e=new We(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;ethis.max.x||t.ythis.max.y||t.zthis.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y||t.max.zthis.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Ze),Ze.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(rn),sn.subVectors(this.max,rn),Ke.subVectors(t.a,rn),$e.subVectors(t.b,rn),Qe.subVectors(t.c,rn),tn.subVectors($e,Ke),en.subVectors(Qe,$e),nn.subVectors(Ke,Qe);let e=[0,-tn.z,tn.y,0,-en.z,en.y,0,-nn.z,nn.y,tn.z,0,-tn.x,en.z,0,-en.x,nn.z,0,-nn.x,-tn.y,tn.x,0,-en.y,en.x,0,-nn.y,nn.x,0];return!!ln(e,Ke,$e,Qe,sn)&&(e=[1,0,0,0,1,0,0,0,1],!!ln(e,Ke,$e,Qe,sn)&&(an.crossVectors(tn,en),e=[an.x,an.y,an.z],ln(e,Ke,$e,Qe,sn)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Ze).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Ze).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Ye[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ye[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ye[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ye[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ye[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ye[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ye[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ye[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ye)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}const Ye=[new We,new We,new We,new We,new We,new We,new We,new We],Ze=new We,Je=new qe,Ke=new We,$e=new We,Qe=new We,tn=new We,en=new We,nn=new We,rn=new We,sn=new We,an=new We,on=new We;function ln(t,e,n,i,r){for(let s=0,a=t.length-3;s<=a;s+=3){on.fromArray(t,s);const a=r.x*Math.abs(on.x)+r.y*Math.abs(on.y)+r.z*Math.abs(on.z),o=e.dot(on),l=n.dot(on),c=i.dot(on);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}const cn=new qe,hn=new We,un=new We;class dn{constructor(t=new We,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):cn.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;ethis.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;hn.subVectors(t,this.center);const e=hn.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.addScaledVector(hn,n/t),this.radius+=n}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(un.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(hn.copy(t.center).add(un)),this.expandByPoint(hn.copy(t.center).sub(un))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const pn=new We,mn=new We,fn=new We,gn=new We,_n=new We,vn=new We,xn=new We;class yn{constructor(t=new We,e=new We(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,pn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=pn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(pn.copy(this.origin).addScaledVector(this.direction,e),pn.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){mn.copy(t).add(e).multiplyScalar(.5),fn.copy(e).sub(t).normalize(),gn.copy(this.origin).sub(mn);const r=.5*t.distanceTo(e),s=-this.direction.dot(fn),a=gn.dot(this.direction),o=-gn.dot(fn),l=gn.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*o-a,u=s*a-o,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+s*u+2*a)+u*(s*h+u+2*o)+l}else u=r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u=-r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u<=-p?(h=Math.max(0,-(-s*r+a)),u=h>0?-r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(h=Math.max(0,-(s*r+a)),u=h>0?r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(mn).addScaledVector(fn,u),d}intersectSphere(t,e){pn.subVectors(t.center,this.origin);const n=pn.dot(this.direction),i=pn.dot(pn)-n*n,r=t.radius*t.radius;if(i>r)return null;const s=Math.sqrt(r-i),a=n-s,o=n+s;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,s,a,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(t.min.x-u.x)*l,i=(t.max.x-u.x)*l):(n=(t.max.x-u.x)*l,i=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||r>i?null:((r>n||isNaN(n))&&(n=r),(s=0?(a=(t.min.z-u.z)*h,o=(t.max.z-u.z)*h):(a=(t.max.z-u.z)*h,o=(t.min.z-u.z)*h),n>o||a>i?null:((a>n||n!=n)&&(n=a),(o=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,pn)}intersectTriangle(t,e,n,i,r){_n.subVectors(e,t),vn.subVectors(n,t),xn.crossVectors(_n,vn);let s,a=this.direction.dot(xn);if(a>0){if(i)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}gn.subVectors(this.origin,t);const o=s*this.direction.dot(vn.crossVectors(gn,vn));if(o<0)return null;const l=s*this.direction.dot(_n.cross(gn));if(l<0)return null;if(o+l>a)return null;const c=-s*gn.dot(xn);return c<0?null:this.at(c/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Mn{constructor(t,e,n,i,r,s,a,o,l,c,h,u,d,p,m,f){Mn.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,a,o,l,c,h,u,d,p,m,f)}set(t,e,n,i,r,s,a,o,l,c,h,u,d,p,m,f){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=s,g[9]=a,g[13]=o,g[2]=l,g[6]=c,g[10]=h,g[14]=u,g[3]=d,g[7]=p,g[11]=m,g[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Mn).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/Sn.setFromMatrixColumn(t,0).length(),r=1/Sn.setFromMatrixColumn(t,1).length(),s=1/Sn.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,s=Math.cos(n),a=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-a*o,e[2]=r-t*l,e[6]=i+n*l,e[10]=s*o}else if("YXZ"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t+r*a,e[4]=i*a-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-a,e[2]=n*a-i,e[6]=r+t*a,e[10]=s*o}else if("ZXY"===t.order){const t=o*c,n=o*h,i=l*c,r=l*h;e[0]=t-r*a,e[4]=-s*h,e[8]=i+n*a,e[1]=n+i*a,e[5]=s*c,e[9]=r-t*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if("ZYX"===t.order){const t=s*c,n=s*h,i=a*c,r=a*h;e[0]=o*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=o*h,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=a*o,e[10]=s*o}else if("YZX"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=s*c,e[9]=-a*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=s*o,n=s*l,i=a*o,r=a*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=s*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=a*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Tn,t,En)}lookAt(t,e,n){const i=this.elements;return Rn.subVectors(t,e),0===Rn.lengthSq()&&(Rn.z=1),Rn.normalize(),wn.crossVectors(n,Rn),0===wn.lengthSq()&&(1===Math.abs(n.z)?Rn.x+=1e-4:Rn.z+=1e-4,Rn.normalize(),wn.crossVectors(n,Rn)),wn.normalize(),An.crossVectors(Rn,wn),i[0]=wn.x,i[4]=An.x,i[8]=Rn.x,i[1]=wn.y,i[5]=An.y,i[9]=Rn.y,i[2]=wn.z,i[6]=An.z,i[10]=Rn.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,s=n[0],a=n[4],o=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],m=n[6],f=n[10],g=n[14],_=n[3],v=n[7],x=n[11],y=n[15],M=i[0],S=i[4],b=i[8],T=i[12],E=i[1],w=i[5],A=i[9],R=i[13],C=i[2],L=i[6],P=i[10],I=i[14],U=i[3],D=i[7],N=i[11],O=i[15];return r[0]=s*M+a*E+o*C+l*U,r[4]=s*S+a*w+o*L+l*D,r[8]=s*b+a*A+o*P+l*N,r[12]=s*T+a*R+o*I+l*O,r[1]=c*M+h*E+u*C+d*U,r[5]=c*S+h*w+u*L+d*D,r[9]=c*b+h*A+u*P+d*N,r[13]=c*T+h*R+u*I+d*O,r[2]=p*M+m*E+f*C+g*U,r[6]=p*S+m*w+f*L+g*D,r[10]=p*b+m*A+f*P+g*N,r[14]=p*T+m*R+f*I+g*O,r[3]=_*M+v*E+x*C+y*U,r[7]=_*S+v*w+x*L+y*D,r[11]=_*b+v*A+x*P+y*N,r[15]=_*T+v*R+x*I+y*O,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14];return t[3]*(+r*o*h-i*l*h-r*a*u+n*l*u+i*a*d-n*o*d)+t[7]*(+e*o*d-e*l*u+r*s*u-i*s*d+i*l*c-r*o*c)+t[11]*(+e*l*h-e*a*d-r*s*h+n*s*d+r*a*c-n*l*c)+t[15]*(-i*a*c-e*o*h+e*a*u+i*s*h-n*s*u+n*o*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],m=t[13],f=t[14],g=t[15],_=h*f*l-m*u*l+m*o*d-a*f*d-h*o*g+a*u*g,v=p*u*l-c*f*l-p*o*d+s*f*d+c*o*g-s*u*g,x=c*m*l-p*h*l+p*a*d-s*m*d-c*a*g+s*h*g,y=p*h*o-c*m*o-p*a*u+s*m*u+c*a*f-s*h*f,M=e*_+n*v+i*x+r*y;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const S=1/M;return t[0]=_*S,t[1]=(m*u*r-h*f*r-m*i*d+n*f*d+h*i*g-n*u*g)*S,t[2]=(a*f*r-m*o*r+m*i*l-n*f*l-a*i*g+n*o*g)*S,t[3]=(h*o*r-a*u*r-h*i*l+n*u*l+a*i*d-n*o*d)*S,t[4]=v*S,t[5]=(c*f*r-p*u*r+p*i*d-e*f*d-c*i*g+e*u*g)*S,t[6]=(p*o*r-s*f*r-p*i*l+e*f*l+s*i*g-e*o*g)*S,t[7]=(s*u*r-c*o*r+c*i*l-e*u*l-s*i*d+e*o*d)*S,t[8]=x*S,t[9]=(p*h*r-c*m*r-p*n*d+e*m*d+c*n*g-e*h*g)*S,t[10]=(s*m*r-p*a*r+p*n*l-e*m*l-s*n*g+e*a*g)*S,t[11]=(c*a*r-s*h*r-c*n*l+e*h*l+s*n*d-e*a*d)*S,t[12]=y*S,t[13]=(c*m*i-p*h*i+p*n*u-e*m*u-c*n*f+e*h*f)*S,t[14]=(p*a*i-s*m*i-p*n*o+e*m*o+s*n*f-e*a*f)*S,t[15]=(s*h*i-c*a*i+c*n*o-e*h*o-s*n*u+e*a*u)*S,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,s=t.x,a=t.y,o=t.z,l=r*s,c=r*a;return this.set(l*s+n,l*a-i*o,l*o+i*a,0,l*a+i*o,c*a+n,c*o-i*s,0,l*o-i*a,c*o+i*s,r*o*o+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,s){return this.set(1,n,r,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,c=s+s,h=a+a,u=r*l,d=r*c,p=r*h,m=s*c,f=s*h,g=a*h,_=o*l,v=o*c,x=o*h,y=n.x,M=n.y,S=n.z;return i[0]=(1-(m+g))*y,i[1]=(d+x)*y,i[2]=(p-v)*y,i[3]=0,i[4]=(d-x)*M,i[5]=(1-(u+g))*M,i[6]=(f+_)*M,i[7]=0,i[8]=(p+v)*S,i[9]=(f-_)*S,i[10]=(1-(u+m))*S,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=Sn.set(i[0],i[1],i[2]).length();const s=Sn.set(i[4],i[5],i[6]).length(),a=Sn.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],bn.copy(this);const o=1/r,l=1/s,c=1/a;return bn.elements[0]*=o,bn.elements[1]*=o,bn.elements[2]*=o,bn.elements[4]*=l,bn.elements[5]*=l,bn.elements[6]*=l,bn.elements[8]*=c,bn.elements[9]*=c,bn.elements[10]*=c,e.setFromRotationMatrix(bn),n.x=r,n.y=s,n.z=a,this}makePerspective(t,e,n,i,r,s,a=2e3){const o=this.elements,l=2*r/(e-t),c=2*r/(n-i),h=(e+t)/(e-t),u=(n+i)/(n-i);let d,p;if(a===$t)d=-(s+r)/(s-r),p=-2*s*r/(s-r);else{if(a!==Qt)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-s/(s-r),p=-s*r/(s-r)}return o[0]=l,o[4]=0,o[8]=h,o[12]=0,o[1]=0,o[5]=c,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,i,r,s,a=2e3){const o=this.elements,l=1/(e-t),c=1/(n-i),h=1/(s-r),u=(e+t)*l,d=(n+i)*c;let p,m;if(a===$t)p=(s+r)*h,m=-2*h;else{if(a!==Qt)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=r*h,m=-1*h}return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=m,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const Sn=new We,bn=new Mn,Tn=new We(0,0,0),En=new We(1,1,1),wn=new We,An=new We,Rn=new We,Cn=new Mn,Ln=new ke;class Pn{constructor(t=0,e=0,n=0,i=Pn.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],s=i[4],a=i[8],o=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(ae(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-ae(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(ae(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-ae(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(ae(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-ae(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Cn.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Cn,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Ln.setFromEuler(this),this.setFromQuaternion(Ln,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Pn.DEFAULT_ORDER="XYZ";class In{constructor(){this.mask=1}set(t){this.mask=(1<>>0}enable(t){this.mask|=1<1){for(let t=0;t1){for(let t=0;t0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map((t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()}))),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(t),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e0){i.children=[];for(let e=0;e0){i.animations=[];for(let e=0;e0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),a.length>0&&(n.images=a),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){qn.subVectors(i,e),Yn.subVectors(n,e),Zn.subVectors(t,e);const s=qn.dot(qn),a=qn.dot(Yn),o=qn.dot(Zn),l=Yn.dot(Yn),c=Yn.dot(Zn),h=s*l-a*a;if(0===h)return r.set(0,0,0),null;const u=1/h,d=(l*o-a*c)*u,p=(s*c-a*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return null!==this.getBarycoord(t,e,n,i,Jn)&&(Jn.x>=0&&Jn.y>=0&&Jn.x+Jn.y<=1)}static getUV(t,e,n,i,r,s,a,o){return!1===ii&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ii=!0),this.getInterpolation(t,e,n,i,r,s,a,o)}static getInterpolation(t,e,n,i,r,s,a,o){return null===this.getBarycoord(t,e,n,i,Jn)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,Jn.x),o.addScaledVector(s,Jn.y),o.addScaledVector(a,Jn.z),o)}static isFrontFacing(t,e,n,i){return qn.subVectors(n,e),Yn.subVectors(t,e),qn.cross(Yn).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return qn.subVectors(this.c,this.b),Yn.subVectors(this.a,this.b),.5*qn.cross(Yn).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return ri.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return ri.getBarycoord(t,this.a,this.b,this.c,e)}getUV(t,e,n,i,r){return!1===ii&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ii=!0),ri.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}getInterpolation(t,e,n,i,r){return ri.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return ri.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return ri.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let s,a;Kn.subVectors(i,n),$n.subVectors(r,n),ti.subVectors(t,n);const o=Kn.dot(ti),l=$n.dot(ti);if(o<=0&&l<=0)return e.copy(n);ei.subVectors(t,i);const c=Kn.dot(ei),h=$n.dot(ei);if(c>=0&&h<=c)return e.copy(i);const u=o*h-c*l;if(u<=0&&o>=0&&c<=0)return s=o/(o-c),e.copy(n).addScaledVector(Kn,s);ni.subVectors(t,r);const d=Kn.dot(ni),p=$n.dot(ni);if(p>=0&&d<=p)return e.copy(r);const m=d*l-o*p;if(m<=0&&l>=0&&p<=0)return a=l/(l-p),e.copy(n).addScaledVector($n,a);const f=c*p-d*h;if(f<=0&&h-c>=0&&d-p>=0)return Qn.subVectors(r,i),a=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(Qn,a);const g=1/(f+m+u);return s=m*g,a=u*g,e.copy(n).addScaledVector(Kn,s).addScaledVector($n,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const si={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ai={h:0,s:0,l:0},oi={h:0,s:0,l:0};function li(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}class ci{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(void 0===e&&void 0===n){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Gt){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Re.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i=Re.workingColorSpace){return this.r=t,this.g=e,this.b=n,Re.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i=Re.workingColorSpace){if(t=oe(t,1),e=ae(e,0,1),n=ae(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=li(r,i,t+1/3),this.g=li(r,i,t),this.b=li(r,i,t-1/3)}return Re.toWorkingColorSpace(this,i),this}setStyle(t,e=Gt){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const s=i[1],a=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(n,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Gt){const n=si[t.toLowerCase()];return void 0!==n?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Ce(t.r),this.g=Ce(t.g),this.b=Ce(t.b),this}copyLinearToSRGB(t){return this.r=Le(t.r),this.g=Le(t.g),this.b=Le(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Gt){return Re.fromWorkingColorSpace(hi.copy(this),t),65536*Math.round(ae(255*hi.r,0,255))+256*Math.round(ae(255*hi.g,0,255))+Math.round(ae(255*hi.b,0,255))}getHexString(t=Gt){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Re.workingColorSpace){Re.fromWorkingColorSpace(hi.copy(this),e);const n=hi.r,i=hi.g,r=hi.b,s=Math.max(n,i,r),a=Math.min(n,i,r);let o,l;const c=(a+s)/2;if(a===s)o=0,l=0;else{const t=s-a;switch(l=c<=.5?t/(s+a):t/(2-s-a),s){case n:o=(i-r)/t+(i0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),this.side!==s&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==l&&(n.blendSrc=this.blendSrc),this.blendDst!==c&&(n.blendDst=this.blendDst),this.blendEquation!==o&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Yt&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Yt&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Yt&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class pi extends di{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ci(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=h,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const mi=fi();function fi(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),i=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(i[t]=0,i[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(i[t]=1024>>-e-14,i[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(i[t]=e+15<<10,i[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(i[t]=31744,i[256|t]=64512,r[t]=24,r[256|t]=24):(i[t]=31744,i[256|t]=64512,r[t]=13,r[256|t]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,n=0;for(;0==(8388608&e);)e<<=1,n-=8388608;e&=-8388609,n+=947912704,s[t]=e|n}for(let t=1024;t<2048;++t)s[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)a[t]=t<<23;a[31]=1199570944,a[32]=2147483648;for(let t=33;t<63;++t)a[t]=2147483648+(t-32<<23);a[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(o[t]=1024);return{floatView:e,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function gi(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=ae(t,-65504,65504),mi.floatView[0]=t;const e=mi.uint32View[0],n=e>>23&511;return mi.baseTable[n]+((8388607&e)>>mi.shiftTable[n])}function _i(t){const e=t>>10;return mi.uint32View[0]=mi.mantissaTable[mi.offsetTable[e]+(1023&t)]+mi.exponentTable[e],mi.floatView[0]}const vi={toHalfFloat:gi,fromHalfFloat:_i},xi=new We,yi=new me;class Mi{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=n,this.usage=Zt,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=H,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}get updateRange(){return console.warn("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],s=[];for(let e=0,i=n.length;e0&&(i[e]=s,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone(e));const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;t0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t(t.far-t.near)**2)return}Ui.copy(r).invert(),Di.copy(t.ray).applyMatrix4(Ui),null!==n.boundingBox&&!1===Di.intersectsBox(n.boundingBox)||this._computeIntersections(t,e,Di)}}_computeIntersections(t,e,n){let i;const r=this.geometry,s=this.material,a=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==a)if(Array.isArray(s))for(let r=0,o=u.length;rn.far?null:{distance:u,point:Zi.clone(),object:t}}(t,e,n,i,Fi,Bi,zi,Yi);if(d){r&&(Vi.fromBufferAttribute(r,c),ki.fromBufferAttribute(r,h),Wi.fromBufferAttribute(r,u),d.uv=ri.getInterpolation(Yi,Fi,Bi,zi,Vi,ki,Wi,new me)),o&&(Vi.fromBufferAttribute(o,c),ki.fromBufferAttribute(o,h),Wi.fromBufferAttribute(o,u),d.uv1=ri.getInterpolation(Yi,Fi,Bi,zi,Vi,ki,Wi,new me),d.uv2=d.uv1),l&&(Xi.fromBufferAttribute(l,c),ji.fromBufferAttribute(l,h),qi.fromBufferAttribute(l,u),d.normal=ri.getInterpolation(Yi,Fi,Bi,zi,Xi,ji,qi,new We),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const t={a:c,b:h,c:u,normal:new We,materialIndex:0};ri.getNormal(Fi,Bi,zi,t.normal),d.face=t}return d}class $i extends Ii{constructor(t=1,e=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const a=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const o=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,n,i,r,s,p,m,f,g,_){const v=s/f,x=p/g,y=s/2,M=p/2,S=m/2,b=f+1,T=g+1;let E=0,w=0;const A=new We;for(let s=0;s0?1:-1,c.push(A.x,A.y,A.z),h.push(o/f),h.push(1-s/g),E+=1}}for(let t=0;t0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class rr extends jn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Mn,this.projectionMatrix=new Mn,this.projectionMatrixInverse=new Mn,this.coordinateSystem=$t}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}class sr extends rr{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*re*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*ie*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*re*Math.atan(Math.tan(.5*ie*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(t,e,n,i,r,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*ie*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/a,i*=s.width/t,n*=s.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const ar=-90;class or extends jn{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new sr(ar,1,t,e);i.layers=this.layers,this.add(i);const r=new sr(ar,1,t,e);r.layers=this.layers,this.add(r);const s=new sr(ar,1,t,e);s.layers=this.layers,this.add(s);const a=new sr(ar,1,t,e);a.layers=this.layers,this.add(a);const o=new sr(ar,1,t,e);o.layers=this.layers,this.add(o);const l=new sr(ar,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,r,s,a,o]=e;for(const t of e)this.remove(t);if(t===$t)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==Qt)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,s,a,o,l,c]=this.children,h=t.getRenderTarget(),u=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,i),t.render(e,r),t.setRenderTarget(n,1,i),t.render(e,s),t.setRenderTarget(n,2,i),t.render(e,a),t.setRenderTarget(n,3,i),t.render(e,o),t.setRenderTarget(n,4,i),t.render(e,l),n.texture.generateMipmaps=m,t.setRenderTarget(n,5,i),t.render(e,c),t.setRenderTarget(h,u,d),t.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class lr extends Fe{constructor(t,e,n,i,r,s,a,o,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:b,n,i,r,s,a,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class cr extends Ge{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];void 0!==e.encoding&&(be("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),e.colorSpace=e.encoding===Bt?Gt:zt),this.texture=new lr(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:D}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new $i(5,5,5),r=new ir({name:"CubemapFromEquirect",uniforms:Qi(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:a,blending:0});r.uniforms.tEquirect.value=e;const s=new Ji(i,r),o=e.minFilter;e.minFilter===O&&(e.minFilter=D);return new or(1,10,this).update(t,s),e.minFilter=o,s.geometry.dispose(),s.material.dispose(),this}clear(t,e,n,i){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}const hr=new We,ur=new We,dr=new fe;class pr{constructor(t=new We(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=hr.subVectors(n,e).cross(ur.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(hr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||dr.getNormalMatrix(t),i=this.coplanarPoint(hr).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const mr=new dn,fr=new We;class gr{constructor(t=new pr,e=new pr,n=new pr,i=new pr,r=new pr,s=new pr){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(n),a[3].copy(i),a[4].copy(r),a[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=2e3){const n=this.planes,i=t.elements,r=i[0],s=i[1],a=i[2],o=i[3],l=i[4],c=i[5],h=i[6],u=i[7],d=i[8],p=i[9],m=i[10],f=i[11],g=i[12],_=i[13],v=i[14],x=i[15];if(n[0].setComponents(o-r,u-l,f-d,x-g).normalize(),n[1].setComponents(o+r,u+l,f+d,x+g).normalize(),n[2].setComponents(o+s,u+c,f+p,x+_).normalize(),n[3].setComponents(o-s,u-c,f-p,x-_).normalize(),n[4].setComponents(o-a,u-h,f-m,x-v).normalize(),e===$t)n[5].setComponents(o+a,u+h,f+m,x+v).normalize();else{if(e!==Qt)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(a,h,m,v).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),mr.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),mr.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(mr)}intersectsSprite(t){return mr.center.set(0,0,0),mr.radius=.7071067811865476,mr.applyMatrix4(t.matrixWorld),this.intersectsSphere(mr)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(n)0?t.max.x:t.min.x,fr.y=i.normal.y>0?t.max.y:t.min.y,fr.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(fr)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}function _r(){let t=null,e=!1,n=null,i=null;function r(e,s){n(e,s),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function vr(t,e){const n=e.isWebGL2,i=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),i.get(t)},remove:function(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=i.get(e);n&&(t.deleteBuffer(n.buffer),i.delete(e))},update:function(e,r){if(e.isGLBufferAttribute){const t=i.get(e);return void((!t||t.version 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor *= toneMappingExposure;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\treturn color;\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},Mr={common:{diffuse:{value:new ci(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new fe},alphaMap:{value:null},alphaMapTransform:{value:new fe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new fe}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new fe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new fe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new fe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new fe},normalScale:{value:new me(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new fe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new fe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new fe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new fe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ci(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ci(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new fe},alphaTest:{value:0},uvTransform:{value:new fe}},sprite:{diffuse:{value:new ci(16777215)},opacity:{value:1},center:{value:new me(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new fe},alphaMap:{value:null},alphaMapTransform:{value:new fe},alphaTest:{value:0}}},Sr={basic:{uniforms:tr([Mr.common,Mr.specularmap,Mr.envmap,Mr.aomap,Mr.lightmap,Mr.fog]),vertexShader:yr.meshbasic_vert,fragmentShader:yr.meshbasic_frag},lambert:{uniforms:tr([Mr.common,Mr.specularmap,Mr.envmap,Mr.aomap,Mr.lightmap,Mr.emissivemap,Mr.bumpmap,Mr.normalmap,Mr.displacementmap,Mr.fog,Mr.lights,{emissive:{value:new ci(0)}}]),vertexShader:yr.meshlambert_vert,fragmentShader:yr.meshlambert_frag},phong:{uniforms:tr([Mr.common,Mr.specularmap,Mr.envmap,Mr.aomap,Mr.lightmap,Mr.emissivemap,Mr.bumpmap,Mr.normalmap,Mr.displacementmap,Mr.fog,Mr.lights,{emissive:{value:new ci(0)},specular:{value:new ci(1118481)},shininess:{value:30}}]),vertexShader:yr.meshphong_vert,fragmentShader:yr.meshphong_frag},standard:{uniforms:tr([Mr.common,Mr.envmap,Mr.aomap,Mr.lightmap,Mr.emissivemap,Mr.bumpmap,Mr.normalmap,Mr.displacementmap,Mr.roughnessmap,Mr.metalnessmap,Mr.fog,Mr.lights,{emissive:{value:new ci(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:yr.meshphysical_vert,fragmentShader:yr.meshphysical_frag},toon:{uniforms:tr([Mr.common,Mr.aomap,Mr.lightmap,Mr.emissivemap,Mr.bumpmap,Mr.normalmap,Mr.displacementmap,Mr.gradientmap,Mr.fog,Mr.lights,{emissive:{value:new ci(0)}}]),vertexShader:yr.meshtoon_vert,fragmentShader:yr.meshtoon_frag},matcap:{uniforms:tr([Mr.common,Mr.bumpmap,Mr.normalmap,Mr.displacementmap,Mr.fog,{matcap:{value:null}}]),vertexShader:yr.meshmatcap_vert,fragmentShader:yr.meshmatcap_frag},points:{uniforms:tr([Mr.points,Mr.fog]),vertexShader:yr.points_vert,fragmentShader:yr.points_frag},dashed:{uniforms:tr([Mr.common,Mr.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:yr.linedashed_vert,fragmentShader:yr.linedashed_frag},depth:{uniforms:tr([Mr.common,Mr.displacementmap]),vertexShader:yr.depth_vert,fragmentShader:yr.depth_frag},normal:{uniforms:tr([Mr.common,Mr.bumpmap,Mr.normalmap,Mr.displacementmap,{opacity:{value:1}}]),vertexShader:yr.meshnormal_vert,fragmentShader:yr.meshnormal_frag},sprite:{uniforms:tr([Mr.sprite,Mr.fog]),vertexShader:yr.sprite_vert,fragmentShader:yr.sprite_frag},background:{uniforms:{uvTransform:{value:new fe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:yr.background_vert,fragmentShader:yr.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:yr.backgroundCube_vert,fragmentShader:yr.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:yr.cube_vert,fragmentShader:yr.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:yr.equirect_vert,fragmentShader:yr.equirect_frag},distanceRGBA:{uniforms:tr([Mr.common,Mr.displacementmap,{referencePosition:{value:new We},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:yr.distanceRGBA_vert,fragmentShader:yr.distanceRGBA_frag},shadow:{uniforms:tr([Mr.lights,Mr.fog,{color:{value:new ci(0)},opacity:{value:1}}]),vertexShader:yr.shadow_vert,fragmentShader:yr.shadow_frag}};Sr.physical={uniforms:tr([Sr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new fe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new fe},clearcoatNormalScale:{value:new me(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new fe},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new fe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new fe},sheen:{value:0},sheenColor:{value:new ci(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new fe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new fe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new fe},transmissionSamplerSize:{value:new me},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new fe},attenuationDistance:{value:0},attenuationColor:{value:new ci(0)},specularColor:{value:new ci(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new fe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new fe},anisotropyVector:{value:new me},anisotropyMap:{value:null},anisotropyMapTransform:{value:new fe}}]),vertexShader:yr.meshphysical_vert,fragmentShader:yr.meshphysical_frag};const br={r:0,b:0,g:0};function Tr(t,e,n,i,r,o,l){const c=new ci(0);let h,u,d=!0===o?0:1,p=null,m=0,f=null;function g(e,n){e.getRGB(br,er(t)),i.buffers.color.setClear(br.r,br.g,br.b,n,l)}return{getClearColor:function(){return c},setClearColor:function(t,e=1){c.set(t),d=e,g(c,d)},getClearAlpha:function(){return d},setClearAlpha:function(t){d=t,g(c,d)},render:function(o,_){let v=!1,x=!0===_.isScene?_.background:null;if(x&&x.isTexture){x=(_.backgroundBlurriness>0?n:e).get(x)}null===x?g(c,d):x&&x.isColor&&(g(x,1),v=!0);const y=t.xr.getEnvironmentBlendMode();"additive"===y?i.buffers.color.setClear(0,0,0,1,l):"alpha-blend"===y&&i.buffers.color.setClear(0,0,0,0,l),(t.autoClear||v)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),x&&(x.isCubeTexture||x.mapping===A)?(void 0===u&&(u=new Ji(new $i(1,1,1),new ir({name:"BackgroundCubeMaterial",uniforms:Qi(Sr.backgroundCube.uniforms),vertexShader:Sr.backgroundCube.vertexShader,fragmentShader:Sr.backgroundCube.fragmentShader,side:a,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=x,u.material.uniforms.flipEnvMap.value=x.isCubeTexture&&!1===x.isRenderTargetTexture?-1:1,u.material.uniforms.backgroundBlurriness.value=_.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,u.material.toneMapped=Re.getTransfer(x.colorSpace)!==Xt,p===x&&m===x.version&&f===t.toneMapping||(u.material.needsUpdate=!0,p=x,m=x.version,f=t.toneMapping),u.layers.enableAll(),o.unshift(u,u.geometry,u.material,0,0,null)):x&&x.isTexture&&(void 0===h&&(h=new Ji(new xr(2,2),new ir({name:"BackgroundMaterial",uniforms:Qi(Sr.background.uniforms),vertexShader:Sr.background.vertexShader,fragmentShader:Sr.background.fragmentShader,side:s,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(h)),h.material.uniforms.t2D.value=x,h.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,h.material.toneMapped=Re.getTransfer(x.colorSpace)!==Xt,!0===x.matrixAutoUpdate&&x.updateMatrix(),h.material.uniforms.uvTransform.value.copy(x.matrix),p===x&&m===x.version&&f===t.toneMapping||(h.material.needsUpdate=!0,p=x,m=x.version,f=t.toneMapping),h.layers.enableAll(),o.unshift(h,h.geometry,h.material,0,0,null))}}}function Er(t,e,n,i){const r=t.getParameter(t.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),a=i.isWebGL2||null!==s,o={},l=p(null);let c=l,h=!1;function u(e){return i.isWebGL2?t.bindVertexArray(e):s.bindVertexArrayOES(e)}function d(e){return i.isWebGL2?t.deleteVertexArray(e):s.deleteVertexArrayOES(e)}function p(t){const e=[],n=[],i=[];for(let t=0;t=0){const n=r[e];let i=s[e];if(void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;a++}}return c.attributesNum!==a||c.index!==i}(r,x,d,y),M&&function(t,e,n,i){const r={},s=e.attributes;let a=0;const o=n.getAttributes();for(const e in o){if(o[e].location>=0){let n=s[e];void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[e]=i,a++}}c.attributes=r,c.attributesNum=a,c.index=i}(r,x,d,y)}else{const t=!0===l.wireframe;c.geometry===x.id&&c.program===d.id&&c.wireframe===t||(c.geometry=x.id,c.program=d.id,c.wireframe=t,M=!0)}null!==y&&n.update(y,t.ELEMENT_ARRAY_BUFFER),(M||h)&&(h=!1,function(r,s,a,o){if(!1===i.isWebGL2&&(r.isInstancedMesh||o.isInstancedBufferGeometry)&&null===e.get("ANGLE_instanced_arrays"))return;m();const l=o.attributes,c=a.getAttributes(),h=s.defaultAttributeValues;for(const e in c){const s=c[e];if(s.location>=0){let a=l[e];if(void 0===a&&("instanceMatrix"===e&&r.instanceMatrix&&(a=r.instanceMatrix),"instanceColor"===e&&r.instanceColor&&(a=r.instanceColor)),void 0!==a){const e=a.normalized,l=a.itemSize,c=n.get(a);if(void 0===c)continue;const h=c.buffer,u=c.type,d=c.bytesPerElement,p=!0===i.isWebGL2&&(u===t.INT||u===t.UNSIGNED_INT||a.gpuType===z);if(a.isInterleavedBufferAttribute){const n=a.data,i=n.stride,c=a.offset;if(n.isInstancedInterleavedBuffer){for(let t=0;t0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const s="undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name;let a=void 0!==n.precision?n.precision:"highp";const o=r(a);o!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);const l=s||e.has("WEBGL_draw_buffers"),c=!0===n.logarithmicDepthBuffer,h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=t.getParameter(t.MAX_TEXTURE_SIZE),p=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),m=t.getParameter(t.MAX_VERTEX_ATTRIBS),f=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),g=t.getParameter(t.MAX_VARYING_VECTORS),_=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),v=u>0,x=s||e.has("OES_texture_float");return{isWebGL2:s,drawBuffers:l,getMaxAnisotropy:function(){if(void 0!==i)return i;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i},getMaxPrecision:r,precision:a,logarithmicDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:d,maxCubemapSize:p,maxAttributes:m,maxVertexUniforms:f,maxVaryings:g,maxFragmentUniforms:_,vertexTextures:v,floatFragmentTextures:x,floatVertexTextures:v&&x,maxSamples:s?t.getParameter(t.MAX_SAMPLES):0}}function Rr(t){const e=this;let n=null,i=0,r=!1,s=!1;const a=new pr,o=new fe,l={value:null,needsUpdate:!1};function c(t,n,i,r){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const e=i+4*s,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length0);e.numPlanes=i,e.numIntersection=0}();else{const t=s?0:i,e=4*t;let r=m.clippingState||null;l.value=r,r=c(u,o,e,h);for(let t=0;t!==e;++t)r[t]=n[t];m.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function Cr(t){let e=new WeakMap;function n(t,e){return e===E?t.mapping=b:e===w&&(t.mapping=T),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping;if(s===E||s===w){if(e.has(r)){return n(e.get(r).texture,r.mapping)}{const s=r.image;if(s&&s.height>0){const a=new cr(s.height/2);return a.fromEquirectangularTexture(t,r),e.set(r,a),r.addEventListener("dispose",i),n(a.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}class Lr extends rr{constructor(t=-1,e=1,n=1,i=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,a=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}const Pr=[.125,.215,.35,.446,.526,.582],Ir=20,Ur=new Lr,Dr=new ci;let Nr=null,Or=0,Fr=0;const Br=(1+Math.sqrt(5))/2,zr=1/Br,Gr=[new We(1,1,1),new We(-1,1,1),new We(1,1,-1),new We(-1,1,-1),new We(0,Br,zr),new We(0,Br,-zr),new We(zr,0,Br),new We(-zr,0,Br),new We(Br,zr,0),new We(-Br,zr,0)];class Hr{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){Nr=this._renderer.getRenderTarget(),Or=this._renderer.getActiveCubeFace(),Fr=this._renderer.getActiveMipmapLevel(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Xr(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Wr(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;tt-4?o=Pr[a-t+4-1]:0===a&&(o=0),i.push(o);const l=1/(s-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,m=3,f=2,g=1,_=new Float32Array(m*p*d),v=new Float32Array(f*p*d),x=new Float32Array(g*p*d);for(let t=0;t2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];_.set(i,m*p*t),v.set(u,f*p*t);const r=[t,t,t,t,t,t];x.set(r,g*p*t)}const y=new Ii;y.setAttribute("position",new Mi(_,m)),y.setAttribute("uv",new Mi(v,f)),y.setAttribute("faceIndex",new Mi(x,g)),e.push(y),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(Ir),r=new We(0,1,0),s=new ir({name:"SphericalGaussianBlur",defines:{n:Ir,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:jr(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return s}(i,t,e)}return i}_compileMaterial(t){const e=new Ji(this._lodPlanes[0],t);this._renderer.compile(e,Ur)}_sceneToCubeUV(t,e,n,i){const r=new sr(90,1,e,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,c=l.autoClear,h=l.toneMapping;l.getClearColor(Dr),l.toneMapping=p,l.autoClear=!1;const u=new pi({name:"PMREM.Background",side:a,depthWrite:!1,depthTest:!1}),d=new Ji(new $i,u);let m=!1;const f=t.background;f?f.isColor&&(u.color.copy(f),t.background=null,m=!0):(u.color.copy(Dr),m=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(r.up.set(0,s[e],0),r.lookAt(o[e],0,0)):1===n?(r.up.set(0,0,s[e]),r.lookAt(0,o[e],0)):(r.up.set(0,s[e],0),r.lookAt(0,0,o[e]));const a=this._cubeSize;kr(i,n*a,e>2?a:0,a,a),l.setRenderTarget(i),m&&l.render(d,r),l.render(t,r)}d.geometry.dispose(),d.material.dispose(),l.toneMapping=h,l.autoClear=c,t.background=f}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===b||t.mapping===T;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Xr()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Wr());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new Ji(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const a=this._cubeSize;kr(e,0,0,3*a,2*a),n.setRenderTarget(e),n.render(s,Ur)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;for(let e=1;eIr&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${m} samples when the maximum is set to 20`);const f=[];let g=0;for(let t=0;t_-4?i-_+4:0),4*(this._cubeSize-v),3*v,2*v),o.setRenderTarget(e),o.render(c,Ur)}}function Vr(t,e,n){const i=new Ge(t,e,n);return i.texture.mapping=A,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function kr(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Wr(){return new ir({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:jr(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Xr(){return new ir({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:jr(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function jr(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function qr(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,a=s===E||s===w,o=s===b||s===T;if(a||o){if(r.isRenderTargetTexture&&!0===r.needsPMREMUpdate){r.needsPMREMUpdate=!1;let i=e.get(r);return null===n&&(n=new Hr(t)),i=a?n.fromEquirectangular(r,i):n.fromCubemap(r,i),e.set(r,i),i.texture}if(e.has(r))return e.get(r).texture;{const s=r.image;if(a&&s&&s.height>0||o&&s&&function(t){let e=0;const n=6;for(let i=0;ie.maxTextureSize&&(E=Math.ceil(T/e.maxTextureSize),T=e.maxTextureSize);const w=new Float32Array(T*E*4*p),A=new He(w,T,E,p);A.type=H,A.needsUpdate=!0;const R=4*b;for(let L=0;L0)return t;const r=e*n;let s=ls[r];if(void 0===s&&(s=new Float32Array(r),ls[r]=s),0!==e){i.toArray(s,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(s,r)}return s}function ms(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n":" "} ${r}: ${n[t]}`)}return i.join("\n")}(t.getShaderSource(e),i)}return r}function da(t,e){const n=function(t){const e=Re.getPrimaries(Re.workingColorSpace),n=Re.getPrimaries(t);let i;switch(e===n?i="":e===qt&&n===jt?i="LinearDisplayP3ToLinearSRGB":e===jt&&n===qt&&(i="LinearSRGBToLinearDisplayP3"),t){case Ht:case kt:return[i,"LinearTransferOETF"];case Gt:case Vt:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[i,"LinearTransferOETF"]}}(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function pa(t,e){let n;switch(e){case m:n="Linear";break;case f:n="Reinhard";break;case g:n="OptimizedCineon";break;case _:n="ACESFilmic";break;case x:n="AgX";break;case v:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function ma(t){return""!==t}function fa(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function ga(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const _a=/^[ \t]*#include +<([\w\d./]+)>/gm;function va(t){return t.replace(_a,ya)}const xa=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function ya(t,e){let n=yr[e];if(void 0===n){const t=xa.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");n=yr[t],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return va(n)}const Ma=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Sa(t){return t.replace(Ma,ba)}function ba(t,e,n,i){let r="";for(let t=parseInt(e);t0&&(w+="\n"),R=[y,"#define SHADER_TYPE "+s.shaderType,"#define SHADER_NAME "+s.shaderName,S].filter(ma).join("\n"),R.length>0&&(R+="\n")):(w=[Ta(s),"#define SHADER_TYPE "+s.shaderType,"#define SHADER_NAME "+s.shaderName,S,s.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",s.batching?"#define USE_BATCHING":"",s.instancing?"#define USE_INSTANCING":"",s.instancingColor?"#define USE_INSTANCING_COLOR":"",s.useFog&&s.fog?"#define USE_FOG":"",s.useFog&&s.fogExp2?"#define FOG_EXP2":"",s.map?"#define USE_MAP":"",s.envMap?"#define USE_ENVMAP":"",s.envMap?"#define "+_:"",s.lightMap?"#define USE_LIGHTMAP":"",s.aoMap?"#define USE_AOMAP":"",s.bumpMap?"#define USE_BUMPMAP":"",s.normalMap?"#define USE_NORMALMAP":"",s.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",s.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",s.displacementMap?"#define USE_DISPLACEMENTMAP":"",s.emissiveMap?"#define USE_EMISSIVEMAP":"",s.anisotropy?"#define USE_ANISOTROPY":"",s.anisotropyMap?"#define USE_ANISOTROPYMAP":"",s.clearcoatMap?"#define USE_CLEARCOATMAP":"",s.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",s.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",s.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",s.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",s.specularMap?"#define USE_SPECULARMAP":"",s.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",s.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",s.roughnessMap?"#define USE_ROUGHNESSMAP":"",s.metalnessMap?"#define USE_METALNESSMAP":"",s.alphaMap?"#define USE_ALPHAMAP":"",s.alphaHash?"#define USE_ALPHAHASH":"",s.transmission?"#define USE_TRANSMISSION":"",s.transmissionMap?"#define USE_TRANSMISSIONMAP":"",s.thicknessMap?"#define USE_THICKNESSMAP":"",s.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",s.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",s.mapUv?"#define MAP_UV "+s.mapUv:"",s.alphaMapUv?"#define ALPHAMAP_UV "+s.alphaMapUv:"",s.lightMapUv?"#define LIGHTMAP_UV "+s.lightMapUv:"",s.aoMapUv?"#define AOMAP_UV "+s.aoMapUv:"",s.emissiveMapUv?"#define EMISSIVEMAP_UV "+s.emissiveMapUv:"",s.bumpMapUv?"#define BUMPMAP_UV "+s.bumpMapUv:"",s.normalMapUv?"#define NORMALMAP_UV "+s.normalMapUv:"",s.displacementMapUv?"#define DISPLACEMENTMAP_UV "+s.displacementMapUv:"",s.metalnessMapUv?"#define METALNESSMAP_UV "+s.metalnessMapUv:"",s.roughnessMapUv?"#define ROUGHNESSMAP_UV "+s.roughnessMapUv:"",s.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+s.anisotropyMapUv:"",s.clearcoatMapUv?"#define CLEARCOATMAP_UV "+s.clearcoatMapUv:"",s.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+s.clearcoatNormalMapUv:"",s.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+s.clearcoatRoughnessMapUv:"",s.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+s.iridescenceMapUv:"",s.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+s.iridescenceThicknessMapUv:"",s.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+s.sheenColorMapUv:"",s.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+s.sheenRoughnessMapUv:"",s.specularMapUv?"#define SPECULARMAP_UV "+s.specularMapUv:"",s.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+s.specularColorMapUv:"",s.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+s.specularIntensityMapUv:"",s.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+s.transmissionMapUv:"",s.thicknessMapUv?"#define THICKNESSMAP_UV "+s.thicknessMapUv:"",s.vertexTangents&&!1===s.flatShading?"#define USE_TANGENT":"",s.vertexColors?"#define USE_COLOR":"",s.vertexAlphas?"#define USE_COLOR_ALPHA":"",s.vertexUv1s?"#define USE_UV1":"",s.vertexUv2s?"#define USE_UV2":"",s.vertexUv3s?"#define USE_UV3":"",s.pointsUvs?"#define USE_POINTS_UV":"",s.flatShading?"#define FLAT_SHADED":"",s.skinning?"#define USE_SKINNING":"",s.morphTargets?"#define USE_MORPHTARGETS":"",s.morphNormals&&!1===s.flatShading?"#define USE_MORPHNORMALS":"",s.morphColors&&s.isWebGL2?"#define USE_MORPHCOLORS":"",s.morphTargetsCount>0&&s.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",s.morphTargetsCount>0&&s.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+s.morphTextureStride:"",s.morphTargetsCount>0&&s.isWebGL2?"#define MORPHTARGETS_COUNT "+s.morphTargetsCount:"",s.doubleSided?"#define DOUBLE_SIDED":"",s.flipSided?"#define FLIP_SIDED":"",s.shadowMapEnabled?"#define USE_SHADOWMAP":"",s.shadowMapEnabled?"#define "+f:"",s.sizeAttenuation?"#define USE_SIZEATTENUATION":"",s.numLightProbes>0?"#define USE_LIGHT_PROBES":"",s.useLegacyLights?"#define LEGACY_LIGHTS":"",s.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",s.logarithmicDepthBuffer&&s.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ma).join("\n"),R=[y,Ta(s),"#define SHADER_TYPE "+s.shaderType,"#define SHADER_NAME "+s.shaderName,S,s.useFog&&s.fog?"#define USE_FOG":"",s.useFog&&s.fogExp2?"#define FOG_EXP2":"",s.map?"#define USE_MAP":"",s.matcap?"#define USE_MATCAP":"",s.envMap?"#define USE_ENVMAP":"",s.envMap?"#define "+g:"",s.envMap?"#define "+_:"",s.envMap?"#define "+v:"",x?"#define CUBEUV_TEXEL_WIDTH "+x.texelWidth:"",x?"#define CUBEUV_TEXEL_HEIGHT "+x.texelHeight:"",x?"#define CUBEUV_MAX_MIP "+x.maxMip+".0":"",s.lightMap?"#define USE_LIGHTMAP":"",s.aoMap?"#define USE_AOMAP":"",s.bumpMap?"#define USE_BUMPMAP":"",s.normalMap?"#define USE_NORMALMAP":"",s.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",s.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",s.emissiveMap?"#define USE_EMISSIVEMAP":"",s.anisotropy?"#define USE_ANISOTROPY":"",s.anisotropyMap?"#define USE_ANISOTROPYMAP":"",s.clearcoat?"#define USE_CLEARCOAT":"",s.clearcoatMap?"#define USE_CLEARCOATMAP":"",s.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",s.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",s.iridescence?"#define USE_IRIDESCENCE":"",s.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",s.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",s.specularMap?"#define USE_SPECULARMAP":"",s.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",s.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",s.roughnessMap?"#define USE_ROUGHNESSMAP":"",s.metalnessMap?"#define USE_METALNESSMAP":"",s.alphaMap?"#define USE_ALPHAMAP":"",s.alphaTest?"#define USE_ALPHATEST":"",s.alphaHash?"#define USE_ALPHAHASH":"",s.sheen?"#define USE_SHEEN":"",s.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",s.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",s.transmission?"#define USE_TRANSMISSION":"",s.transmissionMap?"#define USE_TRANSMISSIONMAP":"",s.thicknessMap?"#define USE_THICKNESSMAP":"",s.vertexTangents&&!1===s.flatShading?"#define USE_TANGENT":"",s.vertexColors||s.instancingColor?"#define USE_COLOR":"",s.vertexAlphas?"#define USE_COLOR_ALPHA":"",s.vertexUv1s?"#define USE_UV1":"",s.vertexUv2s?"#define USE_UV2":"",s.vertexUv3s?"#define USE_UV3":"",s.pointsUvs?"#define USE_POINTS_UV":"",s.gradientMap?"#define USE_GRADIENTMAP":"",s.flatShading?"#define FLAT_SHADED":"",s.doubleSided?"#define DOUBLE_SIDED":"",s.flipSided?"#define FLIP_SIDED":"",s.shadowMapEnabled?"#define USE_SHADOWMAP":"",s.shadowMapEnabled?"#define "+f:"",s.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",s.numLightProbes>0?"#define USE_LIGHT_PROBES":"",s.useLegacyLights?"#define LEGACY_LIGHTS":"",s.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",s.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",s.logarithmicDepthBuffer&&s.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",s.toneMapping!==p?"#define TONE_MAPPING":"",s.toneMapping!==p?yr.tonemapping_pars_fragment:"",s.toneMapping!==p?pa("toneMapping",s.toneMapping):"",s.dithering?"#define DITHERING":"",s.opaque?"#define OPAQUE":"",yr.colorspace_pars_fragment,da("linearToOutputTexel",s.outputColorSpace),s.useDepthPacking?"#define DEPTH_PACKING "+s.depthPacking:"","\n"].filter(ma).join("\n")),c=va(c),c=fa(c,s),c=ga(c,s),m=va(m),m=fa(m,s),m=ga(m,s),c=Sa(c),m=Sa(m),s.isWebGL2&&!0!==s.isRawShaderMaterial&&(C="#version 300 es\n",w=[M,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+w,R=["precision mediump sampler2DArray;","#define varying in",s.glslVersion===Jt?"":"layout(location = 0) out highp vec4 pc_fragColor;",s.glslVersion===Jt?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+R);const L=C+w+c,P=C+R+m,I=la(o,o.VERTEX_SHADER,L),U=la(o,o.FRAGMENT_SHADER,P);function D(e){if(t.debug.checkShaderErrors){const n=o.getProgramInfoLog(E).trim(),i=o.getShaderInfoLog(I).trim(),r=o.getShaderInfoLog(U).trim();let s=!0,a=!0;if(!1===o.getProgramParameter(E,o.LINK_STATUS))if(s=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(o,E,I,U);else{const t=ua(o,I,"vertex"),e=ua(o,U,"fragment");console.error("THREE.WebGLProgram: Shader Error "+o.getError()+" - VALIDATE_STATUS "+o.getProgramParameter(E,o.VALIDATE_STATUS)+"\n\nProgram Info Log: "+n+"\n"+t+"\n"+e)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==r||(a=!1);a&&(e.diagnostics={runnable:s,programLog:n,vertexShader:{log:i,prefix:w},fragmentShader:{log:r,prefix:R}})}o.deleteShader(I),o.deleteShader(U),N=new oa(o,E),O=function(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r0,Z=s.clearcoat>0,J=s.iridescence>0,K=s.sheen>0,$=s.transmission>0,Q=Y&&!!s.anisotropyMap,tt=Z&&!!s.clearcoatMap,et=Z&&!!s.clearcoatNormalMap,nt=Z&&!!s.clearcoatRoughnessMap,it=J&&!!s.iridescenceMap,rt=J&&!!s.iridescenceThicknessMap,st=K&&!!s.sheenColorMap,at=K&&!!s.sheenRoughnessMap,ot=!!s.specularMap,lt=!!s.specularColorMap,ct=!!s.specularIntensityMap,ht=$&&!!s.transmissionMap,ut=$&&!!s.thicknessMap,dt=!!s.gradientMap,pt=!!s.alphaMap,mt=s.alphaTest>0,ft=!!s.alphaHash,gt=!!s.extensions,_t=!!M.attributes.uv1,vt=!!M.attributes.uv2,xt=!!M.attributes.uv3;let yt=p;return s.toneMapped&&(null!==D&&!0!==D.isXRRenderTarget||(yt=t.toneMapping)),{isWebGL2:u,shaderID:E,shaderType:s.type,shaderName:s.name,vertexShader:C,fragmentShader:L,defines:s.defines,customVertexShaderID:P,customFragmentShaderID:I,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:f,batching:O,instancing:N,instancingColor:N&&null!==x.instanceColor,supportsVertexTextures:m,outputColorSpace:null===D?t.outputColorSpace:!0===D.isXRRenderTarget?D.texture.colorSpace:Ht,map:F,matcap:B,envMap:z,envMapMode:z&&b.mapping,envMapCubeUVHeight:T,aoMap:G,lightMap:H,bumpMap:V,normalMap:k,displacementMap:m&&W,emissiveMap:X,normalMapObjectSpace:k&&1===s.normalMapType,normalMapTangentSpace:k&&0===s.normalMapType,metalnessMap:j,roughnessMap:q,anisotropy:Y,anisotropyMap:Q,clearcoat:Z,clearcoatMap:tt,clearcoatNormalMap:et,clearcoatRoughnessMap:nt,iridescence:J,iridescenceMap:it,iridescenceThicknessMap:rt,sheen:K,sheenColorMap:st,sheenRoughnessMap:at,specularMap:ot,specularColorMap:lt,specularIntensityMap:ct,transmission:$,transmissionMap:ht,thicknessMap:ut,gradientMap:dt,opaque:!1===s.transparent&&1===s.blending,alphaMap:pt,alphaTest:mt,alphaHash:ft,combine:s.combine,mapUv:F&&_(s.map.channel),aoMapUv:G&&_(s.aoMap.channel),lightMapUv:H&&_(s.lightMap.channel),bumpMapUv:V&&_(s.bumpMap.channel),normalMapUv:k&&_(s.normalMap.channel),displacementMapUv:W&&_(s.displacementMap.channel),emissiveMapUv:X&&_(s.emissiveMap.channel),metalnessMapUv:j&&_(s.metalnessMap.channel),roughnessMapUv:q&&_(s.roughnessMap.channel),anisotropyMapUv:Q&&_(s.anisotropyMap.channel),clearcoatMapUv:tt&&_(s.clearcoatMap.channel),clearcoatNormalMapUv:et&&_(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:nt&&_(s.clearcoatRoughnessMap.channel),iridescenceMapUv:it&&_(s.iridescenceMap.channel),iridescenceThicknessMapUv:rt&&_(s.iridescenceThicknessMap.channel),sheenColorMapUv:st&&_(s.sheenColorMap.channel),sheenRoughnessMapUv:at&&_(s.sheenRoughnessMap.channel),specularMapUv:ot&&_(s.specularMap.channel),specularColorMapUv:lt&&_(s.specularColorMap.channel),specularIntensityMapUv:ct&&_(s.specularIntensityMap.channel),transmissionMapUv:ht&&_(s.transmissionMap.channel),thicknessMapUv:ut&&_(s.thicknessMap.channel),alphaMapUv:pt&&_(s.alphaMap.channel),vertexTangents:!!M.attributes.tangent&&(k||Y),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!M.attributes.color&&4===M.attributes.color.itemSize,vertexUv1s:_t,vertexUv2s:vt,vertexUv3s:xt,pointsUvs:!0===x.isPoints&&!!M.attributes.uv&&(F||pt),fog:!!y,useFog:!0===s.fog,fogExp2:y&&y.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:d,skinning:!0===x.isSkinnedMesh,morphTargets:void 0!==M.morphAttributes.position,morphNormals:void 0!==M.morphAttributes.normal,morphColors:void 0!==M.morphAttributes.color,morphTargetsCount:R,morphTextureStride:U,numDirLights:l.directional.length,numPointLights:l.point.length,numSpotLights:l.spot.length,numSpotLightMaps:l.spotLightMap.length,numRectAreaLights:l.rectArea.length,numHemiLights:l.hemi.length,numDirLightShadows:l.directionalShadowMap.length,numPointLightShadows:l.pointShadowMap.length,numSpotLightShadows:l.spotShadowMap.length,numSpotLightShadowsWithMaps:l.numSpotLightShadowsWithMaps,numLightProbes:l.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:yt,useLegacyLights:t._useLegacyLights,decodeVideoTexture:F&&!0===s.map.isVideoTexture&&Re.getTransfer(s.map.colorSpace)===Xt,premultipliedAlpha:s.premultipliedAlpha,doubleSided:2===s.side,flipSided:s.side===a,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionDerivatives:gt&&!0===s.extensions.derivatives,extensionFragDepth:gt&&!0===s.extensions.fragDepth,extensionDrawBuffers:gt&&!0===s.extensions.drawBuffers,extensionShaderTextureLOD:gt&&!0===s.extensions.shaderTextureLOD,extensionClipCullDistance:gt&&s.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:s.customProgramCacheKey()}},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(n,e),function(t,e){l.disableAll(),e.isWebGL2&&l.enable(0);e.supportsVertexTextures&&l.enable(1);e.instancing&&l.enable(2);e.instancingColor&&l.enable(3);e.matcap&&l.enable(4);e.envMap&&l.enable(5);e.normalMapObjectSpace&&l.enable(6);e.normalMapTangentSpace&&l.enable(7);e.clearcoat&&l.enable(8);e.iridescence&&l.enable(9);e.alphaTest&&l.enable(10);e.vertexColors&&l.enable(11);e.vertexAlphas&&l.enable(12);e.vertexUv1s&&l.enable(13);e.vertexUv2s&&l.enable(14);e.vertexUv3s&&l.enable(15);e.vertexTangents&&l.enable(16);e.anisotropy&&l.enable(17);e.alphaHash&&l.enable(18);e.batching&&l.enable(19);t.push(l.mask),l.disableAll(),e.fog&&l.enable(0);e.useFog&&l.enable(1);e.flatShading&&l.enable(2);e.logarithmicDepthBuffer&&l.enable(3);e.skinning&&l.enable(4);e.morphTargets&&l.enable(5);e.morphNormals&&l.enable(6);e.morphColors&&l.enable(7);e.premultipliedAlpha&&l.enable(8);e.shadowMapEnabled&&l.enable(9);e.useLegacyLights&&l.enable(10);e.doubleSided&&l.enable(11);e.flipSided&&l.enable(12);e.useDepthPacking&&l.enable(13);e.dithering&&l.enable(14);e.transmission&&l.enable(15);e.sheen&&l.enable(16);e.opaque&&l.enable(17);e.pointsUvs&&l.enable(18);e.decodeVideoTexture&&l.enable(19);t.push(l.mask)}(n,e),n.push(t.outputColorSpace)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=g[t.type];let n;if(e){const t=Sr[e];n=nr.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=h.length;t0?i.push(h):!0===a.transparent?r.push(h):n.push(h)},unshift:function(t,e,a,o,l,c){const h=s(t,e,a,o,l,c);a.transmission>0?i.unshift(h):!0===a.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=e,i=t.length;n1&&n.sort(t||Pa),i.length>1&&i.sort(e||Ia),r.length>1&&r.sort(e||Ia)}}}function Da(){let t=new WeakMap;return{get:function(e,n){const i=t.get(e);let r;return void 0===i?(r=new Ua,t.set(e,[r])):n>=i.length?(r=new Ua,i.push(r)):r=i[n],r},dispose:function(){t=new WeakMap}}}function Na(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new We,color:new ci};break;case"SpotLight":n={position:new We,direction:new We,color:new ci,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new We,color:new ci,distance:0,decay:0};break;case"HemisphereLight":n={direction:new We,skyColor:new ci,groundColor:new ci};break;case"RectAreaLight":n={color:new ci,position:new We,halfWidth:new We,halfHeight:new We}}return t[e.id]=n,n}}}let Oa=0;function Fa(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function Ba(t,e){const n=new Na,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new me};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new me,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)r.probe.push(new We);const s=new We,a=new Mn,o=new Mn;return{setup:function(s,a){let o=0,l=0,c=0;for(let t=0;t<9;t++)r.probe[t].set(0,0,0);let h=0,u=0,d=0,p=0,m=0,f=0,g=0,_=0,v=0,x=0,y=0;s.sort(Fa);const M=!0===a?Math.PI:1;for(let t=0,e=s.length;t0&&(e.isWebGL2?!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Mr.LTC_FLOAT_1,r.rectAreaLTC2=Mr.LTC_FLOAT_2):(r.rectAreaLTC1=Mr.LTC_HALF_1,r.rectAreaLTC2=Mr.LTC_HALF_2):!0===t.has("OES_texture_float_linear")?(r.rectAreaLTC1=Mr.LTC_FLOAT_1,r.rectAreaLTC2=Mr.LTC_FLOAT_2):!0===t.has("OES_texture_half_float_linear")?(r.rectAreaLTC1=Mr.LTC_HALF_1,r.rectAreaLTC2=Mr.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=o,r.ambient[1]=l,r.ambient[2]=c;const S=r.hash;S.directionalLength===h&&S.pointLength===u&&S.spotLength===d&&S.rectAreaLength===p&&S.hemiLength===m&&S.numDirectionalShadows===f&&S.numPointShadows===g&&S.numSpotShadows===_&&S.numSpotMaps===v&&S.numLightProbes===y||(r.directional.length=h,r.spot.length=d,r.rectArea.length=p,r.point.length=u,r.hemi.length=m,r.directionalShadow.length=f,r.directionalShadowMap.length=f,r.pointShadow.length=g,r.pointShadowMap.length=g,r.spotShadow.length=_,r.spotShadowMap.length=_,r.directionalShadowMatrix.length=f,r.pointShadowMatrix.length=g,r.spotLightMatrix.length=_+v-x,r.spotLightMap.length=v,r.numSpotLightShadowsWithMaps=x,r.numLightProbes=y,S.directionalLength=h,S.pointLength=u,S.spotLength=d,S.rectAreaLength=p,S.hemiLength=m,S.numDirectionalShadows=f,S.numPointShadows=g,S.numSpotShadows=_,S.numSpotMaps=v,S.numLightProbes=y,r.version=Oa++)},setupView:function(t,e){let n=0,i=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e=s.length?(a=new za(t,e),s.push(a)):a=s[r],a},dispose:function(){n=new WeakMap}}}class Ha extends di{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class Va extends di{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function ka(t,e,i){let o=new gr;const l=new me,c=new me,h=new Be,u=new Ha({depthPacking:3201}),d=new Va,p={},m=i.maxTextureSize,f={[s]:a,[a]:s,2:2},g=new ir({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new me},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),_=g.clone();_.defines.HORIZONTAL_PASS=1;const v=new Ii;v.setAttribute("position",new Mi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Ji(v,g),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=n;let M=this.type;function S(n,i){const r=e.update(x);g.defines.VSM_SAMPLES!==n.blurSamples&&(g.defines.VSM_SAMPLES=n.blurSamples,_.defines.VSM_SAMPLES=n.blurSamples,g.needsUpdate=!0,_.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Ge(l.x,l.y)),g.uniforms.shadow_pass.value=n.map.texture,g.uniforms.resolution.value=n.mapSize,g.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,g,x,null),_.uniforms.shadow_pass.value=n.mapPass.texture,_.uniforms.resolution.value=n.mapSize,_.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,_,x,null)}function b(e,n,i,s){let a=null;const o=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==o)a=o;else if(a=!0===i.isPointLight?d:u,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const t=a.uuid,e=n.uuid;let i=p[t];void 0===i&&(i={},p[t]=i);let r=i[e];void 0===r&&(r=a.clone(),i[e]=r,n.addEventListener("dispose",E)),a=r}if(a.visible=n.visible,a.wireframe=n.wireframe,a.side=s===r?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:f[n.side],a.alphaMap=n.alphaMap,a.alphaTest=n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial){t.properties.get(a).light=i}return a}function T(n,i,s,a,l){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&l===r)&&(!n.frustumCulled||o.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const r=e.update(n),o=n.material;if(Array.isArray(o)){const e=r.groups;for(let c=0,h=e.length;cm||l.y>m)&&(l.x>m&&(c.x=Math.floor(m/g.x),l.x=c.x*g.x,u.mapSize.x=c.x),l.y>m&&(c.y=Math.floor(m/g.y),l.y=c.y*g.y,u.mapSize.y=c.y)),null===u.map||!0===p||!0===f){const t=this.type!==r?{minFilter:P,magFilter:P}:{};null!==u.map&&u.map.dispose(),u.map=new Ge(l.x,l.y,t),u.map.texture.name=a.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const _=u.getViewportCount();for(let t=0;t<_;t++){const e=u.getViewport(t);h.set(c.x*e.x,c.y*e.y,c.x*e.z,c.y*e.w),d.viewport(h),u.updateMatrices(a,t),o=u.getFrustum(),T(n,i,u.camera,a,this.type)}!0!==u.isPointLightShadow&&this.type===r&&S(u,i),u.needsUpdate=!1}M=this.type,y.needsUpdate=!1,t.setRenderTarget(s,a,u)}}function Wa(t,e,n){const i=n.isWebGL2;const r=new function(){let e=!1;const n=new Be;let i=null;const r=new Be(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,s,a,o){!0===o&&(e*=a,i*=a,s*=a),n.set(e,i,s,a),!1===r.equals(n)&&(t.clearColor(e,i,s,a),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},s=new function(){let e=!1,n=null,i=null,r=null;return{setTest:function(e){e?j(t.DEPTH_TEST):q(t.DEPTH_TEST)},setMask:function(i){n===i||e||(t.depthMask(i),n=i)},setFunc:function(e){if(i!==e){switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}i=e}},setLocked:function(t){e=t},setClear:function(e){r!==e&&(t.clearDepth(e),r=e)},reset:function(){e=!1,n=null,i=null,r=null}}},h=new function(){let e=!1,n=null,i=null,r=null,s=null,a=null,o=null,l=null,c=null;return{setTest:function(n){e||(n?j(t.STENCIL_TEST):q(t.STENCIL_TEST))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,a){i===e&&r===n&&s===a||(t.stencilFunc(e,n,a),i=e,r=n,s=a)},setOp:function(e,n,i){a===e&&o===n&&l===i||(t.stencilOp(e,n,i),a=e,o=n,l=i)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,i=null,r=null,s=null,a=null,o=null,l=null,c=null}}},u=new WeakMap,d=new WeakMap;let p={},m={},f=new WeakMap,g=[],_=null,v=!1,x=null,y=null,M=null,S=null,b=null,T=null,E=null,w=new ci(0,0,0),A=0,R=!1,C=null,L=null,P=null,I=null,U=null;const D=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let N=!1,O=0;const F=t.getParameter(t.VERSION);-1!==F.indexOf("WebGL")?(O=parseFloat(/^WebGL (\d)/.exec(F)[1]),N=O>=1):-1!==F.indexOf("OpenGL ES")&&(O=parseFloat(/^OpenGL ES (\d)/.exec(F)[1]),N=O>=2);let B=null,z={};const G=t.getParameter(t.SCISSOR_BOX),H=t.getParameter(t.VIEWPORT),V=(new Be).fromArray(G),k=(new Be).fromArray(H);function W(e,n,r,s){const a=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let o=0;oi||t.height>i)&&(r=i/Math.max(t.width,t.height)),r<1||!0===e){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const i=e?he:Math.floor,s=i(r*t.width),a=i(r*t.height);void 0===u&&(u=m(s,a));const o=n?m(s,a):u;o.width=s,o.height=a;return o.getContext("2d").drawImage(t,0,0,s,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+t.width+"x"+t.height+") to ("+s+"x"+a+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+t.width+"x"+t.height+")."),t}return t}function g(t){return ce(t.width)&&ce(t.height)}function _(t,e){return t.generateMipmaps&&e&&t.minFilter!==P&&t.minFilter!==D}function v(e){t.generateMipmap(e)}function x(n,i,r,s,a=!1){if(!1===o)return i;if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let l=i;if(i===t.RED&&(r===t.FLOAT&&(l=t.R32F),r===t.HALF_FLOAT&&(l=t.R16F),r===t.UNSIGNED_BYTE&&(l=t.R8)),i===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(l=t.R8UI),r===t.UNSIGNED_SHORT&&(l=t.R16UI),r===t.UNSIGNED_INT&&(l=t.R32UI),r===t.BYTE&&(l=t.R8I),r===t.SHORT&&(l=t.R16I),r===t.INT&&(l=t.R32I)),i===t.RG&&(r===t.FLOAT&&(l=t.RG32F),r===t.HALF_FLOAT&&(l=t.RG16F),r===t.UNSIGNED_BYTE&&(l=t.RG8)),i===t.RGBA){const e=a?Wt:Re.getTransfer(s);r===t.FLOAT&&(l=t.RGBA32F),r===t.HALF_FLOAT&&(l=t.RGBA16F),r===t.UNSIGNED_BYTE&&(l=e===Xt?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(l=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(l=t.RGB5_A1)}return l!==t.R16F&&l!==t.R32F&&l!==t.RG16F&&l!==t.RG32F&&l!==t.RGBA16F&&l!==t.RGBA32F||e.get("EXT_color_buffer_float"),l}function y(t,e,n){return!0===_(t,n)||t.isFramebufferTexture&&t.minFilter!==P&&t.minFilter!==D?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function M(e){return e===P||e===I||e===U?t.NEAREST:t.LINEAR}function S(t){const e=t.target;e.removeEventListener("dispose",S),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=d.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&T(t),0===Object.keys(r).length&&d.delete(n)}i.remove(t)}(e),e.isVideoTexture&&h.delete(e)}function b(e){const n=e.target;n.removeEventListener("dispose",b),function(e){const n=e.texture,r=i.get(e),s=i.get(n);void 0!==s.__webglTexture&&(t.deleteTexture(s.__webglTexture),a.memory.textures--);e.depthTexture&&e.depthTexture.dispose();if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(r.__webglFramebuffer[e]))for(let n=0;n0&&s.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==t.complete)return void J(s,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(t.TEXTURE_2D,s.__webglTexture,t.TEXTURE0+r)}const A={[R]:t.REPEAT,[C]:t.CLAMP_TO_EDGE,[L]:t.MIRRORED_REPEAT},z={[P]:t.NEAREST,[I]:t.NEAREST_MIPMAP_NEAREST,[U]:t.NEAREST_MIPMAP_LINEAR,[D]:t.LINEAR,[N]:t.LINEAR_MIPMAP_NEAREST,[O]:t.LINEAR_MIPMAP_LINEAR},k={512:t.NEVER,519:t.ALWAYS,513:t.LESS,515:t.LEQUAL,514:t.EQUAL,518:t.GEQUAL,516:t.GREATER,517:t.NOTEQUAL};function W(n,s,a){if(a?(t.texParameteri(n,t.TEXTURE_WRAP_S,A[s.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,A[s.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,A[s.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,z[s.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,z[s.minFilter])):(t.texParameteri(n,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(n,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),s.wrapS===C&&s.wrapT===C||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(n,t.TEXTURE_MAG_FILTER,M(s.magFilter)),t.texParameteri(n,t.TEXTURE_MIN_FILTER,M(s.minFilter)),s.minFilter!==P&&s.minFilter!==D&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),s.compareFunction&&(t.texParameteri(n,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(n,t.TEXTURE_COMPARE_FUNC,k[s.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){const a=e.get("EXT_texture_filter_anisotropic");if(s.magFilter===P)return;if(s.minFilter!==U&&s.minFilter!==O)return;if(s.type===H&&!1===e.has("OES_texture_float_linear"))return;if(!1===o&&s.type===V&&!1===e.has("OES_texture_half_float_linear"))return;(s.anisotropy>1||i.get(s).__currentAnisotropy)&&(t.texParameterf(n,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy)}}function Z(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",S));const r=n.source;let s=d.get(r);void 0===s&&(s={},d.set(r,s));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(n);if(o!==e.__cacheKey){void 0===s[o]&&(s[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,i=!0),s[o].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&T(n)),e.__cacheKey=o,e.__webglTexture=s[o].texture}return i}function J(e,a,l){let c=t.TEXTURE_2D;(a.isDataArrayTexture||a.isCompressedArrayTexture)&&(c=t.TEXTURE_2D_ARRAY),a.isData3DTexture&&(c=t.TEXTURE_3D);const h=Z(e,a),u=a.source;n.bindTexture(c,e.__webglTexture,t.TEXTURE0+l);const d=i.get(u);if(u.version!==d.__version||!0===h){n.activeTexture(t.TEXTURE0+l);const e=Re.getPrimaries(Re.workingColorSpace),i=a.colorSpace===zt?null:Re.getPrimaries(a.colorSpace),p=a.colorSpace===zt||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,p);const m=function(t){return!o&&(t.wrapS!==C||t.wrapT!==C||t.minFilter!==P&&t.minFilter!==D)}(a)&&!1===g(a.image);let M=f(a.image,m,!1,r.maxTextureSize);M=nt(a,M);const S=g(M)||o,b=s.convert(a.format,a.colorSpace);let T,E=s.convert(a.type),w=x(a.internalFormat,b,E,a.colorSpace,a.isVideoTexture);W(c,a,S);const A=a.mipmaps,R=o&&!0!==a.isVideoTexture&&w!==at,L=void 0===d.__version||!0===h,I=y(a,M,S);if(a.isDepthTexture)w=t.DEPTH_COMPONENT,o?w=a.type===H?t.DEPTH_COMPONENT32F:a.type===G?t.DEPTH_COMPONENT24:a.type===X?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT16:a.type===H&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),a.format===q&&w===t.DEPTH_COMPONENT&&a.type!==B&&a.type!==G&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),a.type=G,E=s.convert(a.type)),a.format===Y&&w===t.DEPTH_COMPONENT&&(w=t.DEPTH_STENCIL,a.type!==X&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),a.type=X,E=s.convert(a.type))),L&&(R?n.texStorage2D(t.TEXTURE_2D,1,w,M.width,M.height):n.texImage2D(t.TEXTURE_2D,0,w,M.width,M.height,0,b,E,null));else if(a.isDataTexture)if(A.length>0&&S){R&&L&&n.texStorage2D(t.TEXTURE_2D,I,w,A[0].width,A[0].height);for(let e=0,i=A.length;e>=1,i>>=1}}else if(A.length>0&&S){R&&L&&n.texStorage2D(t.TEXTURE_2D,I,w,A[0].width,A[0].height);for(let e=0,i=A.length;e>h),i=Math.max(1,r.height>>h);c===t.TEXTURE_3D||c===t.TEXTURE_2D_ARRAY?n.texImage3D(c,h,p,e,i,r.depth,0,u,d,null):n.texImage2D(c,h,p,e,i,0,u,d,null)}n.bindFramebuffer(t.FRAMEBUFFER,e),et(r)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,o,c,i.get(a).__webglTexture,0,tt(r)):(c===t.TEXTURE_2D||c>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,o,c,i.get(a).__webglTexture,h),n.bindFramebuffer(t.FRAMEBUFFER,null)}function $(e,n,i){if(t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer&&!n.stencilBuffer){let r=!0===o?t.DEPTH_COMPONENT24:t.DEPTH_COMPONENT16;if(i||et(n)){const e=n.depthTexture;e&&e.isDepthTexture&&(e.type===H?r=t.DEPTH_COMPONENT32F:e.type===G&&(r=t.DEPTH_COMPONENT24));const i=tt(n);et(n)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,i,r,n.width,n.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,i,r,n.width,n.height)}else t.renderbufferStorage(t.RENDERBUFFER,r,n.width,n.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e)}else if(n.depthBuffer&&n.stencilBuffer){const r=tt(n);i&&!1===et(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,r,t.DEPTH24_STENCIL8,n.width,n.height):et(n)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,r,t.DEPTH24_STENCIL8,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e)}else{const e=!0===n.isWebGLMultipleRenderTargets?n.texture:[n.texture];for(let r=0;r0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function nt(t,n){const i=t.colorSpace,r=t.format,s=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||t.format===Kt||i!==Ht&&i!==zt&&(Re.getTransfer(i)===Xt?!1===o?!0===e.has("EXT_sRGB")&&r===j?(t.format=Kt,t.minFilter=D,t.generateMipmaps=!1):n=Ie.sRGBToLinear(n):r===j&&s===F||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",i)),n}this.allocateTextureUnit=function(){const t=E;return t>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+r.maxTextures),E+=1,t},this.resetTextureUnits=function(){E=0},this.setTexture2D=w,this.setTexture2DArray=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?J(s,e,r):n.bindTexture(t.TEXTURE_2D_ARRAY,s.__webglTexture,t.TEXTURE0+r)},this.setTexture3D=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?J(s,e,r):n.bindTexture(t.TEXTURE_3D,s.__webglTexture,t.TEXTURE0+r)},this.setTextureCube=function(e,a){const l=i.get(e);e.version>0&&l.__version!==e.version?function(e,a,l){if(6!==a.image.length)return;const c=Z(e,a),h=a.source;n.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+l);const u=i.get(h);if(h.version!==u.__version||!0===c){n.activeTexture(t.TEXTURE0+l);const e=Re.getPrimaries(Re.workingColorSpace),i=a.colorSpace===zt?null:Re.getPrimaries(a.colorSpace),d=a.colorSpace===zt||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);const p=a.isCompressedTexture||a.image[0].isCompressedTexture,m=a.image[0]&&a.image[0].isDataTexture,M=[];for(let t=0;t<6;t++)M[t]=p||m?m?a.image[t].image:a.image[t]:f(a.image[t],!1,!0,r.maxCubemapSize),M[t]=nt(a,M[t]);const S=M[0],b=g(S)||o,T=s.convert(a.format,a.colorSpace),E=s.convert(a.type),w=x(a.internalFormat,T,E,a.colorSpace),A=o&&!0!==a.isVideoTexture,R=void 0===u.__version||!0===c;let C,L=y(a,S,b);if(W(t.TEXTURE_CUBE_MAP,a,b),p){A&&R&&n.texStorage2D(t.TEXTURE_CUBE_MAP,L,w,S.width,S.height);for(let e=0;e<6;e++){C=M[e].mipmaps;for(let i=0;i0&&L++,n.texStorage2D(t.TEXTURE_CUBE_MAP,L,w,M[0].width,M[0].height));for(let e=0;e<6;e++)if(m){A?n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,M[e].width,M[e].height,T,E,M[e].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,w,M[e].width,M[e].height,0,T,E,M[e].data);for(let i=0;i0){c.__webglFramebuffer[e]=[];for(let n=0;n0){c.__webglFramebuffer=[];for(let e=0;e0&&!1===et(e)){const i=d?l:[l];c.__webglMultisampledFramebuffer=t.createFramebuffer(),c.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,c.__webglMultisampledFramebuffer);for(let n=0;n0)for(let i=0;i0)for(let n=0;n0&&!1===et(e)){const r=e.isWebGLMultipleRenderTargets?e.texture:[e.texture],s=e.width,a=e.height;let o=t.COLOR_BUFFER_BIT;const l=[],h=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,u=i.get(e),d=!0===e.isWebGLMultipleRenderTargets;if(d)for(let e=0;eo+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(i=e.getPose(t.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Za)))}return null!==a&&(a.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const n=new Ya;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}class Ka extends te{constructor(t,e){super();const n=this;let i=null,r=1,s=null,a="local-floor",o=1,l=null,c=null,h=null,u=null,d=null,p=null;const m=e.getContextAttributes();let f=null,g=null;const _=[],v=[],x=new me;let y=null;const M=new sr;M.layers.enable(1),M.viewport=new Be;const S=new sr;S.layers.enable(2),S.viewport=new Be;const b=[M,S],T=new qa;T.layers.enable(1),T.layers.enable(2);let E=null,w=null;function A(t){const e=v.indexOf(t.inputSource);if(-1===e)return;const n=_[e];void 0!==n&&(n.update(t.inputSource,t.frame,l||s),n.dispatchEvent({type:t.type,data:t.inputSource}))}function R(){i.removeEventListener("select",A),i.removeEventListener("selectstart",A),i.removeEventListener("selectend",A),i.removeEventListener("squeeze",A),i.removeEventListener("squeezestart",A),i.removeEventListener("squeezeend",A),i.removeEventListener("end",R),i.removeEventListener("inputsourceschange",C);for(let t=0;t<_.length;t++){const e=v[t];null!==e&&(v[t]=null,_[t].disconnect(e))}E=null,w=null,t.setRenderTarget(f),d=null,u=null,h=null,i=null,g=null,D.stop(),n.isPresenting=!1,t.setPixelRatio(y),t.setSize(x.width,x.height,!1),n.dispatchEvent({type:"sessionend"})}function C(t){for(let e=0;e=0&&(v[i]=null,_[i].disconnect(n))}for(let e=0;e=v.length){v.push(n),i=t;break}if(null===v[t]){v[t]=n,i=t;break}}if(-1===i)break}const r=_[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=_[t];return void 0===e&&(e=new Ja,_[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=_[t];return void 0===e&&(e=new Ja,_[t]=e),e.getGripSpace()},this.getHand=function(t){let e=_[t];return void 0===e&&(e=new Ja,_[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){a=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||s},this.setReferenceSpace=function(t){l=t},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return h},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(c){if(i=c,null!==i){if(f=t.getRenderTarget(),i.addEventListener("select",A),i.addEventListener("selectstart",A),i.addEventListener("selectend",A),i.addEventListener("squeeze",A),i.addEventListener("squeezestart",A),i.addEventListener("squeezeend",A),i.addEventListener("end",R),i.addEventListener("inputsourceschange",C),!0!==m.xrCompatible&&await e.makeXRCompatible(),y=t.getPixelRatio(),t.getSize(x),void 0===i.renderState.layers||!1===t.capabilities.isWebGL2){const n={antialias:void 0!==i.renderState.layers||m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,e,n),i.updateRenderState({baseLayer:d}),t.setPixelRatio(1),t.setSize(d.framebufferWidth,d.framebufferHeight,!1),g=new Ge(d.framebufferWidth,d.framebufferHeight,{format:j,type:F,colorSpace:t.outputColorSpace,stencilBuffer:m.stencil})}else{let n=null,s=null,a=null;m.depth&&(a=m.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,n=m.stencil?Y:q,s=m.stencil?X:G);const o={colorFormat:e.RGBA8,depthFormat:a,scaleFactor:r};h=new XRWebGLBinding(i,e),u=h.createProjectionLayer(o),i.updateRenderState({layers:[u]}),t.setPixelRatio(1),t.setSize(u.textureWidth,u.textureHeight,!1),g=new Ge(u.textureWidth,u.textureHeight,{format:j,type:F,depthTexture:new ns(u.textureWidth,u.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:m.stencil,colorSpace:t.outputColorSpace,samples:m.antialias?4:0});t.properties.get(g).__ignoreDepthValues=u.ignoreDepthValues}g.isXRRenderTarget=!0,this.setFoveation(o),l=null,s=await i.requestReferenceSpace(a),D.setContext(i),D.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode};const L=new We,P=new We;function I(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===i)return;T.near=S.near=M.near=t.near,T.far=S.far=M.far=t.far,E===T.near&&w===T.far||(i.updateRenderState({depthNear:T.near,depthFar:T.far}),E=T.near,w=T.far);const e=t.parent,n=T.cameras;I(T,e);for(let t=0;t0&&(i.alphaTest.value=r.alphaTest);const s=e.get(r).envMap;if(s&&(i.envMap.value=s,i.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,i.reflectivity.value=r.reflectivity,i.ior.value=r.ior,i.refractionRatio.value=r.refractionRatio),r.lightMap){i.lightMap.value=r.lightMap;const e=!0===t._useLegacyLights?Math.PI:1;i.lightMapIntensity.value=r.lightMapIntensity*e,n(r.lightMap,i.lightMapTransform)}r.aoMap&&(i.aoMap.value=r.aoMap,i.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,i.aoMapTransform))}return{refreshFogUniforms:function(e,n){n.color.getRGB(e.fogColor.value,er(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)},refreshMaterialUniforms:function(t,r,s,o,l){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(t,r):r.isMeshToonMaterial?(i(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(i(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(i(t,r),function(t,i){t.metalness.value=i.metalness,i.metalnessMap&&(t.metalnessMap.value=i.metalnessMap,n(i.metalnessMap,t.metalnessMapTransform));t.roughness.value=i.roughness,i.roughnessMap&&(t.roughnessMap.value=i.roughnessMap,n(i.roughnessMap,t.roughnessMapTransform));const r=e.get(i).envMap;r&&(t.envMapIntensity.value=i.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,n(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,n(e.sheenRoughnessMap,t.sheenRoughnessMapTransform)));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,n(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,n(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,n(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),e.side===a&&t.clearcoatNormalScale.value.negate()));e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,n(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,n(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform)));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,n(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,n(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,n(e.anisotropyMap,t.anisotropyMapTransform)));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,n(e.specularColorMap,t.specularColorMapTransform));e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,n(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,l)):r.isMeshMatcapMaterial?(i(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?i(t,r):r.isMeshDistanceMaterial?(i(t,r),function(t,n){const i=e.get(n).light;t.referencePosition.value.setFromMatrixPosition(i.matrixWorld),t.nearDistance.value=i.shadow.camera.near,t.farDistance.value=i.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?i(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,i,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*r,e.map&&(t.map.value=e.map,n(e.map,t.uvTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,s,o):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Qa(t,e,n,i){let r={},s={},a=[];const o=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(t,e,n,i){const r=t.value,s=e+"_"+n;if(void 0===i[s])return i[s]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const t=i[s];if("number"==typeof r||"boolean"==typeof r){if(t!==r)return i[s]=r,!0}else if(!1===t.equals(r))return t.copy(r),!0}return!1}function c(t){const e={boundary:0,storage:0};return"number"==typeof t||"boolean"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),e}function h(e){const n=e.target;n.removeEventListener("dispose",h);const i=a.indexOf(n.__bindingPointIndex);a.splice(i,1),t.deleteBuffer(r[n.id]),delete r[n.id],delete s[n.id]}return{bind:function(t,e){const n=e.program;i.uniformBlockBinding(t,n)},update:function(n,u){let d=r[n.id];void 0===d&&(!function(t){const e=t.uniforms;let n=0;const i=16;for(let t=0,r=e.length;t0&&(n+=i-r);t.__size=n,t.__cache={}}(n),d=function(e){const n=function(){for(let t=0;t0),u=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,m=!!n.morphAttributes.color;let f=p;i.toneMapped&&(null!==w&&!0!==w.isXRRenderTarget||(f=S.toneMapping));const g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=void 0!==g?g.length:0,v=mt.get(i),y=x.state.lights;if(!0===nt&&(!0===it||t!==R)){const e=t===R&&i.id===A;Et.setState(i,t,e)}let M=!1;i.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version||v.outputColorSpace!==o||r.isBatchedMesh&&!1===v.batching?M=!0:r.isBatchedMesh||!0!==v.batching?r.isInstancedMesh&&!1===v.instancing?M=!0:r.isInstancedMesh||!0!==v.instancing?r.isSkinnedMesh&&!1===v.skinning?M=!0:r.isSkinnedMesh||!0!==v.skinning?r.isInstancedMesh&&!0===v.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===v.instancingColor&&null!==r.instanceColor||v.envMap!==l||!0===i.fog&&v.fog!==s?M=!0:void 0===v.numClippingPlanes||v.numClippingPlanes===Et.numPlanes&&v.numIntersection===Et.numIntersection?(v.vertexAlphas!==c||v.vertexTangents!==h||v.morphTargets!==u||v.morphNormals!==d||v.morphColors!==m||v.toneMapping!==f||!0===ut.isWebGL2&&v.morphTargetsCount!==_)&&(M=!0):M=!0:M=!0:M=!0:M=!0:(M=!0,v.__version=i.version);let b=v.currentProgram;!0===M&&(b=Qt(i,e,r));let T=!1,E=!1,C=!1;const L=b.getUniforms(),P=v.uniforms;dt.useProgram(b.program)&&(T=!0,E=!0,C=!0);i.id!==A&&(A=i.id,E=!0);if(T||R!==t){L.setValue(Dt,"projectionMatrix",t.projectionMatrix),L.setValue(Dt,"viewMatrix",t.matrixWorldInverse);const e=L.map.cameraPosition;void 0!==e&&e.setValue(Dt,ot.setFromMatrixPosition(t.matrixWorld)),ut.logarithmicDepthBuffer&&L.setValue(Dt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&L.setValue(Dt,"isOrthographic",!0===t.isOrthographicCamera),R!==t&&(R=t,E=!0,C=!0)}if(r.isSkinnedMesh){L.setOptional(Dt,r,"bindMatrix"),L.setOptional(Dt,r,"bindMatrixInverse");const t=r.skeleton;t&&(ut.floatVertexTextures?(null===t.boneTexture&&t.computeBoneTexture(),L.setValue(Dt,"boneTexture",t.boneTexture,ft)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}r.isBatchedMesh&&(L.setOptional(Dt,r,"batchingTexture"),L.setValue(Dt,"batchingTexture",r._matricesTexture,ft));const I=n.morphAttributes;(void 0!==I.position||void 0!==I.normal||void 0!==I.color&&!0===ut.isWebGL2)&&Rt.update(r,n,b);(E||v.receiveShadow!==r.receiveShadow)&&(v.receiveShadow=r.receiveShadow,L.setValue(Dt,"receiveShadow",r.receiveShadow));i.isMeshGouraudMaterial&&null!==i.envMap&&(P.envMap.value=l,P.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);E&&(L.setValue(Dt,"toneMappingExposure",S.toneMappingExposure),v.needsLights&&(D=C,(U=P).ambientLightColor.needsUpdate=D,U.lightProbe.needsUpdate=D,U.directionalLights.needsUpdate=D,U.directionalLightShadows.needsUpdate=D,U.pointLights.needsUpdate=D,U.pointLightShadows.needsUpdate=D,U.spotLights.needsUpdate=D,U.spotLightShadows.needsUpdate=D,U.rectAreaLights.needsUpdate=D,U.hemisphereLights.needsUpdate=D),s&&!0===i.fog&&St.refreshFogUniforms(P,s),St.refreshMaterialUniforms(P,i,z,N,rt),oa.upload(Dt,te(v),P,ft));var U,D;i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(oa.upload(Dt,te(v),P,ft),i.uniformsNeedUpdate=!1);i.isSpriteMaterial&&L.setValue(Dt,"center",r.center);if(L.setValue(Dt,"modelViewMatrix",r.modelViewMatrix),L.setValue(Dt,"normalMatrix",r.normalMatrix),L.setValue(Dt,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const t=i.uniformsGroups;for(let e=0,n=t.length;e{function n(){i.forEach((function(t){mt.get(t).currentProgram.isReady()&&i.delete(t)})),0!==i.size?setTimeout(n,10):e(t)}null!==ht.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let Xt=null;function jt(){Yt.stop()}function qt(){Yt.start()}const Yt=new _r;function Zt(t,e,n,i){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)x.pushLight(t),t.castShadow&&x.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||et.intersectsSprite(t)){i&&ot.setFromMatrixPosition(t.matrixWorld).applyMatrix4(st);const e=yt.update(t),r=t.material;r.visible&&v.push(t,e,r,n,ot.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||et.intersectsObject(t))){const e=yt.update(t),r=t.material;if(i&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),ot.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),ot.copy(e.boundingSphere.center)),ot.applyMatrix4(t.matrixWorld).applyMatrix4(st)),Array.isArray(r)){const i=e.groups;for(let s=0,a=i.length;s0&&function(t,e,n,i){const r=!0===n.isScene?n.overrideMaterial:null;if(null!==r)return;const s=ut.isWebGL2;null===rt&&(rt=new Ge(1,1,{generateMipmaps:!0,type:ht.has("EXT_color_buffer_half_float")?V:F,minFilter:O,samples:s?4:0}));S.getDrawingBufferSize(at),s?rt.setSize(at.x,at.y):rt.setSize(he(at.x),he(at.y));const o=S.getRenderTarget();S.setRenderTarget(rt),S.getClearColor(I),U=S.getClearAlpha(),U<1&&S.setClearColor(16777215,.5);S.clear();const l=S.toneMapping;S.toneMapping=p,Kt(t,n,i),ft.updateMultisampleRenderTarget(rt),ft.updateRenderTargetMipmap(rt);let c=!1;for(let t=0,r=e.length;t0&&Kt(r,e,n),s.length>0&&Kt(s,e,n),o.length>0&&Kt(o,e,n),dt.buffers.depth.setTest(!0),dt.buffers.depth.setMask(!0),dt.buffers.color.setMask(!0),dt.setPolygonOffset(!1)}function Kt(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r0?M[M.length-1]:null,y.pop(),v=y.length>0?y[y.length-1]:null},this.getActiveCubeFace=function(){return T},this.getActiveMipmapLevel=function(){return E},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(t,e,n){mt.get(t.texture).__webglTexture=e,mt.get(t.depthTexture).__webglTexture=n;const i=mt.get(t);i.__hasExternalTextures=!0,i.__hasExternalTextures&&(i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||!0===ht.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(t,e){const n=mt.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e},this.setRenderTarget=function(t,e=0,n=0){w=t,T=e,E=n;let i=!0,r=null,s=!1,a=!1;if(t){const o=mt.get(t);void 0!==o.__useDefaultFramebuffer?(dt.bindFramebuffer(Dt.FRAMEBUFFER,null),i=!1):void 0===o.__webglFramebuffer?ft.setupRenderTarget(t):o.__hasExternalTextures&&ft.rebindTextures(t,mt.get(t.texture).__webglTexture,mt.get(t.depthTexture).__webglTexture);const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(a=!0);const c=mt.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=Array.isArray(c[e])?c[e][n]:c[e],s=!0):r=ut.isWebGL2&&t.samples>0&&!1===ft.useMultisampledRTT(t)?mt.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,C.copy(t.viewport),L.copy(t.scissor),P=t.scissorTest}else C.copy($).multiplyScalar(z).floor(),L.copy(Q).multiplyScalar(z).floor(),P=tt;if(dt.bindFramebuffer(Dt.FRAMEBUFFER,r)&&ut.drawBuffers&&i&&dt.drawBuffers(t,r),dt.viewport(C),dt.scissor(L),dt.setScissorTest(P),s){const i=mt.get(t.texture);Dt.framebufferTexture2D(Dt.FRAMEBUFFER,Dt.COLOR_ATTACHMENT0,Dt.TEXTURE_CUBE_MAP_POSITIVE_X+e,i.__webglTexture,n)}else if(a){const i=mt.get(t.texture),r=e||0;Dt.framebufferTextureLayer(Dt.FRAMEBUFFER,Dt.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}A=-1},this.readRenderTargetPixels=function(t,e,n,i,r,s,a){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=mt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(o=o[a]),o){dt.bindFramebuffer(Dt.FRAMEBUFFER,o);try{const a=t.texture,o=a.format,l=a.type;if(o!==j&&Pt.convert(o)!==Dt.getParameter(Dt.IMPLEMENTATION_COLOR_READ_FORMAT))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const c=l===V&&(ht.has("EXT_color_buffer_half_float")||ut.isWebGL2&&ht.has("EXT_color_buffer_float"));if(!(l===F||Pt.convert(l)===Dt.getParameter(Dt.IMPLEMENTATION_COLOR_READ_TYPE)||l===H&&(ut.isWebGL2||ht.has("OES_texture_float")||ht.has("WEBGL_color_buffer_float"))||c))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&Dt.readPixels(e,n,i,r,Pt.convert(o),Pt.convert(l),s)}finally{const t=null!==w?mt.get(w).__webglFramebuffer:null;dt.bindFramebuffer(Dt.FRAMEBUFFER,t)}}},this.copyFramebufferToTexture=function(t,e,n=0){const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i);ft.setTexture2D(e,0),Dt.copyTexSubImage2D(Dt.TEXTURE_2D,n,0,0,t.x,t.y,r,s),dt.unbindTexture()},this.copyTextureToTexture=function(t,e,n,i=0){const r=e.image.width,s=e.image.height,a=Pt.convert(n.format),o=Pt.convert(n.type);ft.setTexture2D(n,0),Dt.pixelStorei(Dt.UNPACK_FLIP_Y_WEBGL,n.flipY),Dt.pixelStorei(Dt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),Dt.pixelStorei(Dt.UNPACK_ALIGNMENT,n.unpackAlignment),e.isDataTexture?Dt.texSubImage2D(Dt.TEXTURE_2D,i,t.x,t.y,r,s,a,o,e.image.data):e.isCompressedTexture?Dt.compressedTexSubImage2D(Dt.TEXTURE_2D,i,t.x,t.y,e.mipmaps[0].width,e.mipmaps[0].height,a,e.mipmaps[0].data):Dt.texSubImage2D(Dt.TEXTURE_2D,i,t.x,t.y,a,o,e.image),0===i&&n.generateMipmaps&&Dt.generateMipmap(Dt.TEXTURE_2D),dt.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n,i,r=0){if(S.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const s=t.max.x-t.min.x+1,a=t.max.y-t.min.y+1,o=t.max.z-t.min.z+1,l=Pt.convert(i.format),c=Pt.convert(i.type);let h;if(i.isData3DTexture)ft.setTexture3D(i,0),h=Dt.TEXTURE_3D;else{if(!i.isDataArrayTexture&&!i.isCompressedArrayTexture)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");ft.setTexture2DArray(i,0),h=Dt.TEXTURE_2D_ARRAY}Dt.pixelStorei(Dt.UNPACK_FLIP_Y_WEBGL,i.flipY),Dt.pixelStorei(Dt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i.premultiplyAlpha),Dt.pixelStorei(Dt.UNPACK_ALIGNMENT,i.unpackAlignment);const u=Dt.getParameter(Dt.UNPACK_ROW_LENGTH),d=Dt.getParameter(Dt.UNPACK_IMAGE_HEIGHT),p=Dt.getParameter(Dt.UNPACK_SKIP_PIXELS),m=Dt.getParameter(Dt.UNPACK_SKIP_ROWS),f=Dt.getParameter(Dt.UNPACK_SKIP_IMAGES),g=n.isCompressedTexture?n.mipmaps[r]:n.image;Dt.pixelStorei(Dt.UNPACK_ROW_LENGTH,g.width),Dt.pixelStorei(Dt.UNPACK_IMAGE_HEIGHT,g.height),Dt.pixelStorei(Dt.UNPACK_SKIP_PIXELS,t.min.x),Dt.pixelStorei(Dt.UNPACK_SKIP_ROWS,t.min.y),Dt.pixelStorei(Dt.UNPACK_SKIP_IMAGES,t.min.z),n.isDataTexture||n.isData3DTexture?Dt.texSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,c,g.data):n.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),Dt.compressedTexSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,g.data)):Dt.texSubImage3D(h,r,e.x,e.y,e.z,s,a,o,l,c,g),Dt.pixelStorei(Dt.UNPACK_ROW_LENGTH,u),Dt.pixelStorei(Dt.UNPACK_IMAGE_HEIGHT,d),Dt.pixelStorei(Dt.UNPACK_SKIP_PIXELS,p),Dt.pixelStorei(Dt.UNPACK_SKIP_ROWS,m),Dt.pixelStorei(Dt.UNPACK_SKIP_IMAGES,f),0===r&&i.generateMipmaps&&Dt.generateMipmap(h),dt.unbindTexture()},this.initTexture=function(t){t.isCubeTexture?ft.setTextureCube(t,0):t.isData3DTexture?ft.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?ft.setTexture2DArray(t,0):ft.setTexture2D(t,0),dt.unbindTexture()},this.resetState=function(){T=0,E=0,w=null,dt.reset(),It.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return $t}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=t===Vt?"display-p3":"srgb",e.unpackColorSpace=Re.workingColorSpace===kt?"display-p3":"srgb"}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Gt?Bt:Ft}set outputEncoding(t){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=t===Bt?Gt:Ht}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}}class eo extends to{}eo.prototype.isWebGL1Renderer=!0;class no{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new ci(t),this.density=e}clone(){return new no(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class io{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new ci(t),this.near=e,this.far=n}clone(){return new io(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class ro extends jn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e}}class so{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=Zt,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=se()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}get updateRange(){return console.warn("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;it.far||e.push({distance:o,point:ho.clone(),uv:ri.getInterpolation(ho,_o,vo,xo,yo,Mo,So,new me),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function To(t,e,n,i,r,s){mo.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(fo.x=s*mo.x-r*mo.y,fo.y=r*mo.x+s*mo.y):fo.copy(mo),t.copy(e),t.x+=fo.x,t.y+=fo.y,t.applyMatrix4(go)}const Eo=new We,wo=new We;class Ao extends jn{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,n=e.length;t0){let n,i;for(n=1,i=e.length;n0){Eo.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(Eo);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){Eo.setFromMatrixPosition(t.matrixWorld),wo.setFromMatrixPosition(this.matrixWorld);const n=Eo.distanceTo(wo)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i=t))break;e[i-1].object.visible=!1,e[i].object.visible=!0}for(this._currentLevel=i-1;i=n.length&&n.push({start:-1,count:-1,z:-1});const r=n[this.index];i.push(r),this.index++,r.start=t.start,r.count=t.count,r.z=e}reset(){this.list.length=0,this.index=0}}const el="batchId",nl=new Mn,il=new Mn,rl=new Mn,sl=new Mn,al=new gr,ol=new qe,ll=new dn,cl=new We,hl=new tl,ul=new Ji,dl=[];function pl(t,e,n=0){const i=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const r=t.count;for(let s=0;s65536?new Uint32Array(r):new Uint16Array(r);e.setIndex(new Mi(t,1))}const s=i>65536?new Uint32Array(n):new Uint16Array(n);e.setAttribute(el,new Mi(s,1)),this._geometryInitialized=!0}}_validateGeometry(t){if(t.getAttribute(el))throw new Error(`BatchedMesh: Geometry cannot use attribute "${el}"`);const e=this.geometry;if(Boolean(t.getIndex())!==Boolean(e.getIndex()))throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const n in e.attributes){if(n===el)continue;if(!t.hasAttribute(n))throw new Error(`BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=t.getAttribute(n),r=e.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new qe);const t=this._geometryCount,e=this.boundingBox,n=this._active;e.makeEmpty();for(let i=0;i=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let r=null;const s=this._reservedRanges,a=this._drawRanges,o=this._bounds;0!==this._geometryCount&&(r=s[s.length-1]),i.vertexCount=-1===e?t.getAttribute("position").count:e,i.vertexStart=null===r?0:r.vertexStart+r.vertexCount;const l=t.getIndex(),c=null!==l;if(c&&(i.indexCount=-1===n?l.count:n,i.indexStart=null===r?0:r.indexStart+r.indexCount),-1!==i.indexStart&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._visibility,u=this._active,d=this._matricesTexture,p=this._matricesTexture.image.data;h.push(!0),u.push(!0);const m=this._geometryCount;this._geometryCount++,rl.toArray(p,16*m),d.needsUpdate=!0,s.push(i),a.push({start:c?i.indexStart:i.vertexStart,count:-1}),o.push({boxInitialized:!1,box:new qe,sphereInitialized:!1,sphere:new dn});const f=this.geometry.getAttribute(el);for(let t=0;t=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const n=this.geometry,i=null!==n.getIndex(),r=n.getIndex(),s=e.getIndex(),a=this._reservedRanges[t];if(i&&s.count>a.indexCount||e.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const o=a.vertexStart,l=a.vertexCount;for(const t in n.attributes){if(t===el)continue;const i=e.getAttribute(t),r=n.getAttribute(t);pl(i,r,o);const s=i.itemSize;for(let t=i.count,e=l;t=e.length||!1===e[t]||(e[t]=!1,this._visibilityChanged=!0),this}getBoundingBoxAt(t,e){if(!1===this._active[t])return this;const n=this._bounds[t],i=n.box,r=this.geometry;if(!1===n.boxInitialized){i.makeEmpty();const e=r.index,s=r.attributes.position,a=this._drawRanges[t];for(let t=a.start,n=a.start+a.count;t=this._geometryCount||!1===n[t]||(e.toArray(r,16*t),i.needsUpdate=!0),this}getMatrixAt(t,e){const n=this._active,i=this._matricesTexture.image.data;return t>=this._geometryCount||!1===n[t]?null:e.fromArray(i,16*t)}setVisibleAt(t,e){const n=this._visibility,i=this._active;return t>=this._geometryCount||!1===i[t]||n[t]===e||(n[t]=e,this._visibilityChanged=!0),this}getVisibleAt(t){const e=this._visibility,n=this._active;return!(t>=this._geometryCount||!1===n[t])&&e[t]}raycast(t,e){const n=this._visibility,i=this._active,r=this._drawRanges,s=this._geometryCount,a=this.matrixWorld,o=this.geometry;ul.material=this.material,ul.geometry.index=o.index,ul.geometry.attributes=o.attributes,null===ul.geometry.boundingBox&&(ul.geometry.boundingBox=new qe),null===ul.geometry.boundingSphere&&(ul.geometry.boundingSphere=new dn);for(let o=0;o({...t}))),this._reservedRanges=t._reservedRanges.map((t=>({...t}))),this._visibility=t._visibility.slice(),this._active=t._active.slice(),this._bounds=t._bounds.map((t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()}))),this._maxGeometryCount=t._maxGeometryCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._geometryCount=t._geometryCount,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(t,e,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const s=i.getIndex(),a=null===s?1:s.array.BYTES_PER_ELEMENT,o=this._visibility,l=this._multiDrawStarts,c=this._multiDrawCounts,h=this._drawRanges,u=this.perObjectFrustumCulled;u&&(sl.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),al.setFromProjectionMatrix(sl,t.isWebGPURenderer?Qt:$t));let d=0;if(this.sortObjects){il.copy(this.matrixWorld).invert(),cl.setFromMatrixPosition(n.matrixWorld).applyMatrix4(il);for(let t=0,e=o.length;to)continue;u.applyMatrix4(this.matrixWorld);const s=t.ray.origin.distanceTo(u);st.far||e.push({distance:s,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}else{for(let n=Math.max(0,s.start),i=Math.min(m.count,s.start+s.count)-1;no)continue;u.applyMatrix4(this.matrixWorld);const i=t.ray.origin.distanceTo(u);it.far||e.push({distance:i,point:h.clone().applyMatrix4(this.matrixWorld),index:n,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;tr.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:e,face:null,object:a})}}class Ul extends Fe{constructor(t,e,n,i,r,s,a,o,l,c,h,u){super(null,s,a,o,l,c,i,r,h,u),this.isCompressedTexture=!0,this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class Dl{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let n,i=this.getPoint(0),r=0;e.push(0);for(let s=1;s<=t;s++)n=this.getPoint(s/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let s;s=e||t*n[r-1];let a,o=0,l=r-1;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),a=n[i]-s,a<0)o=i+1;else{if(!(a>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),a=this.getPoint(r),o=e||(s.isVector2?new me:new We);return o.copy(a).sub(s).normalize(),o}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new We,i=[],r=[],s=[],a=new We,o=new Mn;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new We)}r[0]=new We,s[0]=new We;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],a),s[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),s[e]=s[e-1].clone(),a.crossVectors(i[e-1],i[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(ae(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}s[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(ae(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],e*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Nl extends Dl{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e){const n=e||new me,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?a=i[(l-1)%r]:(Bl.subVectors(i[0],i[1]).add(i[0]),a=Bl);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(kl(a,o.x,l.x,c.x,h.x),kl(a,o.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e=n){const t=i[r]-n,s=this.curves[r],a=s.getLength(),o=0===a?0:1-t/a;return s.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let n=0,i=this.curves.length;n1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class nc extends Ii{constructor(t=[new me(0,-.5),new me(.5,0),new me(0,.5)],e=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=ae(i,0,2*Math.PI);const r=[],s=[],a=[],o=[],l=[],c=1/e,h=new We,u=new me,d=new We,p=new We,m=new We;let f=0,g=0;for(let e=0;e<=t.length-1;e++)switch(e){case 0:f=t[e+1].x-t[e].x,g=t[e+1].y-t[e].y,d.x=1*g,d.y=-f,d.z=0*g,m.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case t.length-1:o.push(m.x,m.y,m.z);break;default:f=t[e+1].x-t[e].x,g=t[e+1].y-t[e].y,d.x=1*g,d.y=-f,d.z=0*g,p.copy(d),d.x+=m.x,d.y+=m.y,d.z+=m.z,d.normalize(),o.push(d.x,d.y,d.z),m.copy(p)}for(let r=0;r<=e;r++){const d=n+r*c*i,p=Math.sin(d),m=Math.cos(d);for(let n=0;n<=t.length-1;n++){h.x=t[n].x*p,h.y=t[n].y,h.z=t[n].x*m,s.push(h.x,h.y,h.z),u.x=r/e,u.y=n/(t.length-1),a.push(u.x,u.y);const i=o[3*n+0]*p,c=o[3*n+1],d=o[3*n+0]*m;l.push(i,c,d)}}for(let n=0;n0&&_(!0),e>0&&_(!1)),this.setIndex(c),this.setAttribute("position",new Ti(h,3)),this.setAttribute("normal",new Ti(u,3)),this.setAttribute("uv",new Ti(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new sc(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ac extends sc{constructor(t=1,e=1,n=32,i=1,r=!1,s=0,a=2*Math.PI){super(0,t,e,n,i,r,s,a),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:a}}static fromJSON(t){return new ac(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class oc extends Ii{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],s=[];function a(t,e,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const a=t.clone().lerp(n,i/r),o=e.clone().lerp(n,i/r),l=r-i;for(let t=0;t<=l;t++)s[i][t]=0===t&&i===r?a:a.clone().lerp(o,t/l)}for(let t=0;t.9&&a<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),i<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Ti(r,3)),this.setAttribute("normal",new Ti(r.slice(),3)),this.setAttribute("uv",new Ti(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new oc(t.vertices,t.indices,t.radius,t.details)}}class lc extends oc{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2,i=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new lc(t.radius,t.detail)}}const cc=new We,hc=new We,uc=new We,dc=new ri;class pc extends Ii{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const n=4,i=Math.pow(10,n),r=Math.cos(ie*e),s=t.getIndex(),a=t.getAttribute("position"),o=s?s.count:a.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),u={},d=[];for(let t=0;t80*n){o=c=t[0],l=h=t[1];for(let e=n;ec&&(c=u),d>h&&(h=d);p=Math.max(c-o,h-l),p=0!==p?32767/p:0}return vc(s,a,n,o,l,p,0),a};function gc(t,e,n,i,r){let s,a;if(r===function(t,e,n,i){let r=0;for(let s=e,a=n-i;s0)for(s=e;s=e;s-=i)a=Fc(s,t[s],t[s+1],a);return a&&Pc(a,a.next)&&(Bc(a),a=a.next),a}function _c(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!Pc(i,i.next)&&0!==Lc(i.prev,i,i.next))i=i.next;else{if(Bc(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function vc(t,e,n,i,r,s,a){if(!t)return;!a&&s&&function(t,e,n,i){let r=t;do{0===r.z&&(r.z=wc(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,n,i,r,s,a,o,l,c=1;do{for(n=t,t=null,s=null,a=0;n;){for(a++,i=n,o=0,e=0;e0||l>0&&i;)0!==o&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,o--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(a>1)}(r)}(t,i,r,s);let o,l,c=t;for(;t.prev!==t.next;)if(o=t.prev,l=t.next,s?yc(t,i,r,s):xc(t))e.push(o.i/n|0),e.push(t.i/n|0),e.push(l.i/n|0),Bc(t),t=l.next,c=l.next;else if((t=l)===c){a?1===a?vc(t=Mc(_c(t),e,n),e,n,i,r,s,2):2===a&&Sc(t,e,n,i,r,s):vc(_c(t),e,n,i,r,s,1);break}}function xc(t){const e=t.prev,n=t,i=t.next;if(Lc(e,n,i)>=0)return!1;const r=e.x,s=n.x,a=i.x,o=e.y,l=n.y,c=i.y,h=rs?r>a?r:a:s>a?s:a,p=o>l?o>c?o:c:l>c?l:c;let m=i.next;for(;m!==e;){if(m.x>=h&&m.x<=d&&m.y>=u&&m.y<=p&&Rc(r,o,s,l,a,c,m.x,m.y)&&Lc(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function yc(t,e,n,i){const r=t.prev,s=t,a=t.next;if(Lc(r,s,a)>=0)return!1;const o=r.x,l=s.x,c=a.x,h=r.y,u=s.y,d=a.y,p=ol?o>c?o:c:l>c?l:c,g=h>u?h>d?h:d:u>d?u:d,_=wc(p,m,e,n,i),v=wc(f,g,e,n,i);let x=t.prevZ,y=t.nextZ;for(;x&&x.z>=_&&y&&y.z<=v;){if(x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==r&&x!==a&&Rc(o,h,l,u,c,d,x.x,x.y)&&Lc(x.prev,x,x.next)>=0)return!1;if(x=x.prevZ,y.x>=p&&y.x<=f&&y.y>=m&&y.y<=g&&y!==r&&y!==a&&Rc(o,h,l,u,c,d,y.x,y.y)&&Lc(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;x&&x.z>=_;){if(x.x>=p&&x.x<=f&&x.y>=m&&x.y<=g&&x!==r&&x!==a&&Rc(o,h,l,u,c,d,x.x,x.y)&&Lc(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;y&&y.z<=v;){if(y.x>=p&&y.x<=f&&y.y>=m&&y.y<=g&&y!==r&&y!==a&&Rc(o,h,l,u,c,d,y.x,y.y)&&Lc(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Mc(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!Pc(r,s)&&Ic(r,i,i.next,s)&&Nc(r,s)&&Nc(s,r)&&(e.push(r.i/n|0),e.push(i.i/n|0),e.push(s.i/n|0),Bc(i),Bc(i.next),i=t=s),i=i.next}while(i!==t);return _c(i)}function Sc(t,e,n,i,r,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Cc(a,t)){let o=Oc(a,t);return a=_c(a,a.next),o=_c(o,o.next),vc(a,e,n,i,r,s,0),void vc(o,e,n,i,r,s,0)}t=t.next}a=a.next}while(a!==t)}function bc(t,e){return t.x-e.x}function Tc(t,e){const n=function(t,e){let n,i=e,r=-1/0;const s=t.x,a=t.y;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){const t=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=s&&t>r&&(r=t,n=i.x=i.x&&i.x>=l&&s!==i.x&&Rc(an.x||i.x===n.x&&Ec(n,i)))&&(n=i,u=h)),i=i.next}while(i!==o);return n}(t,e);if(!n)return e;const i=Oc(n,t);return _c(i,i.next),_c(n,n.next)}function Ec(t,e){return Lc(t.prev,t,e.prev)<0&&Lc(e.next,t,t.next)<0}function wc(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ac(t){let e=t,n=t;do{(e.x=(t-a)*(s-o)&&(t-a)*(i-o)>=(n-a)*(e-o)&&(n-a)*(s-o)>=(r-a)*(i-o)}function Cc(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Ic(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Nc(t,e)&&Nc(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==t);return i}(t,e)&&(Lc(t.prev,t,e.prev)||Lc(t,e.prev,e))||Pc(t,e)&&Lc(t.prev,t,t.next)>0&&Lc(e.prev,e,e.next)>0)}function Lc(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Pc(t,e){return t.x===e.x&&t.y===e.y}function Ic(t,e,n,i){const r=Dc(Lc(t,e,n)),s=Dc(Lc(t,e,i)),a=Dc(Lc(n,i,t)),o=Dc(Lc(n,i,e));return r!==s&&a!==o||(!(0!==r||!Uc(t,n,e))||(!(0!==s||!Uc(t,i,e))||(!(0!==a||!Uc(n,t,i))||!(0!==o||!Uc(n,e,i)))))}function Uc(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Dc(t){return t>0?1:t<0?-1:0}function Nc(t,e){return Lc(t.prev,t,t.next)<0?Lc(t,e,t.next)>=0&&Lc(t,t.prev,e)>=0:Lc(t,e,t.prev)<0||Lc(t,t.next,e)<0}function Oc(t,e){const n=new zc(t.i,t.x,t.y),i=new zc(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function Fc(t,e,n,i){const r=new zc(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Bc(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function zc(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Gc{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r2&&t[e-1].equals(t[0])&&t.pop()}function Vc(t,e){for(let n=0;nNumber.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-o/u,m=e.y+a/u,f=((n.x-c/d-p)*c-(n.y+l/d-m)*l)/(a*c-o*l);i=p+a*f-t.x,r=m+o*f-t.y;const g=i*i+r*r;if(g<=2)return new me(i,r);s=Math.sqrt(g/2)}else{let t=!1;a>Number.EPSILON?l>Number.EPSILON&&(t=!0):a<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(o)===Math.sign(c)&&(t=!0),t?(i=-o,r=a,s=Math.sqrt(h)):(i=a,r=o,s=Math.sqrt(h/2))}return new me(i/s,r/s)}const P=[];for(let t=0,e=w.length,n=e-1,i=t+1;t=0;t--){const e=t/p,n=h*Math.cos(e*Math.PI/2),i=u*Math.sin(e*Math.PI/2)+d;for(let t=0,e=w.length;t=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=o+2*p;t0)&&d.push(e,r,l),(t!==n-1||o0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class oh extends di{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ci(16777215),this.specular=new ci(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ci(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=h,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class lh extends di{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ci(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ci(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class ch extends di{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class hh extends di{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ci(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ci(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=h,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class uh extends di{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ci(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class dh extends fl{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function ph(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}function mh(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function fh(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n}function gh(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,a=0;a!==i;++s){const i=n[s]*e;for(let n=0;n!==e;++n)r[a++]=t[i+n]}return r}function _h(t,e,n,i){let r=1,s=t[0];for(;void 0!==s&&void 0===s[i];)s=t[r++];if(void 0===s)return;let a=s[i];if(void 0!==a)if(Array.isArray(a))do{a=s[i],void 0!==a&&(e.push(s.time),n.push.apply(n,a)),s=t[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[i],void 0!==a&&(e.push(s.time),a.toArray(n,n.length)),s=t[r++]}while(void 0!==s);else do{a=s[i],void 0!==a&&(e.push(s.time),n.push(a)),s=t[r++]}while(void 0!==s)}const vh={convertArray:ph,isTypedArray:mh,getKeyframeOrder:fh,sortedArray:gh,flattenJSON:_h,subclip:function(t,e,n,i,r=30){const s=t.clone();s.name=e;const a=[];for(let t=0;t=i)){l.push(e.times[t]);for(let n=0;ns.tracks[t].times[0]&&(o=s.tracks[t].times[0]);for(let t=0;t=i.times[u]){const t=u*l+o,e=t+l-o;d=i.values.slice(t,e)}else{const t=i.createInterpolant(),e=o,n=l-o;t.evaluate(s),d=t.resultBuffer.slice(e,n)}if("quaternion"===r){(new ke).fromArray(d).normalize().conjugate().toArray(d)}const p=a.times.length;for(let t=0;t=r)break t;{const a=e[1];t=r)break e}s=n,n=0}}for(;n>>1;te;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(r*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,s),t=!1;break}s=i}if(void 0!==i&&mh(i))for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Pt,r=t.length-1;let s=1;for(let a=1;a0){t[s]=t[r];for(let t=r*n,i=s*n,a=0;a!==n;++a)e[i+a]=e[t+a];++s}return s!==t.length?(this.times=t.slice(0,s),this.values=e.slice(0,s*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}bh.prototype.TimeBufferType=Float32Array,bh.prototype.ValueBufferType=Float32Array,bh.prototype.DefaultInterpolation=Lt;class Th extends bh{}Th.prototype.ValueTypeName="bool",Th.prototype.ValueBufferType=Array,Th.prototype.DefaultInterpolation=Ct,Th.prototype.InterpolantFactoryMethodLinear=void 0,Th.prototype.InterpolantFactoryMethodSmooth=void 0;class Eh extends bh{}Eh.prototype.ValueTypeName="color";class wh extends bh{}wh.prototype.ValueTypeName="number";class Ah extends xh{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(n-e)/(i-e);let l=t*a;for(let t=l+a;l!==t;l+=4)ke.slerpFlat(r,0,s,l-a,s,l,o);return r}}class Rh extends bh{InterpolantFactoryMethodLinear(t){return new Ah(this.times,this.values,this.getValueSize(),t)}}Rh.prototype.ValueTypeName="quaternion",Rh.prototype.DefaultInterpolation=Lt,Rh.prototype.InterpolantFactoryMethodSmooth=void 0;class Ch extends bh{}Ch.prototype.ValueTypeName="string",Ch.prototype.ValueBufferType=Array,Ch.prototype.DefaultInterpolation=Ct,Ch.prototype.InterpolantFactoryMethodLinear=void 0,Ch.prototype.InterpolantFactoryMethodSmooth=void 0;class Lh extends bh{}Lh.prototype.ValueTypeName="vector";class Ph{constructor(t,e=-1,n,i=2500){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=se(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(Ih(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(t){const e=[],n=t.tracks,i={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode};for(let t=0,i=n.length;t!==i;++t)e.push(bh.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,s=[];for(let t=0;t1){const t=s[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const s=[];for(const t in i)s.push(this.CreateFromMorphTargetSequence(t,i[t],e,n));return s}static parseAnimation(t,e){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(t,e,n,i,r){if(0!==n.length){const s=[],a=[];_h(n,s,a,i),0!==s.length&&r.push(new t(e,s,a))}},i=[],r=t.name||"default",s=t.fps||30,a=t.blendMode;let o=t.length||-1;const l=t.hierarchy||[];for(let t=0;t{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==Fh[t])return void Fh[t].push({onLoad:e,onProgress:n,onError:i});Fh[t]=[],Fh[t].push({onLoad:e,onProgress:n,onError:i});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,o=this.responseType;fetch(s).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=Fh[t],i=e.body.getReader(),r=e.headers.get("Content-Length")||e.headers.get("X-File-Size"),s=r?parseInt(r):0,a=0!==s;let o=0;const l=new ReadableStream({start(t){!function e(){i.read().then((({done:i,value:r})=>{if(i)t.close();else{o+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let t=0,e=n.length;t{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,a)));case"json":return t.json();default:if(void 0===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((t=>i.decode(t)))}}})).then((e=>{Uh.add(t,e);const n=Fh[t];delete Fh[t];for(let t=0,i=n.length;t{const n=Fh[t];if(void 0===n)throw this.manager.itemError(t),e;delete Fh[t];for(let t=0,i=n.length;t{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Gh extends Oh{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Uh.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const a=ye("img");function o(){c(),Uh.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){c(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(t),a.src=t,a}}class Hh extends jn{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new ci(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),e}}class Vh extends Hh{constructor(t,e,n){super(t,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(jn.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ci(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const kh=new Mn,Wh=new We,Xh=new We;class jh{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new me(512,512),this.map=null,this.mapPass=null,this.matrix=new Mn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new gr,this._frameExtents=new me(1,1),this._viewportCount=1,this._viewports=[new Be(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Wh.setFromMatrixPosition(t.matrixWorld),e.position.copy(Wh),Xh.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Xh),e.updateMatrixWorld(),kh.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(kh),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(kh)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class qh extends jh{constructor(){super(new sr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,n=2*re*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class Yh extends Hh{constructor(t,e,n=0,i=Math.PI/3,r=0,s=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(jn.DEFAULT_UP),this.updateMatrix(),this.target=new jn,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new qh}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const Zh=new Mn,Jh=new We,Kh=new We;class $h extends jh{constructor(){super(new sr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new me(4,2),this._viewportCount=6,this._viewports=[new Be(2,1,1,1),new Be(0,1,1,1),new Be(3,1,1,1),new Be(1,1,1,1),new Be(3,0,1,1),new Be(1,0,1,1)],this._cubeDirections=[new We(1,0,0),new We(-1,0,0),new We(0,0,1),new We(0,0,-1),new We(0,1,0),new We(0,-1,0)],this._cubeUps=[new We(0,1,0),new We(0,1,0),new We(0,1,0),new We(0,1,0),new We(0,0,1),new We(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Jh.setFromMatrixPosition(t.matrixWorld),n.position.copy(Jh),Kh.copy(n.position),Kh.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(Kh),n.updateMatrixWorld(),i.makeTranslation(-Jh.x,-Jh.y,-Jh.z),Zh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Zh)}}class Qh extends Hh{constructor(t,e,n=0,i=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new $h}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class tu extends jh{constructor(){super(new Lr(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class eu extends Hh{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(jn.DEFAULT_UP),this.updateMatrix(),this.target=new jn,this.shadow=new tu}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class nu extends Hh{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class iu extends Hh{constructor(t,e,n=10,i=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}class ru{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new We)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.282095),e.addScaledVector(s[1],.488603*i),e.addScaledVector(s[2],.488603*r),e.addScaledVector(s[3],.488603*n),e.addScaledVector(s[4],n*i*1.092548),e.addScaledVector(s[5],i*r*1.092548),e.addScaledVector(s[6],.315392*(3*r*r-1)),e.addScaledVector(s[7],n*r*1.092548),e.addScaledVector(s[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.886227),e.addScaledVector(s[1],1.023328*i),e.addScaledVector(s[2],1.023328*r),e.addScaledVector(s[3],1.023328*n),e.addScaledVector(s[4],.858086*n*i),e.addScaledVector(s[5],.858086*i*r),e.addScaledVector(s[6],.743125*r*r-.247708),e.addScaledVector(s[7],.858086*n*r),e.addScaledVector(s[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+3*i);return t}static getBasisAt(t,e){const n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}class su extends Hh{constructor(t=new ru,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class au extends Oh{constructor(t){super(t),this.textures={}}load(t,e,n,i){const r=this,s=new zh(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const i=au.createMaterialFromType(t.type);if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&void 0!==i.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.sheen&&(i.sheen=t.sheen),void 0!==t.sheenColor&&(i.sheenColor=(new ci).setHex(t.sheenColor)),void 0!==t.sheenRoughness&&(i.sheenRoughness=t.sheenRoughness),void 0!==t.emissive&&void 0!==i.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==i.specular&&i.specular.setHex(t.specular),void 0!==t.specularIntensity&&(i.specularIntensity=t.specularIntensity),void 0!==t.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(t.specularColor),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearcoat&&(i.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(i.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.iridescence&&(i.iridescence=t.iridescence),void 0!==t.iridescenceIOR&&(i.iridescenceIOR=t.iridescenceIOR),void 0!==t.iridescenceThicknessRange&&(i.iridescenceThicknessRange=t.iridescenceThicknessRange),void 0!==t.transmission&&(i.transmission=t.transmission),void 0!==t.thickness&&(i.thickness=t.thickness),void 0!==t.attenuationDistance&&(i.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(t.attenuationColor),void 0!==t.anisotropy&&(i.anisotropy=t.anisotropy),void 0!==t.anisotropyRotation&&(i.anisotropyRotation=t.anisotropyRotation),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.flatShading&&(i.flatShading=t.flatShading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.combine&&(i.combine=t.combine),void 0!==t.side&&(i.side=t.side),void 0!==t.shadowSide&&(i.shadowSide=t.shadowSide),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.alphaHash&&(i.alphaHash=t.alphaHash),void 0!==t.depthFunc&&(i.depthFunc=t.depthFunc),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.blendSrc&&(i.blendSrc=t.blendSrc),void 0!==t.blendDst&&(i.blendDst=t.blendDst),void 0!==t.blendEquation&&(i.blendEquation=t.blendEquation),void 0!==t.blendSrcAlpha&&(i.blendSrcAlpha=t.blendSrcAlpha),void 0!==t.blendDstAlpha&&(i.blendDstAlpha=t.blendDstAlpha),void 0!==t.blendEquationAlpha&&(i.blendEquationAlpha=t.blendEquationAlpha),void 0!==t.blendColor&&void 0!==i.blendColor&&i.blendColor.setHex(t.blendColor),void 0!==t.blendAlpha&&(i.blendAlpha=t.blendAlpha),void 0!==t.stencilWriteMask&&(i.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(i.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(i.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(i.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(i.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(i.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(i.stencilZPass=t.stencilZPass),void 0!==t.stencilWrite&&(i.stencilWrite=t.stencilWrite),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(i.rotation=t.rotation),void 0!==t.linewidth&&(i.linewidth=t.linewidth),void 0!==t.dashSize&&(i.dashSize=t.dashSize),void 0!==t.gapSize&&(i.gapSize=t.gapSize),void 0!==t.scale&&(i.scale=t.scale),void 0!==t.polygonOffset&&(i.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(i.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(i.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.dithering&&(i.dithering=t.dithering),void 0!==t.alphaToCoverage&&(i.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(i.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.forceSinglePass&&(i.forceSinglePass=t.forceSinglePass),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.toneMapped&&(i.toneMapped=t.toneMapped),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?i.vertexColors=t.vertexColors>0:i.vertexColors=t.vertexColors),void 0!==t.uniforms)for(const e in t.uniforms){const r=t.uniforms[e];switch(i.uniforms[e]={},r.type){case"t":i.uniforms[e].value=n(r.value);break;case"c":i.uniforms[e].value=(new ci).setHex(r.value);break;case"v2":i.uniforms[e].value=(new me).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new We).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new Be).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new fe).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new Mn).fromArray(r.value);break;default:i.uniforms[e].value=r.value}}if(void 0!==t.defines&&(i.defines=t.defines),void 0!==t.vertexShader&&(i.vertexShader=t.vertexShader),void 0!==t.fragmentShader&&(i.fragmentShader=t.fragmentShader),void 0!==t.glslVersion&&(i.glslVersion=t.glslVersion),void 0!==t.extensions)for(const e in t.extensions)i.extensions[e]=t.extensions[e];if(void 0!==t.lights&&(i.lights=t.lights),void 0!==t.clipping&&(i.clipping=t.clipping),void 0!==t.size&&(i.size=t.size),void 0!==t.sizeAttenuation&&(i.sizeAttenuation=t.sizeAttenuation),void 0!==t.map&&(i.map=n(t.map)),void 0!==t.matcap&&(i.matcap=n(t.matcap)),void 0!==t.alphaMap&&(i.alphaMap=n(t.alphaMap)),void 0!==t.bumpMap&&(i.bumpMap=n(t.bumpMap)),void 0!==t.bumpScale&&(i.bumpScale=t.bumpScale),void 0!==t.normalMap&&(i.normalMap=n(t.normalMap)),void 0!==t.normalMapType&&(i.normalMapType=t.normalMapType),void 0!==t.normalScale){let e=t.normalScale;!1===Array.isArray(e)&&(e=[e,e]),i.normalScale=(new me).fromArray(e)}return void 0!==t.displacementMap&&(i.displacementMap=n(t.displacementMap)),void 0!==t.displacementScale&&(i.displacementScale=t.displacementScale),void 0!==t.displacementBias&&(i.displacementBias=t.displacementBias),void 0!==t.roughnessMap&&(i.roughnessMap=n(t.roughnessMap)),void 0!==t.metalnessMap&&(i.metalnessMap=n(t.metalnessMap)),void 0!==t.emissiveMap&&(i.emissiveMap=n(t.emissiveMap)),void 0!==t.emissiveIntensity&&(i.emissiveIntensity=t.emissiveIntensity),void 0!==t.specularMap&&(i.specularMap=n(t.specularMap)),void 0!==t.specularIntensityMap&&(i.specularIntensityMap=n(t.specularIntensityMap)),void 0!==t.specularColorMap&&(i.specularColorMap=n(t.specularColorMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapIntensity&&(i.envMapIntensity=t.envMapIntensity),void 0!==t.reflectivity&&(i.reflectivity=t.reflectivity),void 0!==t.refractionRatio&&(i.refractionRatio=t.refractionRatio),void 0!==t.lightMap&&(i.lightMap=n(t.lightMap)),void 0!==t.lightMapIntensity&&(i.lightMapIntensity=t.lightMapIntensity),void 0!==t.aoMap&&(i.aoMap=n(t.aoMap)),void 0!==t.aoMapIntensity&&(i.aoMapIntensity=t.aoMapIntensity),void 0!==t.gradientMap&&(i.gradientMap=n(t.gradientMap)),void 0!==t.clearcoatMap&&(i.clearcoatMap=n(t.clearcoatMap)),void 0!==t.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(t.clearcoatRoughnessMap)),void 0!==t.clearcoatNormalMap&&(i.clearcoatNormalMap=n(t.clearcoatNormalMap)),void 0!==t.clearcoatNormalScale&&(i.clearcoatNormalScale=(new me).fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(i.iridescenceMap=n(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(i.iridescenceThicknessMap=n(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(i.thicknessMap=n(t.thicknessMap)),void 0!==t.anisotropyMap&&(i.anisotropyMap=n(t.anisotropyMap)),void 0!==t.sheenColorMap&&(i.sheenColorMap=n(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}static createMaterialFromType(t){return new{ShadowMaterial:ih,SpriteMaterial:lo,RawShaderMaterial:rh,ShaderMaterial:ir,PointsMaterial:wl,MeshPhysicalMaterial:ah,MeshStandardMaterial:sh,MeshPhongMaterial:oh,MeshToonMaterial:lh,MeshNormalMaterial:ch,MeshLambertMaterial:hh,MeshDepthMaterial:Ha,MeshDistanceMaterial:Va,MeshBasicMaterial:pi,MeshMatcapMaterial:uh,LineDashedMaterial:dh,LineBasicMaterial:fl,Material:di}[t]}}class ou{static decodeText(t){if("undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;n0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t0&&this._mixBufferRegionAdditive(n,i,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(n[t]!==n[t+e]){a.setValue(n,i);break}}saveOriginalState(){const t=this.binding,e=this.buffer,n=this.valueSize,i=n*this._origIndex;t.getValue(e,i);for(let t=n,r=i;t!==r;++t)e[t]=e[i+t%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n=.5)for(let i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){ke.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;ke.multiplyQuaternionsFlat(t,s,t,e,t,n),ke.slerpFlat(t,e,t,e,t,s,i)}_lerp(t,e,n,i,r){const s=1-i;for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]*s+t[n+a]*i}}_lerpAdditive(t,e,n,i,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[n+s]*i}}}const Lu="\\[\\]\\.:\\/",Pu=new RegExp("["+Lu+"]","g"),Iu="[^"+Lu+"]",Uu="[^"+Lu.replace("\\.","")+"]",Du=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Iu)+/(WCOD+)?/.source.replace("WCOD",Uu)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Iu)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Iu)+"$"),Nu=["material","materials","bones","map"];class Ou{constructor(t,e,n){this.path=e,this.parsedPath=n||Ou.parseTrackName(e),this.node=Ou.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Ou.Composite(t,e,n):new Ou(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Pu,"")}static parseTrackName(t){const e=Du.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==Nu.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i0){const t=this._interpolants,e=this._propertyBindings;if(this.blendMode===Ot)for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(a);else for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulate(i,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(t)[0];e*=i,t>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){e*=n.evaluate(t)[0],t>n.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,n=this.loop;let i=this.time+t,r=this._loopCount;const s=2202===n;if(0===t)return-1===r?i:s&&1==(1&r)?e-i:i;if(2200===n){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(i>=e)i=e;else{if(!(i<0)){this.time=i;break t}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=t>0?e:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&1==(1&r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=Ut,i.endingEnd=Ut):(i.endingStart=t?this.zeroSlopeAtStart?Ut:It:Dt,i.endingEnd=e?this.zeroSlopeAtEnd?Ut:It:Dt)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=n,this}}const Bu=new Float32Array(1);class zu{constructor(t){this.value=t}clone(){return new zu(void 0===this.value.clone?this.value:this.value.clone())}}let Gu=0;function Hu(t,e){return t.distance-e.distance}function Vu(t,e,n,i){if(t.layers.test(e.layers)&&t.raycast(e,n),!0===i){const i=t.children;for(let t=0,r=i.length;t=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let a=0;a!==n;++a){e[a]._update(i,t,r,s)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(s);return this}setTime(t){this.time=0;for(let t=0;t=r){const s=r++,c=t[s];e[c.uuid]=l,t[l]=c,e[o]=s,t[s]=a;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[s],r=e[l];e[l]=i,e[s]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=t.length;for(let a=0,o=arguments.length;a!==o;++a){const o=arguments[a].uuid,l=e[o];if(void 0!==l)if(delete e[o],l0&&(e[a.uuid]=l),t[l]=a,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t];e[l]=e[r],e.pop()}}}this.nCachedObjects_=r}subscribe_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,a=this._parsedPaths,o=this._objects,l=o.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[t]=i,s.push(t),a.push(e),r.push(h);for(let n=c,i=o.length;n!==i;++n){const i=o[n];h[n]=new Ou(i,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,a=s.length-1,o=s[a];e[t[a]]=n,s[n]=o,s.pop(),r[n]=r[a],r.pop(),i[n]=i[a],i.pop()}}},t.AnimationUtils=vh,t.ArcCurve=Ol,t.ArrayCamera=qa,t.ArrowHelper=class extends jn{constructor(t=new We(0,0,1),e=new We(0,0,0),n=1,i=16776960,r=.2*n,s=.2*r){super(),this.type="ArrowHelper",void 0===ld&&(ld=new Ii,ld.setAttribute("position",new Ti([0,0,0,0,1,0],3)),cd=new sc(0,.5,1,5,1),cd.translate(0,-.5,0)),this.position.copy(e),this.line=new Ml(ld,new fl({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ji(cd,new pi({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,s)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{od.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(od,e)}}setLength(t,e=.2*t,n=.2*e){this.line.scale.set(1,Math.max(1e-4,t-e),1),this.line.updateMatrix(),this.cone.scale.set(n,e,n),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}},t.AttachedBindMode=y,t.Audio=Tu,t.AudioAnalyser=class{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;nthis.max.x||t.ythis.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.xthis.max.x||t.max.ythis.max.y)}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ku).distanceTo(t)}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},t.Box3=qe,t.Box3Helper=class extends Tl{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Ii;i.setIndex(new Mi(n,1)),i.setAttribute("position",new Ti([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new fl({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}},t.BoxGeometry=$i,t.BoxHelper=class extends Tl{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new Ii;r.setIndex(new Mi(n,1)),r.setAttribute("position",new Mi(i,3)),super(r,new fl({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&ad.setFromObject(this.object),ad.isEmpty())return;const e=ad.min,n=ad.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=e.x,r[4]=n.y,r[5]=n.z,r[6]=e.x,r[7]=e.y,r[8]=n.z,r[9]=n.x,r[10]=e.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=e.z,r[15]=e.x,r[16]=n.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=n.x,r[22]=e.y,r[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}},t.BufferAttribute=Mi,t.BufferGeometry=Ii,t.BufferGeometryLoader=cu,t.ByteType=1010,t.Cache=Uh,t.Camera=rr,t.CameraHelper=class extends Tl{constructor(t){const e=new Ii,n=new fl({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={};function a(t,e){o(t),o(e)}function o(t){i.push(0,0,0),r.push(0,0,0),void 0===s[t]&&(s[t]=[]),s[t].push(i.length/3-1)}a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4"),e.setAttribute("position",new Ti(i,3)),e.setAttribute("color",new Ti(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update();const l=new ci(16755200),c=new ci(16711680),h=new ci(43775),u=new ci(16777215),d=new ci(3355443);this.setColors(l,c,h,u,d)}setColors(t,e,n,i,r){const s=this.geometry.getAttribute("color");s.setXYZ(0,t.r,t.g,t.b),s.setXYZ(1,t.r,t.g,t.b),s.setXYZ(2,t.r,t.g,t.b),s.setXYZ(3,t.r,t.g,t.b),s.setXYZ(4,t.r,t.g,t.b),s.setXYZ(5,t.r,t.g,t.b),s.setXYZ(6,t.r,t.g,t.b),s.setXYZ(7,t.r,t.g,t.b),s.setXYZ(8,t.r,t.g,t.b),s.setXYZ(9,t.r,t.g,t.b),s.setXYZ(10,t.r,t.g,t.b),s.setXYZ(11,t.r,t.g,t.b),s.setXYZ(12,t.r,t.g,t.b),s.setXYZ(13,t.r,t.g,t.b),s.setXYZ(14,t.r,t.g,t.b),s.setXYZ(15,t.r,t.g,t.b),s.setXYZ(16,t.r,t.g,t.b),s.setXYZ(17,t.r,t.g,t.b),s.setXYZ(18,t.r,t.g,t.b),s.setXYZ(19,t.r,t.g,t.b),s.setXYZ(20,t.r,t.g,t.b),s.setXYZ(21,t.r,t.g,t.b),s.setXYZ(22,t.r,t.g,t.b),s.setXYZ(23,t.r,t.g,t.b),s.setXYZ(24,e.r,e.g,e.b),s.setXYZ(25,e.r,e.g,e.b),s.setXYZ(26,e.r,e.g,e.b),s.setXYZ(27,e.r,e.g,e.b),s.setXYZ(28,e.r,e.g,e.b),s.setXYZ(29,e.r,e.g,e.b),s.setXYZ(30,e.r,e.g,e.b),s.setXYZ(31,e.r,e.g,e.b),s.setXYZ(32,n.r,n.g,n.b),s.setXYZ(33,n.r,n.g,n.b),s.setXYZ(34,n.r,n.g,n.b),s.setXYZ(35,n.r,n.g,n.b),s.setXYZ(36,n.r,n.g,n.b),s.setXYZ(37,n.r,n.g,n.b),s.setXYZ(38,i.r,i.g,i.b),s.setXYZ(39,i.r,i.g,i.b),s.setXYZ(40,r.r,r.g,r.b),s.setXYZ(41,r.r,r.g,r.b),s.setXYZ(42,r.r,r.g,r.b),s.setXYZ(43,r.r,r.g,r.b),s.setXYZ(44,r.r,r.g,r.b),s.setXYZ(45,r.r,r.g,r.b),s.setXYZ(46,r.r,r.g,r.b),s.setXYZ(47,r.r,r.g,r.b),s.setXYZ(48,r.r,r.g,r.b),s.setXYZ(49,r.r,r.g,r.b),s.needsUpdate=!0}update(){const t=this.geometry,e=this.pointMap;rd.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),sd("c",e,t,rd,0,0,-1),sd("t",e,t,rd,0,0,1),sd("n1",e,t,rd,-1,-1,-1),sd("n2",e,t,rd,1,-1,-1),sd("n3",e,t,rd,-1,1,-1),sd("n4",e,t,rd,1,1,-1),sd("f1",e,t,rd,-1,-1,1),sd("f2",e,t,rd,1,-1,1),sd("f3",e,t,rd,-1,1,1),sd("f4",e,t,rd,1,1,1),sd("u1",e,t,rd,.7,1.1,-1),sd("u2",e,t,rd,-.7,1.1,-1),sd("u3",e,t,rd,0,2,-1),sd("cf1",e,t,rd,-1,0,1),sd("cf2",e,t,rd,1,0,1),sd("cf3",e,t,rd,0,-1,1),sd("cf4",e,t,rd,0,1,1),sd("cn1",e,t,rd,-1,0,-1),sd("cn2",e,t,rd,1,0,-1),sd("cn3",e,t,rd,0,-1,-1),sd("cn4",e,t,rd,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}},t.CanvasTexture=class extends Fe{constructor(t,e,n,i,r,s,a,o,l){super(t,e,n,i,r,s,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}},t.CapsuleGeometry=ic,t.CatmullRomCurve3=Vl,t.CineonToneMapping=g,t.CircleGeometry=rc,t.ClampToEdgeWrapping=C,t.Clock=vu,t.Color=ci,t.ColorKeyframeTrack=Eh,t.ColorManagement=Re,t.CompressedArrayTexture=class extends Ul{constructor(t,e,n,i,r,s){super(t,e,n,r,s),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=C}},t.CompressedCubeTexture=class extends Ul{constructor(t,e,n){super(void 0,t[0].width,t[0].height,e,n,b),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}},t.CompressedTexture=Ul,t.CompressedTextureLoader=class extends Oh{constructor(t){super(t)}load(t,e,n,i){const r=this,s=[],a=new Ul,o=new zh(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(r.withCredentials);let l=0;function c(c){o.load(t[c],(function(t){const n=r.parse(t,!0);s[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(a.minFilter=D),a.image=s,a.format=n.format,a.needsUpdate=!0,e&&e(a))}),n,i)}if(Array.isArray(t))for(let e=0,n=t.length;e{e&&e(n),r.manager.itemEnd(t)})).catch((t=>{i&&i(t)})):(setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader;const o=fetch(t,a).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){return Uh.add(t,n),e&&e(n),r.manager.itemEnd(t),n})).catch((function(e){i&&i(e),Uh.remove(t),r.manager.itemError(t),r.manager.itemEnd(t)}));Uh.add(t,o),r.manager.itemStart(t)}},t.ImageLoader=Gh,t.ImageUtils=Ie,t.IncrementStencilOp=7682,t.IncrementWrapStencilOp=34055,t.InstancedBufferAttribute=ko,t.InstancedBufferGeometry=lu,t.InstancedInterleavedBuffer=class extends so{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}},t.InstancedMesh=Ko,t.Int16BufferAttribute=class extends Mi{constructor(t,e,n){super(new Int16Array(t),e,n)}},t.Int32BufferAttribute=class extends Mi{constructor(t,e,n){super(new Int32Array(t),e,n)}},t.Int8BufferAttribute=class extends Mi{constructor(t,e,n){super(new Int8Array(t),e,n)}},t.IntType=z,t.InterleavedBuffer=so,t.InterleavedBufferAttribute=oo,t.Interpolant=xh,t.InterpolateDiscrete=Ct,t.InterpolateLinear=Lt,t.InterpolateSmooth=Pt,t.InvertStencilOp=5386,t.KeepStencilOp=Yt,t.KeyframeTrack=bh,t.LOD=Ao,t.LatheGeometry=nc,t.Layers=In,t.LessCompare=513,t.LessDepth=2,t.LessEqualCompare=515,t.LessEqualDepth=3,t.LessEqualStencilFunc=515,t.LessStencilFunc=513,t.Light=Hh,t.LightProbe=su,t.Line=Ml,t.Line3=class{constructor(t=new We,e=new We){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){Wu.subVectors(t,this.start),Xu.subVectors(this.end,this.start);const n=Xu.dot(Xu);let i=Xu.dot(Wu)/n;return e&&(i=ae(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}},t.LineBasicMaterial=fl,t.LineCurve=Yl,t.LineCurve3=Zl,t.LineDashedMaterial=dh,t.LineLoop=El,t.LineSegments=Tl,t.LinearDisplayP3ColorSpace=kt,t.LinearEncoding=Ft,t.LinearFilter=D,t.LinearInterpolant=Mh,t.LinearMipMapLinearFilter=1008,t.LinearMipMapNearestFilter=1007,t.LinearMipmapLinearFilter=O,t.LinearMipmapNearestFilter=N,t.LinearSRGBColorSpace=Ht,t.LinearToneMapping=m,t.LinearTransfer=Wt,t.Loader=Oh,t.LoaderUtils=ou,t.LoadingManager=Dh,t.LoopOnce=2200,t.LoopPingPong=2202,t.LoopRepeat=2201,t.LuminanceAlphaFormat=1025,t.LuminanceFormat=1024,t.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},t.Material=di,t.MaterialLoader=au,t.MathUtils=pe,t.Matrix3=fe,t.Matrix4=Mn,t.MaxEquation=104,t.Mesh=Ji,t.MeshBasicMaterial=pi,t.MeshDepthMaterial=Ha,t.MeshDistanceMaterial=Va,t.MeshLambertMaterial=hh,t.MeshMatcapMaterial=uh,t.MeshNormalMaterial=ch,t.MeshPhongMaterial=oh,t.MeshPhysicalMaterial=ah,t.MeshStandardMaterial=sh,t.MeshToonMaterial=lh,t.MinEquation=103,t.MirroredRepeatWrapping=L,t.MixOperation=u,t.MultiplyBlending=4,t.MultiplyOperation=h,t.NearestFilter=P,t.NearestMipMapLinearFilter=1005,t.NearestMipMapNearestFilter=1004,t.NearestMipmapLinearFilter=U,t.NearestMipmapNearestFilter=I,t.NeverCompare=512,t.NeverDepth=0,t.NeverStencilFunc=512,t.NoBlending=0,t.NoColorSpace=zt,t.NoToneMapping=p,t.NormalAnimationBlendMode=Nt,t.NormalBlending=1,t.NotEqualCompare=517,t.NotEqualDepth=7,t.NotEqualStencilFunc=517,t.NumberKeyframeTrack=wh,t.Object3D=jn,t.ObjectLoader=class extends Oh{constructor(t){super(t)}load(t,e,n,i){const r=this,s=""===this.path?ou.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||s;const a=new zh(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){let s=null;try{s=JSON.parse(n)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}const a=s.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())return void 0!==i&&i(new Error("THREE.ObjectLoader: Can't load "+t)),void console.error("THREE.ObjectLoader: Can't load "+t);r.parse(s,e)}),n,i)}async loadAsync(t,e){const n=""===this.path?ou.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||n;const i=new zh(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);const r=await i.loadAsync(t,e),s=JSON.parse(r),a=s.metadata;if(void 0===a||void 0===a.type||"geometry"===a.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(s)}parse(t,e){const n=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,i),s=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),a=this.parseTextures(t.textures,s),o=this.parseMaterials(t.materials,a),l=this.parseObject(t.object,r,o,a,n),c=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,c),void 0!==e){let t=!1;for(const e in s)if(s[e].data instanceof HTMLImageElement){t=!0;break}!1===t&&e(l)}return l}async parseAsync(t){const e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,n),r=await this.parseImagesAsync(t.images),s=this.parseTextures(t.textures,r),a=this.parseMaterials(t.materials,s),o=this.parseObject(t.object,i,a,s,e),l=this.parseSkeletons(t.skeletons,o);return this.bindSkeletons(o,l),o}parseShapes(t){const e={};if(void 0!==t)for(let n=0,i=t.length;n0){const n=new Dh(e);r=new Gh(n),r.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e0){i=new Gh(this.manager),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e{const e=new qe;e.min.fromArray(t.boxMin),e.max.fromArray(t.boxMax);const n=new dn;return n.radius=t.sphereRadius,n.center.fromArray(t.sphereCenter),{boxInitialized:t.boxInitialized,box:e,sphereInitialized:t.sphereInitialized,sphere:n}})),s._maxGeometryCount=t.maxGeometryCount,s._maxVertexCount=t.maxVertexCount,s._maxIndexCount=t.maxIndexCount,s._geometryInitialized=t.geometryInitialized,s._geometryCount=t.geometryCount,s._matricesTexture=h(t.matricesTexture.uuid);break;case"LOD":s=new Ao;break;case"Line":s=new Ml(l(t.geometry),c(t.material));break;case"LineLoop":s=new El(l(t.geometry),c(t.material));break;case"LineSegments":s=new Tl(l(t.geometry),c(t.material));break;case"PointCloud":case"Points":s=new Pl(l(t.geometry),c(t.material));break;case"Sprite":s=new bo(c(t.material));break;case"Group":s=new Ya;break;case"Bone":s=new Bo;break;default:s=new jn}if(s.uuid=t.uuid,void 0!==t.name&&(s.name=t.name),void 0!==t.matrix?(s.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(s.matrixAutoUpdate=t.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(void 0!==t.position&&s.position.fromArray(t.position),void 0!==t.rotation&&s.rotation.fromArray(t.rotation),void 0!==t.quaternion&&s.quaternion.fromArray(t.quaternion),void 0!==t.scale&&s.scale.fromArray(t.scale)),void 0!==t.up&&s.up.fromArray(t.up),void 0!==t.castShadow&&(s.castShadow=t.castShadow),void 0!==t.receiveShadow&&(s.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.bias&&(s.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(s.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(s.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&s.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(s.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(s.visible=t.visible),void 0!==t.frustumCulled&&(s.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(s.renderOrder=t.renderOrder),void 0!==t.userData&&(s.userData=t.userData),void 0!==t.layers&&(s.layers.mask=t.layers),void 0!==t.children){const a=t.children;for(let t=0;t1)for(let n=0;nNumber.EPSILON){if(l<0&&(n=e[s],o=-o,a=e[r],l=-l),t.ya.y)continue;if(t.y===n.y){if(t.x===n.x)return!0}else{const e=l*(t.x-n.x)-o*(t.y-n.y);if(0===e)return!0;if(e<0)continue;i=!i}}else{if(t.y!==n.y)continue;if(a.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=a.x)return!0}}return i}const n=Gc.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,s,a;const o=[];if(1===i.length)return s=i[0],a=new mc,a.curves=s.curves,o.push(a),o;let l=!n(i[0].getPoints());l=t?!l:l;const c=[],h=[];let u,d,p=[],m=0;h[m]=void 0,p[m]=[];for(let e=0,a=i.length;e1){let t=!1,n=0;for(let t=0,e=h.length;t0&&!1===t&&(p=c)}for(let t=0,e=h.length;t=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}},t.WebGL1Renderer=eo,t.WebGL3DRenderTarget=class extends Ge{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Ve(null,t,e,n),this.texture.isRenderTargetTexture=!0}},t.WebGLArrayRenderTarget=class extends Ge{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new He(null,t,e,n),this.texture.isRenderTargetTexture=!0}},t.WebGLCoordinateSystem=$t,t.WebGLCubeRenderTarget=cr,t.WebGLMultipleRenderTargets=class extends Ge{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGLMultipleRenderTargets=!0;const r=this.texture;this.texture=[];for(let t=0;t({collision:!1,move_axis:[0,0]}),S=()=>({collision:!1,closeX:0,closeY:0,closeSqDist:0,farX:0,farY:0,farSqDist:0,edgeX:0,edgeY:0}),F={minMaxA:[0,0],minMaxB:[0,0],edge:[0,0],axis:[0,0],move_axis:[0,0],result:D()},R={p:[0,0],q:[0,0],r:[0,0],s:[0,0],deltaQP:[0,0],axis:[0,0],result:S()},c=class{constructor(){this.vertices=[];this.edges=[];this.center=[0,0]}move(t,e){for(let o=0,i=this.vertices.length;o=e?this.vertices[0]:this.vertices[t+1];this.edges[t][0]=i[0]-o[0],this.edges[t][1]=i[1]-o[1]}}isConvex(){this.computeEdges();const t=this.edges.length;if(t<3)return!1;const e=this.edges[0][0]*this.edges[0+1][1]-this.edges[0][1]*this.edges[0+1][0]>0;for(let i=1;i0!==e)return!1;return this.edges[t-1][0]*this.edges[0][1]-this.edges[t-1][1]*this.edges[0][0]>0===e}computeCenter(){this.center[0]=0,this.center[1]=0;const t=this.vertices.length;for(let e=0;e0||r===0&&o)return s.collision=!1,s.move_axis[0]=0,s.move_axis[1]=0,s;const h=Math.abs(r);hy)return s;if(s.collision=!0,u===0)return s.closeX=e,s.closeY=o,s.closeSqDist=0,s.farX=e,s.farY=o,s.farSqDist=0,s.edgeX=f[0],s.edgeY=f[1],s;const q=Y/Math.abs(u),T=y/Math.abs(u);return s.closeX=e+q*a[0],s.closeY=o+q*a[1],s.closeSqDist=q*q*(a[0]*a[0]+a[1]*a[1]),s.farX=e+T*a[0],s.farY=o+T*a[1],s.farSqDist=T*T*(a[0]*a[0]+a[1]*a[1]),s.edgeX=f[0],s.edgeY=f[1],s}else if(d!==0&&0<=x&&x<=1&&0<=M&&M<=1){const r=n[0]+x*a[0],h=n[1]+x*a[1],u=(r-e)*(r-e)+(h-o)*(h-o);uo[1]&&(o[1]=i)}static distance(t,e,o,i){return to!=g[1]>o&&e<(g[0]-n[0])*(o-n[1])/(g[1]-n[1])+n[0]&&(i=!i)}return i}static copyCollisionTestResult(t,e){e.collision=t.collision,e.move_axis[0]=t.move_axis[0],e.move_axis[1]=t.move_axis[1]}static copyRaycastTestResult(t,e){e.collision=t.collision,e.closeX=t.closeX,e.closeY=t.closeY,e.closeSqDist=t.closeSqDist,e.farX=t.farX,e.farY=t.farY,e.farSqDist=t.farSqDist,e.edgeX=t.edgeX,e.edgeY=t.edgeY}};let C=c;C.makeNewCollisionTestResult=D,C.makeNewRaycastTestResult=S,b.Polygon=C})(gdjs||(gdjs={})); +//# sourceMappingURL=polygon.js.map diff --git a/preview.png b/preview.png new file mode 100644 index 0000000000000000000000000000000000000000..833ff9202acaae7155363f5c86b812e511c5915d Binary files /dev/null and b/preview.png differ diff --git a/profiler.js b/profiler.js new file mode 100644 index 0000000000000000000000000000000000000000..c1705322a353283c0ebbc94f390d5dcb8c681d47 --- /dev/null +++ b/profiler.js @@ -0,0 +1,2 @@ +var gdjs;(function(m){class a{constructor(){this._framesMeasures=[];this._currentFrameIndex=0;this._currentFrameMeasure={parent:null,time:0,lastStartTime:0,subsections:{}};this._currentSection=null;this._maxFramesCount=600;this._framesCount=0;for(;this._framesMeasures.lengththis._maxFramesCount&&(this._framesCount=this._maxFramesCount),this._framesMeasures[this._currentFrameIndex]=this._currentFrameMeasure,this._currentFrameIndex++,this._currentFrameIndex>=this._maxFramesCount&&(this._currentFrameIndex=0)}static _addAverageSectionTimes(t,e,r,o){e.time=(e.time||0)+t.time/r;for(const s in t.subsections)if(t.subsections.hasOwnProperty(s)){const n=e.subsections,i=n[s]=n[s]||{parent:e,time:0,subsections:{}};a._addAverageSectionTimes(t.subsections[s],i,r,o)}}getFramesAverageMeasures(){const t={parent:null,time:0,lastStartTime:0,subsections:{}};for(let e=0;enew Promise(e=>setTimeout(e,u)),h=u=>u.usedResources.map(e=>e.name);let l=null;const p=()=>{if(l)return l;l=[];try{new CompressionStream("gzip"),l.push("cs:gzip")}catch{}try{new CompressionStream("deflate"),l.push("cs:deflate")}catch{}return l};class _{constructor(e,t){this._sceneAndExtensionsData=[];this._notifyScenesForGameResolutionResize=!1;this._paused=!1;this._hasJustResumed=!1;this._sessionMetricsInitialized=!1;this._disableMetrics=!1;this._wasDisposed=!1;this.getPlatformInfo=()=>({isCordova:!!window.cordova,devicePlatform:typeof device!="undefined"&&device.platform||"",navigatorPlatform:typeof navigator!="undefined"?navigator.platform:"",hasTouch:typeof navigator!="undefined"?!!navigator.maxTouchPoints&&navigator.maxTouchPoints>2:!1,supportedCompressionMethods:p()});this._options=t||{},this._variables=new n.VariablesContainer(e.variables),this._variablesByExtensionName=new Map;for(const s of e.eventsFunctionsExtensions)s.globalVariables.length>0&&this._variablesByExtensionName.set(s.name,new n.VariablesContainer(s.globalVariables));this._eventsBasedObjectDatas=new Map,this._data=e,this._updateSceneAndExtensionsData(),this._resourcesLoader=new n.ResourceLoader(this,e.resources.resources,h(e),e.layouts),this._effectsManager=new n.EffectsManager,this._maxFPS=this._data.properties.maxFPS,this._minFPS=this._data.properties.minFPS,this._gameResolutionWidth=this._data.properties.windowWidth,this._gameResolutionHeight=this._data.properties.windowHeight,this._originalWidth=this._gameResolutionWidth,this._originalHeight=this._gameResolutionHeight,this._resizeMode=this._data.properties.sizeOnStartupMode,this._adaptGameResolutionAtRuntime=this._data.properties.adaptGameResolutionAtRuntime,this._scaleMode=e.properties.scaleMode||"linear",this._pixelsRounding=this._data.properties.pixelsRounding,this._antialiasingMode=this._data.properties.antialiasingMode,this._isAntialisingEnabledOnMobile=this._data.properties.antialisingEnabledOnMobile,this._renderer=new n.RuntimeGameRenderer(this,this._options.forceFullscreen||!1),this._watermark=new n.watermark.RuntimeWatermark(this,e.properties.authorUsernames,this._data.properties.watermark),this._sceneStack=new n.SceneStack(this),this._inputManager=new n.InputManager,this._injectExternalLayout=this._options.injectExternalLayout||"",this._debuggerClient=n.DebuggerClient?new n.DebuggerClient(this):null,this._captureManager=n.CaptureManager?new n.CaptureManager(this._renderer,this._options.captureOptions||{}):null,this._isPreview=this._options.isPreview||!1,this._sessionId=null,this._playerId=null,this._embeddedResourcesMappings=new Map;for(const s of this._data.resources.resources)if(s.metadata)try{const i=JSON.parse(s.metadata);i?.embeddedResourcesMapping&&this._embeddedResourcesMappings.set(s.name,i.embeddedResourcesMapping)}catch{g.error("Some metadata of resources can not be successfully parsed.")}this.isUsingGDevelopDevelopmentEnvironment()&&g.info("This game will run on the development version of GDevelop APIs.")}setProjectData(e){this._data=e,this._updateSceneAndExtensionsData(),this._resourcesLoader.setResources(e.resources.resources,h(e),e.layouts)}_updateSceneAndExtensionsData(){const e=this._data.eventsFunctionsExtensions.filter(t=>t.sceneVariables.length>0);if(this._sceneAndExtensionsData=this._data.layouts.map(t=>({sceneData:t,usedExtensionsWithVariablesData:e})),this._eventsBasedObjectDatas.clear(),this._data.eventsFunctionsExtensions)for(const t of this._data.eventsFunctionsExtensions)for(const s of t.eventsBasedObjects)this._eventsBasedObjectDatas.set(t.name+"::"+s.name,s)}getAdditionalOptions(){return this._options}getRenderer(){return this._renderer}getVariables(){return this._variables}getVariablesForExtension(e){return this._variablesByExtensionName.get(e)||null}getSoundManager(){return this._resourcesLoader.getSoundManager()}getImageManager(){return this._resourcesLoader.getImageManager()}getFontManager(){return this._resourcesLoader.getFontManager()}getBitmapFontManager(){return this._resourcesLoader.getBitmapFontManager()}getJsonManager(){return this._resourcesLoader.getJsonManager()}getModel3DManager(){return this._resourcesLoader.getModel3DManager()}getSpineManager(){return this._resourcesLoader.getSpineManager()}getSpineAtlasManager(){return this._resourcesLoader.getSpineAtlasManager()}getInputManager(){return this._inputManager}getEffectsManager(){return this._effectsManager}getGameData(){return this._data}getEventsBasedObjectData(e){const t=this._eventsBasedObjectDatas.get(e);return t||(g.error('The game has no events-based object of the type "'+e+'"'),null)}getSceneAndExtensionsData(e){for(let t=0,s=this._sceneAndExtensionsData.length;t{await this._resourcesLoader.loadGlobalAndFirstSceneResources(e,i),this._resourcesLoader.loadAllSceneInBackground()},t),n.getAllAsynchronouslyLoadingLibraryPromise()])}catch(s){throw this._debuggerClient&&this._debuggerClient.onUncaughtException(s),s}}async loadSceneAssets(e,t){await this._loadAssetsWithLoadingScreen(!1,async s=>{await this._resourcesLoader.loadAndProcessSceneResources(e,s)},t)}async _loadAssetsWithLoadingScreen(e,t,s){this.pause(!0);const i=new n.LoadingScreenRenderer(this.getRenderer(),this._resourcesLoader.getImageManager(),this._data.properties.loadingScreen,this._data.properties.watermark.showWatermark,e);await t(async(o,a)=>{const d=Math.floor(100*o/a);i.setPercent(d),s&&s(d),i.renderIfNeeded()&&await c(1)}),await i.unload(),this.pause(!1)}_getFirstSceneName(){const e=this._data.firstLayout;return this.hasScene(e)?e:this.getSceneAndExtensionsData().sceneData.name}startGameLoop(){this._throwIfDisposed();try{if(!this.hasScene()){g.error("The game has no scene.");return}this._forceGameResolutionUpdate(),this._sceneStack.push(this._getFirstSceneName(),this._injectExternalLayout),this._watermark.displayAtStartup(),this._setupGameVisibilityEvents();let e=0;this._hasJustResumed=!1,this._renderer.startGameLoop(t=>{try{if(this._paused||(e+=t,this._maxFPS>0&&1e3/e>this._maxFPS+7))return!0;const s=e;return e=0,this._notifyScenesForGameResolutionResize&&(this._sceneStack.onGameResolutionResized(),this._notifyScenesForGameResolutionResize=!1),this._sceneStack.step(s)?(this.getInputManager().onFrameEnded(),this._hasJustResumed=!1,!0):!1}catch(s){throw this._debuggerClient&&this._debuggerClient.onUncaughtException(s),s}}),setTimeout(()=>{this._setupSessionMetrics()},4e3),this._captureManager&&this._captureManager.setupCaptureOptions(this._isPreview)}catch(e){throw this._debuggerClient&&this._debuggerClient.onUncaughtException(e),e}}dispose(e){this._renderer.stopGameLoop(),this._sceneStack.dispose(),this._renderer.dispose(e),this._resourcesLoader.dispose(),this._wasDisposed=!0}enableMetrics(e){this._disableMetrics=!e,e&&this._setupSessionMetrics()}_setupGameVisibilityEvents(){typeof navigator!="undefined"&&typeof document!="undefined"&&(document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&(this._hasJustResumed=!0)}),window.addEventListener("resume",()=>{this._hasJustResumed=!0},!1))}_setupSessionMetrics(){if(this._sessionMetricsInitialized||this._disableMetrics||this.isPreview()||typeof fetch=="undefined"||!this._data.properties.projectUuid)return;const e="https://api.gdevelop-app.com/analytics";this._playerId=this._makePlayerUuid();let t=0,s=0,i=Date.now();const r=this.getPlatformInfo();fetch(e+"/session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gameId:this._data.properties.projectUuid,playerId:this._playerId,game:{name:this._data.properties.name||"",packageName:this._data.properties.packageName||"",version:this._data.properties.version||"",location:window.location.href},platform:{isCordova:r.isCordova,devicePlatform:r.devicePlatform,navigatorPlatform:r.navigatorPlatform,hasTouch:r.hasTouch}})}).then(a=>{if(!a.ok)throw console.error("Error while creating the session",a),new Error("Error while creating the session");return a}).then(a=>a.text()).then(a=>{this._sessionId=a}).catch(()=>{});const o=()=>{if(!this._sessionId)return;const a=Date.now();if(s+=a-i,i=a,s<5*1e3)return;const d=Math.floor(s/1e3)*1e3;t+=d,s-=d,navigator.sendBeacon(e+"/session-hit",JSON.stringify({gameId:this._data.properties.projectUuid,playerId:this._playerId,sessionId:this._sessionId,duration:Math.floor(t/1e3)}))};if(typeof navigator!="undefined"&&typeof document!="undefined"){document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?i=Date.now():o()}),window.addEventListener("pagehide",o,!1),window.addEventListener("pause",o,!1),window.addEventListener("resume",()=>{i=Date.now()},!1);const a=typeof safari=="object"&&safari.pushNotification,d=/electron/i.test(navigator.userAgent);(a||d)&&window.addEventListener("beforeunload",()=>{o()})}this._sessionMetricsInitialized=!0,this._sessionId=this._sessionId}_makePlayerUuid(){try{const e="GDJS-internal-player-uuid",t=localStorage.getItem(e);if(t)return t;const s=n.makeUuid();return localStorage.setItem(e,s),s}catch{return n.makeUuid()}}getSessionId(){return this._sessionId}getPlayerId(){return this._playerId}onWindowInnerSizeChanged(){this._forceGameResolutionUpdate()}_forceGameResolutionUpdate(){this.setGameResolutionSize(this._gameResolutionWidth,this._gameResolutionHeight)}startCurrentSceneProfiler(e){this._throwIfDisposed();const t=this._sceneStack.getCurrentScene();return t?(t.startProfiler(e),!0):!1}stopCurrentSceneProfiler(){this._throwIfDisposed();const e=this._sceneStack.getCurrentScene();!e||e.stopProfiler()}wasFirstSceneLoaded(){return this._sceneStack.wasFirstSceneLoaded()}getSceneStack(){return this._sceneStack}isPreview(){return this._isPreview}isUsingGDevelopDevelopmentEnvironment(){return this._options.environment==="dev"}getExtensionProperty(e,t){for(let s of this._data.properties.extensionProperties)if(s.extension===e&&s.property===t)return s.value;return null}resolveEmbeddedResource(e,t){const s=this._embeddedResourcesMappings.get(e);return s&&s[t]?s[t]:t}getEmbeddedResourcesNames(e){return this._embeddedResourcesMappings.has(e)?Object.keys(this._embeddedResourcesMappings.get(e)):[]}getNetworkSyncData(e){const t={var:this._variables.getNetworkSyncData(e),ss:this._sceneStack.getNetworkSyncData(e)||void 0},s={};return this._variablesByExtensionName.forEach((i,r)=>{const o=i.getNetworkSyncData(e);o.length&&(s[r]=o)}),t.extVar=s,(!t.var||t.var.length===0)&&!t.ss&&(!t.extVar||Object.keys(t.extVar).length===0)?null:t}updateFromNetworkSyncData(e){if(this._throwIfDisposed(),e.var&&this._variables.updateFromNetworkSyncData(e.var),e.ss&&this._sceneStack.updateFromNetworkSyncData(e.ss),e.extVar)for(const t in e.extVar){if(!e.extVar.hasOwnProperty(t))continue;const s=e.extVar[t],i=this.getVariablesForExtension(t);i&&i.updateFromNetworkSyncData(s)}}_throwIfDisposed(){if(this._wasDisposed)throw"The RuntimeGame has been disposed and should not be used anymore."}}n.RuntimeGame=_})(gdjs||(gdjs={})); +//# sourceMappingURL=runtimegame.js.map diff --git a/runtimeobject.js b/runtimeobject.js new file mode 100644 index 0000000000000000000000000000000000000000..873123de66071831831059fa9974fbf15c53c662 --- /dev/null +++ b/runtimeobject.js @@ -0,0 +1,2 @@ +var gdjs;(function(n){const _=(C,e,t,i)=>{const s=Math.max(t,C-t),r=Math.max(i,e-i);return Math.pow(s,2)+Math.pow(r,2)},x={moveXArray:[],moveYArray:[]},D={result:n.Polygon.makeNewRaycastTestResult()},F=(C,e,t)=>{if(e.length===0)return e.length=0,t.length=0,!1;if(e.length===1)return C.setPosition(C.getX()+e[0],C.getY()+t[0]),e.length=0,t.length=0,!0;let i=0,s=0;for(let f=0;fi&&(i=A,s=f)}const r=Math.sqrt(i),a=e[s]/r,h=-(t[s]/r),m=a;let g=0,c=0;for(let f=0;f{if(!r.isSyncedOverNetwork())return;const a=r.getNetworkSyncData();a&&(e[r.getName()]=a)});const t=this._variables.getNetworkSyncData({}),i={};for(const r in this._rendererEffects)i[r]=this._rendererEffects[r].getNetworkSyncData();const s={};for(const r in this._timers.items)s[r]=this._timers.items[r].getNetworkSyncData();return{x:this.x,y:this.y,zo:this.zOrder,a:this.angle,hid:this.hidden,lay:this.layer,if:this._instantForces.map(r=>r.getNetworkSyncData()),pfx:this._permanentForceX,pfy:this._permanentForceY,beh:e,var:t,eff:i,tim:s}}updateFromNetworkSyncData(e){if(e.x!==void 0&&this.setX(e.x),e.y!==void 0&&this.setY(e.y),e.zo!==void 0&&this.setZOrder(e.zo),e.a!==void 0&&this.setAngle(e.a),e.hid!==void 0&&this.hidden!==e.hid&&this.hide(e.hid),e.lay!==void 0&&this.layer!==e.lay&&this.setLayer(e.lay),e.if){this.clearForces();for(let t=0,i=e.if.length;tr()),this.clearEffects()}onDestroyed(){}onScenePaused(e){}onSceneResumed(e){}getRendererObject(){}get3DRendererObject(){}getName(){return this.name}getNameId(){return this._nameId}getUniqueId(){return this.id}setPosition(e,t){this.setX(e),this.setY(t)}setX(e){e!==this.x&&(this.x=e,this.invalidateHitboxes())}invalidateHitboxes(){this.hitBoxesDirty=!0,this._runtimeScene.onChildrenLocationChanged()}getX(){return this.x}setY(e){e!==this.y&&(this.y=e,this.invalidateHitboxes())}getY(){return this.y}getDrawableX(){return this.getX()}getDrawableY(){return this.getY()}rotateTowardPosition(e,t,i,s){this.rotateTowardAngle(n.toDegrees(Math.atan2(t-(this.getDrawableY()+this.getCenterY()),e-(this.getDrawableX()+this.getCenterX()))),i,s)}rotateTowardAngle(e,t,i){if(t===0){this.setAngle(e);return}const r=n.evtTools.common.angleDifference(this.getAngle(),e)>=0;let a=this.getAngle()+(r?-1:1)*t*this.getElapsedTime()/1e3;n.evtTools.common.angleDifference(a,e)>0^r&&(a=e),this.setAngle(a),this.getAngle()!==a&&this.setAngle(e)}rotate(e,t){this.setAngle(this.getAngle()+e*this.getElapsedTime()/1e3)}setAngle(e){this.angle!==e&&(this.angle=e,this.invalidateHitboxes())}getAngle(){return this.angle}setLayer(e){if(e===this.layer)return;const t=this._runtimeScene.getLayer(this.layer);this.layer=e;const i=this._runtimeScene.getLayer(this.layer),s=this.getRendererObject();s&&(t.getRenderer().removeRendererObject(s),i.getRenderer().addRendererObject(s,this.zOrder));const r=this.get3DRendererObject();r&&(t.getRenderer().remove3DRendererObject(r),i.getRenderer().add3DRendererObject(r))}getLayer(){return this.layer}isOnLayer(e){return this.layer===e}setZOrder(e){if(e===this.zOrder)return;this.zOrder=e;const t=this.getRendererObject();t&&this._runtimeScene.getLayer(this.layer).getRenderer().changeRendererObjectZOrder(t,e)}getZOrder(){return this.zOrder}getVariables(){return this._variables}static getVariableNumber(e){return e.getAsNumber()}static returnVariable(e){return e}static getVariableString(e){return e.getAsString()}static getVariableChildCount(e){return e.getChildrenCount()}static setVariableNumber(e,t){e.setNumber(t)}static setVariableString(e,t){e.setString(t)}static variableChildExists(e,t){return e.hasChild(t)}static variableRemoveChild(e,t){e.removeChild(t)}static variableClearChildren(e){e.clearChildren()}hasVariable(e){return this._variables.has(e)}getRendererEffects(){return this._rendererEffects}addEffect(e){return this.getRendererObject()?this._runtimeScene.getGame().getEffectsManager().addEffect(e,this._rendererEffects,this):!1}removeEffect(e){return this.getRendererObject()?this._runtimeScene.getGame().getEffectsManager().removeEffect(this._rendererEffects,this,e):!1}clearEffects(){const e=this.getRendererObject();return e?(this._rendererEffects={},this._runtimeScene.getGame().getEffectsManager().clearEffects(e)):!1}setEffectDoubleParameter(e,t,i){return this._runtimeScene.getGame().getEffectsManager().setEffectDoubleParameter(this._rendererEffects,e,t,i)}setEffectStringParameter(e,t,i){return this._runtimeScene.getGame().getEffectsManager().setEffectStringParameter(this._rendererEffects,e,t,i)}setEffectBooleanParameter(e,t,i){return this._runtimeScene.getGame().getEffectsManager().setEffectBooleanParameter(this._rendererEffects,e,t,i)}updateAllEffectParameters(e){return this._runtimeScene.getGame().getEffectsManager().updateAllEffectParameters(this._rendererEffects,e)}enableEffect(e,t){this._runtimeScene.getGame().getEffectsManager().enableEffect(this._rendererEffects,this,e,t)}isEffectEnabled(e){return this._runtimeScene.getGame().getEffectsManager().isEffectEnabled(this._rendererEffects,this,e)}hasEffect(e){return this._runtimeScene.getGame().getEffectsManager().hasEffect(this._rendererEffects,e)}hide(e){e===void 0&&(e=!0),this.hidden=e}isVisible(){return!this.hidden}isHidden(){return this.hidden}setWidth(e){}setHeight(e){}getWidth(){return 0}getHeight(){return 0}getCenterX(){return this.getWidth()/2}getCenterY(){return this.getHeight()/2}getCenterXInScene(){return this.getDrawableX()+this.getCenterX()}getCenterYInScene(){return this.getDrawableY()+this.getCenterY()}setCenterPositionInScene(e,t){this.setX(e+this.x-(this.getDrawableX()+this.getCenterX())),this.setY(t+this.y-(this.getDrawableY()+this.getCenterY()))}setCenterXInScene(e){this.setX(e+this.x-(this.getDrawableX()+this.getCenterX()))}setCenterYInScene(e){this.setY(e+this.y-(this.getDrawableY()+this.getCenterY()))}_getRecycledForce(e,t,i){if(o.forcesGarbage.length===0)return new n.Force(e,t,i);{const s=o.forcesGarbage.pop();return s.setX(e),s.setY(t),s.setMultiplier(i),s}}addForce(e,t,i){i===1?(this._permanentForceX+=e,this._permanentForceY+=t):i===0&&this._instantForces.length>0&&this._instantForces[0].getMultiplier()===0?this._instantForces[0].add(e,t):this._instantForces.push(this._getRecycledForce(e,t,i))}addPolarForce(e,t,i){const s=n.toRad(e),r=Math.cos(s)*t,a=Math.sin(s)*t;this.addForce(r,a,i)}addForceTowardPosition(e,t,i,s){const r=Math.atan2(t-(this.getDrawableY()+this.getCenterY()),e-(this.getDrawableX()+this.getCenterX())),a=Math.cos(r)*i,l=Math.sin(r)*i;this.addForce(a,l,s)}addForceTowardObject(e,t,i){e!=null&&this.addForceTowardPosition(e.getDrawableX()+e.getCenterX(),e.getDrawableY()+e.getCenterY(),t,i)}clearForces(){o.forcesGarbage.push.apply(o.forcesGarbage,this._instantForces),this._instantForces.length=0,this._permanentForceX=0,this._permanentForceY=0}hasNoForces(){return this._instantForces.length===0&&this._permanentForceX===0&&this._permanentForceY===0}updateForces(e){for(let t=0;t=t:(this._timers.put(e,new n.Timer(e)),!1)}timerPaused(e){return this._timers.containsKey(e)?this._timers.get(e).isPaused():!1}resetTimer(e){this._timers.containsKey(e)||this._timers.put(e,new n.Timer(e)),this._timers.get(e).reset()}pauseTimer(e){this._timers.containsKey(e)||this._timers.put(e,new n.Timer(e)),this._timers.get(e).setPaused(!0)}unpauseTimer(e){this._timers.containsKey(e)||this._timers.put(e,new n.Timer(e)),this._timers.get(e).setPaused(!1)}removeTimer(e){this._timers.containsKey(e)&&this._timers.remove(e)}getTimerElapsedTimeInSeconds(e){return this._timers.containsKey(e)?this._timers.get(e).getTime()/1e3:0}getTimerElapsedTimeInSecondsOrNaN(e){return this._timers.containsKey(e)?this._timers.get(e).getTime()/1e3:Number.NaN}separateFromObjects(e,t){let i=x.moveXArray,s=x.moveYArray;i.length=0,s.length=0;const r=this.getHitBoxes();let a=null;for(const l of e){if(l.id===this.id)continue;let h=l.getHitBoxes(),m=h;h.length>4&&(a||(a=this.getAABB()),m=l.getHitBoxesAround(a.min[0],a.min[1],a.max[0],a.max[1]));for(const g of r)for(const c of m){const u=n.Polygon.collisionTest(g,c,t);u.collision&&(i.push(u.move_axis[0]),s.push(u.move_axis[1]))}}return F(this,i,s)}separateFromObjectsList(e,t){let i=x.moveXArray,s=x.moveYArray;i.length=0,s.length=0;const r=this.getHitBoxes();let a=null;for(const l in e.items)if(e.items.hasOwnProperty(l)){const h=e.items[l];for(const m of h){if(m.id===this.id)continue;let g=m.getHitBoxes(),c=g;g.length>4&&(a||(a=this.getAABB()),c=m.getHitBoxesAround(a.min[0],a.min[1],a.max[0],a.max[1]));for(const u of r)for(const B of c){const v=n.Polygon.collisionTest(u,B,t);v.collision&&(i.push(v.move_axis[0]),s.push(v.move_axis[1]))}}}return F(this,i,s)}getDistanceToObject(e){return Math.sqrt(this.getSqDistanceToObject(e))}getSqDistanceToObject(e){if(e===null)return 0;const t=this.getDrawableX()+this.getCenterX()-(e.getDrawableX()+e.getCenterX()),i=this.getDrawableY()+this.getCenterY()-(e.getDrawableY()+e.getCenterY());return t*t+i*i}getDistanceToPosition(e,t){return Math.sqrt(this.getSqDistanceToPosition(e,t))}getSqDistanceToPosition(e,t){const i=this.getDrawableX()+this.getCenterX()-e,s=this.getDrawableY()+this.getCenterY()-t;return i*i+s*s}getAngleToObject(e){if(e===null)return 0;const t=this.getDrawableX()+this.getCenterX()-(e.getDrawableX()+e.getCenterX()),i=this.getDrawableY()+this.getCenterY()-(e.getDrawableY()+e.getCenterY());return n.toDegrees(Math.atan2(-i,-t))}getXFromAngleAndDistance(e,t){return this.getDrawableX()+this.getCenterX()+t*Math.cos(n.toRad(e))}getYFromAngleAndDistance(e,t){return this.getDrawableY()+this.getCenterY()+t*Math.sin(n.toRad(e))}getAngleToPosition(e,t){const i=this.getDrawableX()+this.getCenterX()-e,s=this.getDrawableY()+this.getCenterY()-t;return n.toDegrees(Math.atan2(-s,-i))}putAround(e,t,i,s){const r=n.toRad(s);this.setCenterXInScene(e+Math.cos(r)*i),this.setCenterYInScene(t+Math.sin(r)*i)}putAroundObject(e,t,i){!e||this.putAround(e.getDrawableX()+e.getCenterX(),e.getDrawableY()+e.getCenterY(),t,i)}separateObjectsWithoutForces(e){const t=n.staticArray(o.prototype.separateObjectsWithoutForces);t.length=0;const i=n.staticArray2(o.prototype.separateObjectsWithoutForces);e.values(i);for(let s=0,r=i.length;st[s].getDrawableX()+t[s].getWidth()&&this.setX(t[s].getDrawableX()+t[s].getWidth()),this.getDrawableY()t[s].getDrawableY()+t[s].getHeight()&&this.setY(t[s].getDrawableY()+t[s].getHeight()))}separateObjectsWithForces(e){const t=n.staticArray(o.prototype.separateObjectsWithForces);t.length=0;const i=n.staticArray2(o.prototype.separateObjectsWithForces);e.values(i);for(let s=0,r=i.length;sl+g)return!1;const y=e.getHitBoxesAround(B-g,v-g,B+g,v+g),d=t.getHitBoxesAround(c-l,u-l,c+l,u+l);for(const A of y)if(A!==s){for(const j of d)if(n.Polygon.collisionTest(A,j,i).collision)return!0}return!1}raycastTest(e,t,i,s,r){const a=this.getCenterX(),l=this.getCenterY(),h=_(this.getWidth(),this.getHeight(),a,l),m=(e+i)/2,g=(t+s)/2,c=(i-e)*(i-e)+(s-t)*(s-t),u=this.getDrawableX()+a-m,B=this.getDrawableY()+l-g;let v=D.result;if(v.collision=!1,u*u+B*B>h+c+2*Math.sqrt(c*h))return v;if(r){let p=Number.MAX_VALUE;const f=this.getHitBoxesAround(e,t,i,s);for(const y of f){const d=n.Polygon.raycastTest(y,e,t,i,s);d.collision&&d.closeSqDistp&&d.farSqDist<=c&&(p=d.farSqDist,n.Polygon.copyRaycastTestResult(d,v))}}return v}insideObject(e,t){return this.hitBoxesDirty&&(this.updateHitBoxes(),this.updateAABB(),this.hitBoxesDirty=!1),this.aabb.min[0]<=e&&this.aabb.max[0]>=e&&this.aabb.min[1]<=t&&this.aabb.max[1]>=t}static distanceTest(e,t,i){return e.getSqDistanceToObject(t)<=i}cursorOnObject(e){const t=n.staticArray(o.prototype.cursorOnObject);t.length=2;const i=e.getGame().getInputManager(),s=e.getLayer(this.layer),r=s.convertCoords(i.getCursorX(),i.getCursorY(),0,t);if(this.insideObject(r[0],r[1]))return!0;const a=i.getAllTouchIdentifiers();for(let l=0;ls[2]||o.min[1]>s[3]||o.max[0]{const o=r.getNetworkSyncData(t);o&&(n[s]=o)}),e!==void 0&&e!==1&&(!this.networkId||a.length===0&&!Object.keys(n).length)?null:{var:a,extVar:n,id:this.getOrCreateNetworkId()}}updateFromNetworkSyncData(t){if(t.var&&this._variables.updateFromNetworkSyncData(t.var),t.extVar)for(const e in t.extVar){if(!t.extVar.hasOwnProperty(e))continue;const a=t.extVar[e],n=this._variablesByExtensionName.get(e);n&&n.updateFromNetworkSyncData(a)}}getOrCreateNetworkId(){if(!this.networkId){const t=i.makeUuid().substring(0,8);this.networkId=t}return this.networkId}}i.RuntimeScene=c;let l;(function(s){s[s.CONTINUE=0]="CONTINUE",s[s.PUSH_SCENE=1]="PUSH_SCENE",s[s.POP_SCENE=2]="POP_SCENE",s[s.REPLACE_SCENE=3]="REPLACE_SCENE",s[s.CLEAR_SCENES=4]="CLEAR_SCENES",s[s.STOP_GAME=5]="STOP_GAME"})(l=i.SceneChangeRequest||(i.SceneChangeRequest={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=runtimescene.js.map diff --git a/runtimewatermark.js b/runtimewatermark.js new file mode 100644 index 0000000000000000000000000000000000000000..8acd35057308ef2e0c567c04bf09207760ef64de --- /dev/null +++ b/runtimewatermark.js @@ -0,0 +1,100 @@ +var gdjs;(function(n){let a;(function(r){class s{constructor(e,t,i){this._linkElement=null;this._containerElement=null;this._backgroundElement=null;this._svgElement=null;this._usernameTextElement=null;this._madeWithTextElement=null;this._resizeObserver=null;this._displayDuration=20;this._changeTextDelay=7;this._fadeInDelayAfterGameLoaded=1;this._fadeDuration=.3;this._fadeOutTimeout=null;this._hideTimeout=null;this._fadeOutFirstTextTimeout=null;this._fadeInSecondTextTimeout=null;this._textFontSize=14;this._logoWidth=56;this._logoHeight=45;this._backgroundHeight=150;this._margin=10;this._gameId=e._data.properties.projectUuid,this._gameRenderer=e.getRenderer(),this._authorUsername=t[0],this._placement=i.placement,this._showAtStartup=i.showWatermark,this._isDevEnvironment=e.isUsingGDevelopDevelopmentEnvironment(),i.showWatermark&&this.addStyle()}displayAtStartup(){this._showAtStartup&&this.display()}display(){const e=this._gameRenderer.getDomElementContainer();e&&(this.addWatermarkToGameContainer(e),this._resizeObserver=new ResizeObserver(()=>{const t=e.getBoundingClientRect();this.onResizeGameContainer(t.height)}),this._resizeObserver.observe(e))}updateFontSize(e){this._textFontSize=Math.max(.025*e,12)}updateLogoSize(e){this._logoWidth=Math.max(.06*e,25),this._logoHeight=Math.round(45/56*this._logoWidth)}updateBackgroundHeight(e){this._backgroundHeight=Math.max(.13*e,45)}updateMargin(e){this._margin=Math.max(.025*e,8)}onResizeGameContainer(e){this.updateFontSize(e),this._madeWithTextElement&&(this._madeWithTextElement.style.fontSize=`${this._textFontSize}px`),this._usernameTextElement&&(this._usernameTextElement.style.fontSize=`${this._textFontSize}px`),this.updateLogoSize(e),this._svgElement&&(this._svgElement.setAttribute("height",this._logoHeight.toString()),this._svgElement.setAttribute("width",this._logoWidth.toString())),this.updateBackgroundHeight(e),this._backgroundElement&&(this._backgroundElement.style.height=`${this._backgroundHeight}px`),this.updateMargin(e),this._linkElement&&this.updateElementMargins(this._linkElement)}addWatermarkToGameContainer(e){const t=e.getBoundingClientRect();this.updateFontSize(t.height),this.updateLogoSize(t.height),this.updateBackgroundHeight(t.height),this._containerElement=this.createDivContainer(),this.createBackground();const i=document.createElement("div");this.generateSVGLogo(t.height),this.createMadeWithTextElement(),this.createUsernameTextElement(),this._linkElement=this.createLinkElement(),this._svgElement&&this._containerElement.appendChild(this._svgElement),this._madeWithTextElement&&i.appendChild(this._madeWithTextElement),this._usernameTextElement&&i.appendChild(this._usernameTextElement),this._containerElement.appendChild(i),this._backgroundElement&&e.appendChild(this._backgroundElement),this._linkElement.append(this._containerElement),e.appendChild(this._linkElement),this.setupAnimations()}createBackground(){this._backgroundElement=document.createElement("div"),this._backgroundElement.setAttribute("id","watermark-background"),this._backgroundElement.style.height=`${this._backgroundHeight}px`,this._backgroundElement.style.opacity="0",this._placement.startsWith("top")?(this._backgroundElement.style.top="0",this._backgroundElement.style.backgroundImage="linear-gradient(180deg, rgba(38, 38, 38, .6) 0%, rgba(38, 38, 38, 0) 100% )"):(this._backgroundElement.style.bottom="0",this._backgroundElement.style.backgroundImage="linear-gradient(0deg, rgba(38, 38, 38, .6) 0%, rgba(38, 38, 38, 0) 100% )")}setupAnimations(){requestAnimationFrame(()=>{setTimeout(()=>{!this._containerElement||!this._backgroundElement||!this._linkElement||(this._containerElement.style.opacity="1",this._backgroundElement.style.opacity="1",this._linkElement.style.pointerEvents="all",this._svgElement&&this._svgElement.classList.add("spinning"))},this._fadeInDelayAfterGameLoaded*1e3)}),this._fadeOutTimeout=setTimeout(()=>{!this._containerElement||!this._backgroundElement||(this._containerElement.style.opacity="0",this._backgroundElement.style.opacity="0",this._hideTimeout=setTimeout(()=>{!this._containerElement||!this._backgroundElement||!this._linkElement||(this._linkElement.style.pointerEvents="none",this._containerElement.style.display="none",this._backgroundElement.style.display="none",this._resizeObserver&&this._resizeObserver.disconnect())},this._fadeDuration*1e3))},(this._fadeInDelayAfterGameLoaded+this._displayDuration)*1e3),this._fadeOutFirstTextTimeout=setTimeout(()=>{const{_madeWithTextElement:e,_usernameTextElement:t}=this;!e||t&&(e.style.opacity="0",this._fadeInSecondTextTimeout=setTimeout(()=>{t.style.lineHeight="normal",t.style.opacity="1",e.style.lineHeight="0"},this._fadeDuration*1e3))},(this._fadeInDelayAfterGameLoaded+this._changeTextDelay)*1e3)}createMadeWithTextElement(){this._madeWithTextElement=document.createElement("span"),this._madeWithTextElement.innerText="Made with GDevelop",this._madeWithTextElement.style.fontSize=`${this._textFontSize}px`}createUsernameTextElement(){!this._authorUsername||(this._usernameTextElement=document.createElement("span"),this._usernameTextElement.innerText=`@${this._authorUsername}`,this._usernameTextElement.style.fontSize=`${this._textFontSize}px`,this._usernameTextElement.style.opacity="0",this._usernameTextElement.style.lineHeight="0")}updateElementMargins(e){switch(this._placement){case"top-left":e.style.top=`${this._margin}px`,e.style.left=`${this._margin}px`;break;case"top-right":e.style.top=`${this._margin}px`,e.style.right=`${this._margin}px`;break;case"bottom-left":e.style.bottom=`${this._margin}px`,e.style.left=`${this._margin}px`;break;case"bottom-right":e.style.bottom=`${this._margin}px`,e.style.right=`${this._margin}px`;break;case"top":e.style.top=`${this._margin}px`,e.style.left="50%",e.style.transform="translate(-50%, 0)";break;case"bottom":default:e.style.bottom=`${this._margin}px`,e.style.left="50%",e.style.transform="translate(-50%, 0)";break}}createLinkElement(){const e=document.createElement("a");e.id="watermark-link";let t=this._authorUsername?new URL(`https://gd.games/${this._authorUsername}`):new URL("https://gd.games");return this._isDevEnvironment?t.searchParams.set("dev","true"):(t.searchParams.set("utm_source","gdevelop-game"),t.searchParams.set("utm_medium","game-watermark"),this._gameId&&t.searchParams.set("utm_campaign",this._gameId)),e.href=t.href,e.target="_blank",this.updateElementMargins(e),e}createDivContainer(){const e=document.createElement("div");return e.setAttribute("id","watermark"),e.style.opacity="0",e}generateSVGLogo(e){this._svgElement=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.updateLogoSize(e),this._svgElement.setAttribute("height",this._logoHeight.toString()),this._svgElement.setAttribute("width",this._logoWidth.toString()),this._svgElement.setAttribute("viewBox","-2 -2 59 48"),this._svgElement.setAttribute("fill","none");const t=document.createElementNS("http://www.w3.org/2000/svg","path"),i=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d","M29.3447 33C25.1061 33 21.0255 31.8475 17.4207 29.3381C14.9081 27.5897 12 23.6418 12 16.9488C12 4.53178 18.3074 0 30.9827 0H53.8027L56 7.07232H32.7217C24.3558 7.07232 19.3813 7.72835 19.3813 16.9488C19.3813 19.9944 20.2354 22.1618 21.9933 23.574C24.9642 25.9612 30.7388 26.0628 34.2673 25.7208C34.2673 25.7208 35.715 21.0394 35.9534 20.2794C36.2327 19.3888 36.1104 19.1763 35.2392 19.1763C33.9808 19.1763 31.7185 19.1763 29.3175 19.1763C27.6349 19.1763 25.9818 18.3247 25.9818 16.2793C25.9818 14.3039 27.5198 13.1573 29.6281 13.1573C33.2786 13.1573 40.7969 13.1573 42.2041 13.1573C44.0489 13.1573 45.9315 13.4233 44.971 16.3601L39.8842 31.8734C39.8845 31.8738 35.7287 33 29.3447 33Z"),i.setAttribute("d","M43.3039 35.3278C40.7894 37.1212 37.0648 38.1124 30.7449 38.1124C19.852 38.1124 11.8797 34.1251 8.62927 26.3952C7.0925 22.7415 7.24041 18.6005 7.24041 13H0.00129513C0.00129513 18.9056 -0.0984386 23.5361 1.45249 27.8011C5.51933 38.989 15.992 45 30.0606 45C43.6783 45 49.3213 41.0443 53 35.3278H43.3039Z"),this._svgElement.appendChild(t),this._svgElement.appendChild(i)}addStyle(){const e=document.createElement("style");e.innerHTML=` + @keyframes spin { + 0% { + transform: rotate(0deg); + } + + 5% { + transform: rotate(-10deg); + animation-timing-function: ease-out; + } + + 17% { + transform: rotate(370deg); + animation-timing-function: ease-in-out; + } + + 20% { + transform: rotate(360deg); + animation-timing-function: ease-in-out; + } + + 100% { + transform: rotate(360deg); + } + } + + #watermark-background { + position: absolute; + pointer-events: none; + width: 100%; + transition-property: opacity; + transition-duration: ${this._fadeDuration}s; + } + + #watermark-link { + all: unset; + position: absolute; + cursor: pointer; + pointer-events: none; + user-select: none; + + /* For Safari */ + -webkit-user-select: none; + } + + #watermark { + display: flex; + flex-direction: row; + align-items: center; + transition-property: opacity; + transition-duration: ${this._fadeDuration}s; + transition-timing-function: ease-out; + } + + #watermark > div { + display: flex; + flex-direction: column; + margin-left: 5px; + } + + #watermark span { + color: white; + font-family: 'Tahoma', 'Gill sans', 'Helvetica', 'Arial'; + font-size: ${this._textFontSize}px; + transition: opacity; + transition-duration: ${this._fadeDuration}s; + + /* For Safari */ + -webkit-transition: opacity; + -webkit-transition-duration: ${this._fadeDuration}s; + } + + #watermark svg.spinning { + animation-name: spin; + animation-direction: normal; + animation-duration: 5s; + animation-iteration-count: 3; + animation-delay: 1.5s; + } + + #watermark svg path { + fill: white; + } + + @media (hover: hover) { + #watermark span { + text-decoration: underline; + text-decoration-style: solid; + text-decoration-color: transparent; + } + + #watermark:hover span { + text-decoration-color: white; + + /* For Safari */ + -webkit-text-decoration-color: white; + } + } + `,document.head.appendChild(e)}}r.RuntimeWatermark=s})(a=n.watermark||(n.watermark={}))})(gdjs||(gdjs={})); +//# sourceMappingURL=runtimewatermark.js.map diff --git a/scenestack.js b/scenestack.js new file mode 100644 index 0000000000000000000000000000000000000000..9c7614bd1ae2ce31dcfb0acf70bd8e3349856478 --- /dev/null +++ b/scenestack.js @@ -0,0 +1,2 @@ +var gdjs;(function(o){const r=new o.Logger("Scene stack"),c=new o.Logger("Multiplayer - Debug");class h{constructor(t){this._stack=[];this._wasFirstSceneLoaded=!1;this._isNextLayoutLoading=!1;this._sceneStackSyncDataToApply=null;this._wasDisposed=!1;if(!t)throw"SceneStack must be constructed with a gdjs.RuntimeGame.";this._runtimeGame=t}onGameResolutionResized(){for(let t=0;t{this._loadNewScene(t),this._isNextLayoutLoading=!1}),null)}_loadNewScene(t,s){this._throwIfDisposed();const e=new o.RuntimeScene(this._runtimeGame);if(e.loadFromScene(this._runtimeGame.getSceneAndExtensionsData(t)),this._wasFirstSceneLoaded=!0,s){const n=this._runtimeGame.getExternalLayoutData(s);n&&e.createObjectsFrom(n.instances,0,0,0,!0)}return this._stack.push(e),e}replace(t,s){if(this._throwIfDisposed(),s)for(;this._stack.length!==0;){let e=this._stack.pop();e&&e.unloadScene()}else if(this._stack.length!==0){let e=this._stack.pop();e&&e.unloadScene()}return this.push(t)}getCurrentScene(){return this._throwIfDisposed(),this._stack.length===0?null:this._stack[this._stack.length-1]}wasFirstSceneLoaded(){return this._wasFirstSceneLoaded}getAllSceneNames(){return this._throwIfDisposed(),this._stack.map(t=>t.getName())}getNetworkSyncData(t){const s=t.playerNumber,e=t.isHost;if(s!==void 0&&!e)return null;const n=[];for(let a=0;at.length){const e=this._stack.length-t.length;this.pop(e),s=!0}return s}dispose(){for(const t of this._stack)t.unloadScene();this._stack.length=0,this._wasDisposed=!0}_throwIfDisposed(){if(this._wasDisposed)throw"The scene stack has been disposed and should not be used anymore."}}o.SceneStack=h})(gdjs||(gdjs={})); +//# sourceMappingURL=scenestack.js.map diff --git a/splash/gd-logo-light.js b/splash/gd-logo-light.js new file mode 100644 index 0000000000000000000000000000000000000000..55b931efe303522cfae8e316335b318c63b8dcea --- /dev/null +++ b/splash/gd-logo-light.js @@ -0,0 +1,2 @@ +var gdjs;(function(z){z.gdevelopLogo="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAvMAAACECAMAAAAqY1S1AAAAPFBMVEUAAAD////////////////////////////////////////////////////////////////////////////YSWgTAAAAE3RSTlMAgN8gYECfv+8QcKCQzzBQrx+wpZQyXAAAEDxJREFUeNrs3Olu6yAQBWCYwWxe7533f9cqilK3qiHY9VZ0vn+REsWSD2iMBxScKQwmaju5nsjLLqICuKfQRNt72Z1TAPcTjCU5iA8K4F5YOzmSUQA3EqKTg1kFcBvceTmcVwA3wVZO0SiAOwhaTtIpgBtoSJJQ3EB9Qic5KG6gNkxyJq0ArjV4ORUpgEuNXk72TwFcqJEV0GcGfx97KYM+M6gDk1wAfWZwnV7KoLiBSmgpg+IGKsFSDk30UAOSNdBED3+ekULUO2ttp3czKoArkLxDNpoBhQjUwkiW70akHepCkuHQ/QjVMZI2sQKojpMUwhwPNWJJcSjjoUpGEloFUCUnyyYFUKUgywiFDVRqlGVYsIFadThZ7zChidYRkXNdHBTcRX/uNM/yk+9dN7LKkLca5cp2odCX3ed6xTb1dv5YqHFeviDLqzq5fY+RcpCTp3mWFLL8q8xHeYhFu37t8Zk3JD+4oTDzM7J4R7K35uTjllgynPlF5kPRLhT7/PbRmWcniyyXZn5GaLjeVzz55BmWrIk3Z/5Z3PhQVNocnPno5wplstb18kJcnPmZxYLCnrqTj0/lZ7T1V93UyyedzLzTGfwavqawtJmzpjPihszPGe718PnHLSW2yaSu49tIQeh35E4+SZKX73sYW58Zb89MFL1psAVDvPmWNZWzJfN6uVvJUCL0yesIYytPHg+zRWhJLFq2CWpZ001Uyk2G32d+xq9M9GFT5l/FTUlpc2jmdWrs8pSYUTLXwS1eEa5QdC6qlwV9fiminE5lPnt/3cbM6zlRCYM82EMzb+TBm/QVen6f+Vnj0Qqya+aDLPmvFgQn68VE5vPPft22zPP843xpc2TmmeThg72zXXMTBKJw5BsWNFnv/15bkzYHBcwIkqZPO792g8KoL3AYAXejkprAPGw08Lq/jVLyy9sNhdvuzHPCQS27Phl7gHk8X5dnvlncBIDbi3m1/5rAR8lUP9w79wJieDpvNBQuuzMvyTtwDHOVjQeYh0OGE5mnixsUrnoyL170NZahKSD6sYnC8p9WagxxwKcyz73nH8m8PG/XJ3mIeTRqVcxLHLeTt+zFPAbJluIjnXkR3zTUqZ2KrT6VeYbK+6eYn6jMi7cwj+ipPMo8iAsEadOFedD5MiNjjzBv484Dp+dNfDLz98c/vZt5Csq3nA6ts2N6HpuC6yrmB7hfljY9mQ+vj+K4GLIfIYosvJpWxD6Z+bt3HPgNw/i5zOs65AM1bpOq8hrm5S4QAhl3Yn7E1b1q6InMp4W/GNBO80czz72SK6rEhzBvT2PeVTCPnpzKPIztAaFBTifmFeUgiapH9cNH1QSasXSR5oOZX+wjmc8+8irjdOZhV0jWo8x71NmStGlnvlVXMJofhQOWSo1XVLmLHP4zfwrz7hxpA+bpDSGYbxA3kDZtzJMdJ7Ta1cwv5dhiT6P/M3+OnrdVzPsq5i8G5x5gHqdqgrTpwbxDfoSqUa/nl0sZysj+Z76e+fbAzXiYeYgbVsW8hy7KS5uezGtUuNcDFkfzAxkHMO9Kr5vF4uM/zLypZh6owmxo/egxnXkHVX6EebShU1na9GTeUNxE6JHuh1nHKi/WJHCA2BzzXAxKDU4Wl6qrQYwl5kfnlce572DeikH54fh+2Kz6PeyUvTNfjdKGzvwIL44wDzxUufPoxTzcPpYX/CCOUpZ+eDlDFw7kCfN2eKJgsOQKqQaLEDPMu/BqwbLePmm3/WH43Us9feMplmBe6toVYoywuHs88jk/oZulDZind/5gni5uSnmqnsxPuGhSP0b2Q/3KGMzz/FhZLVe4ZV6uQDBuQ0CcqjmYzySzqXQ5bNuPmaRWkJm3Pi5yPJ15Tmyf0QsOqX0xorQB8/RoXpl5euwEQMpW5tuHsKgcVD/4r7sJ5kFRcqAEV1HmWoycS3HFfYwnsoZhknLybJ4ZXzMvzOPk3+e6kn+3rb9y097INfNWLWbmWavFJjBvlxrjJynlwDDdsJ152CmfsBRUaQPmKYPBKuYR9Cm/Lmpnnt7FlCGeqH6E5z0D8xIj9VWlC+AKFVFzzO5f48hZ3PI7M+sV8xNOxrlZ0twWh2Fdx80FzO/r+SUmZXH0MRg1ZTkIO+MTlo4sbcA8HTAwT4fTFHR+L+YxYghk5gXND6vQzIN5cJbEXBZXVVzU12Yus167PMZVYOUYN6uTbShMGfVrrvRsDPxFOol5PRu5bkZurczr9Dm1rwFXNGlDZ96DWzB/FRmzNHEDaZMyLzImS8y3hypRh0nMjwFxBTB/P0fnApUb5hWcxu2R8T8uGd+JCI6wnf435PWkWT1iHVaoBuT5gvlEFRk4mDUKzqzHXh+Gkgmd+RQCylxl3CYAlUgb6joYXc3896nMS4VB3op5hCtX5SswD9zKQkRn5Z6I2gm+SU17UPiCqueG2GOOfAjMD2kXQrcvCvNibhc3kiht+jOP6w7ZUXE35tMySEeWmbecT04ZxDW2zF88vIzQ2jKf3KJHKs4QKb4CRKo9uFfsDnFby2XsnMA/r5lnPOm7mrdroq1/ch2kDZF51MRbFfM4ORU8H8182Yxb9xHj70uyaaASVKcG6nCnbG5MgDqU3gWfH9DpKEgT7tnYyDFHZl6l7SkRw/KdvJF0CbPN39pUzczb48xD3LictPk7mdd8o4skGte12JZ05tFVlJgXC7wp3N+FFyoWimi4l+KiLEcy8zJ9gdQcQRxpk4SHDtu8NmobzzNmaWNJQJYWw3P2Ocxr3Egwj5FjogLIzCPIn2deZVKnwj0IGGSrO2ORuBlxzhHmwUvzF0QELbZueKOGYpezmR+OVXabkzZdY5UBJFeMYXPGVBqYwoUYgAZY6cyX451PIF0xQpMy4J8ZsF/O2WffoPoxXzOvoP17UiEvbZqZN5XMY+pCKm3ozL8/VjnE5oSY0IllmN+GKyUeWco8F/4a2MMMUpFVjnlWIKPQ17PnX3f6fVx3pncxz2ks6jlvwTYUA9/f/U4K8CVaoifzCBiRK6Wo8gOgIoqCESyYL8+TojJvaMw/D7799kP+Yl89k2w/5qv2onQzFfr2Hez7zz2AS8ZuejzZm3mPQ0jzRuuZR1TQrwKVYD6ZYsau6mGByPySelUZK90eB2mzmLk/ASj7TsyT5hVkwhwFY7x+N29VzTwmmFczb8H4FsaPmGMmEU1oYl6iZiuQtWZePMbBFoURmEcqzRCDH5+5+/vpiOC8h/lrIXBDXwE11EubaubBeBXzqIcqJ236zyW+kecStzKPcCVQBfPoUoJMxrAYBO/q+elIM2NAeizsNZB7A/Oe9rpJNn3LSNCkTf81I6m4WZcpuzPPI7cpIqiReUykRKASzIOiYHfiNqLMfEAqwfTDrQA/zP0JWHjWgXkijt80dQLqeUVnoqqZh+M8Yb5S3LgE155rAz2xG/puZx6jWMAD5rFwqsT8tRSfxztXsj1m2PBfmaPJn/BLO/O1ssMU5GXZ9A72liht+q8BT6nyubj5B6wBx+W0MY9w5Qi0wTymaNW9h3XkqS4Yqrp7PwdxgzhOX+Zhhsijnl9ZUE5a+osvdqlmHvq7gXmIG0ibvswjP0NdytXKPF76I1AJ5iH4c8xjLcf+fBt5CDa7TJ2PgyPs3uBc3sn8lbrpjJkpxrQa3CTlyO8mpRADIWpTuafTVMd8yrlY0/o37umUZR5QL1c7UplnSLWZQex6XqU+NI1X8Ee3gl9uHHm8h3lHnSg8zOeabGJegYka5tF1DfhTdWeeLugZ5HwL8whXCoC1Yf4LKWACN+OaJIvo6YjMk7R7gzAlHifDNzfhlzzzro15qlCfcgHxM41dapnHIaqaeWCkkZ3szjxacNrmxc3MI7ry1CNgHoQbmxT+XVwnxVnsmk7e0YxB7ozsglr0TSxuvv088xzzGERTmG8X9Dq76fs5lvLafy/ucjk3SJv+zEOVkTYvbmYeVCO7LfN287iFAQCU9bAb6KXZ3RHZsFlvfglzyI4mMIg+m3lPlh6uu7Tp/82FVNw4SJs3MI/IDbkba2feQk+tmAcBmH8vl4Z7tULWLpDH+x6wVZ8hVl/9tMPrLxeJJObs88xDPZ3MvCyuiOgp6dmlhXlF+LYOWdxA2ryHeYHS9q+Pn8E82jWeYx5bLl7dJIRf/mRczLPZtOzMT3IS3izJOt3fZknmUiiz/xBGOBLXR5lnHgeoaRKumXmYoTfEXz2lDZ15hyyqmUd1t1lp0/8bauRmvp35Ednl5tvYH+3d63KqMBSG4WQlIQfCYWbd/71u97Tdyz0a0AAR7ff8pa3WecUQCcx8ZY5q/B7zSfRiMGpmtqqwmUNaic3f3gBClZuX4QXt2Hwu7eiPjN7VNi83iDWbmpf6kpolsRbNT2vXjSD5/7Y2L2G52+aFpZ9iO/c9xP8v3UQ/VdivX7aFKzYGHddis0tLCaV5kWj35l0pywOjJ1XfvKGqeyKXBzdyFkKb5pWXw9jyQ+qa51HPTFrr5IrFuqS1tkYVRNm+v/j13NSO/DOroDTvoatv3gX5C1ubd3wRkqR6fPNyCB7GpUek+88D9pGeOkvYEm831TYfsyxW2da8HMvIaQwtmpdXPIzlBwwGzR+ovCJkvJ9kz1sFVdd8tCTJ79F85h+uXfPyaamL7+lJoflD6fIa72N29V1V8y4H/uKj2qd5JwcYDZuX4yJy919ZrdD8jTY7+lyqMh82tJGpOnsl6W4Ii4MuuUZr2VSeqO2Wm7eLzHXIwRY5JfLtSdijDvwlKTR/NL10v+L9BzhBrTdf5p26p2a2SNJz5ZdmnZXmF3X3/zD57kLe08EpNH+r1Y4+jOqA6ruq5mWCeMfmnWxp07wwVLwMH5pvQNdc18D0gatMtc2H7JTY0LwIUmOj5oWl+59iaL6B2ot5ROurhjYVzdPQJclhn+ZlcOOaNi/k9ZNvQdF8I4mfil6YNDwX/JCdWmFuRLXKPEDdioUNsn1dfPBno7oVp+wHurheWll+nrCj4dnohbE98QNoznZUACfhuCJ6YSY9D3xXIN/lNJmoAE4lcxGN6jHROZv0N2vt5PBxDOcVicuSAvg8jhdkjEzgA2VeQBikwAcaeIlWAJ/GBF5CkwL4MI6XdRjgwKfRjOrhl8ncsvrRU9mAqSJooudVnVMbyTo4fCcALxcHXkfWbH8gHXhJpwAKWkYvvDWbi8f3AXAOEv0Kn0ZVtvG0e5yACWXtoxfU2WfjNMkH/gtfgMGJ9PyE4PPk4kO5T2n+2zuSh/PR/CzynbbO3V+K5GzKsrB/3awA1rw+eqmfBv+DiAI/DTPz8AqO+FUIycNLmIFfY8AsJTzuNOObfzCwgbcyEjfXI3l4pZh5P5ikhLdgiBsKWJUCJ2DbVe9x9AqnYDI3EXDyMJyG6fkWdvLw0Q6vnpwCOBfTE1/BsAZ+AzvwIShhTh7OajxgZ+8xqoFzm/rA+yGNXTy8AdfTTsFjFw9vY5QFT3XCnDA3Ce/m0v3ANahLWOEN7yq6lH14vPY5J4cRPLy/OE4pz34oxB9omDttcUcp+ETRjO5ishfuYjQIvak/vlvA3mF1abkAAAAASUVORK5CYII="})(gdjs||(gdjs={})); +//# sourceMappingURL=gd-logo-light.js.map diff --git a/spriteruntimeobject.js b/spriteruntimeobject.js new file mode 100644 index 0000000000000000000000000000000000000000..34c25ac87935e38d1c2f6440347efbf57f554dd9 --- /dev/null +++ b/spriteruntimeobject.js @@ -0,0 +1,2 @@ +var gdjs;(function(n){class s extends n.RuntimeObject{constructor(t,e){super(t,e);this._scaleX=1;this._scaleY=1;this._blendMode=0;this._flippedX=!1;this._flippedY=!1;this.opacity=255;this._preScale=1;this._animationFrameDirty=!0;this._updateIfNotVisible=!!e.updateIfNotVisible,this._preScale=e.preScale||1,this._renderer=new n.SpriteRuntimeObjectRenderer(this,t),this._animator=new n.SpriteAnimator(e.animations,n.SpriteRuntimeObjectRenderer.getAnimationFrameTextureManager(t.getGame().getImageManager())),this._updateAnimationFrame(),this.onCreated()}reinitialize(t){super.reinitialize(t);const e=this.getInstanceContainer();this._animator.reinitialize(t.animations),this._scaleX=1,this._scaleY=1,this._blendMode=0,this._flippedX=!1,this._flippedY=!1,this.opacity=255,this._updateIfNotVisible=!!t.updateIfNotVisible,this._preScale=t.preScale||1,this._renderer.reinitialize(this,e),this._updateAnimationFrame(),this.onCreated()}updateFromObjectData(t,e){return this._preScale=e.preScale||1,this._animator.updateFromObjectData(t.animations,e.animations),this._updateIfNotVisible=!!e.updateIfNotVisible,this._updateAnimationFrame(),this.invalidateHitboxes(),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),anim:this._animator.getNetworkSyncData(),ifx:this.isFlippedX(),ify:this.isFlippedY(),sx:this._scaleX,sy:this._scaleY,op:this.opacity,color:this.getColor()}}updateFromNetworkSyncData(t){super.updateFromNetworkSyncData(t),t.ifx!==void 0&&this.flipX(t.ifx),t.ify!==void 0&&this.flipY(t.ify),t.sx!==void 0&&this.setScaleX(Math.abs(t.sx)),t.sy!==void 0&&this.setScaleY(Math.abs(t.sy)),t.op!==void 0&&this.setOpacity(t.op),t.anim&&(this._animator.updateFromNetworkSyncData(t.anim),this._updateAnimationFrame()),(t.ifx!==void 0||t.ify!==void 0||t.sx!==void 0||t.sy!==void 0||t.anim!==void 0)&&this.invalidateHitboxes(),t.color!==void 0&&this.setColor(t.color)}extraInitializationFromInitialInstance(t){if(t.numberProperties)for(let e=0,i=t.numberProperties.length;e=this.hitBoxes.length&&this.hitBoxes.push(new n.Polygon);for(let i=0;i=this.hitBoxes[e].vertices.length&&this.hitBoxes[e].vertices.push([0,0]),this._transformToGlobal(t.customHitBoxes[e].vertices[i][0],t.customHitBoxes[e].vertices[i][1],this.hitBoxes[e].vertices[i]);this.hitBoxes[e].vertices.length=t.customHitBoxes[e].vertices.length}this.hitBoxes.length=t.customHitBoxes.length}}setAnimation(t){this.setAnimationIndex(t)}setAnimationIndex(t){this._animator.setAnimationIndex(t)&&(this._renderer.update(),this._animationFrameDirty=!0,this.invalidateHitboxes())}setAnimationName(t){this._animator.setAnimationName(t)&&(this._renderer.update(),this._animationFrameDirty=!0,this.invalidateHitboxes())}getAnimation(){return this.getAnimationIndex()}getAnimationIndex(){return this._animator.getAnimationIndex()}getAnimationName(){return this._animator.getAnimationName()}isCurrentAnimationName(t){return this.getAnimationName()===t}setDirectionOrAngle(t){const e=this._animator.setDirectionOrAngle(this.angle,t);e!==null&&(this.angle=e,this._renderer.update(),this._animationFrameDirty=!0,this.invalidateHitboxes(),this._renderer.updateAngle())}getDirectionOrAngle(){return this._animator.getDirectionOrAngle(this.angle)}setAnimationFrame(t){this._animator.setAnimationFrameIndex(t)&&(this._animationFrameDirty=!0,this.invalidateHitboxes())}getAnimationFrame(){return this._animator.getAnimationFrameIndex()}getAnimationElapsedTime(){return this._animator.getAnimationElapsedTime()}setAnimationElapsedTime(t){this._animator.setAnimationElapsedTime(t)&&(this._animationFrameDirty=!0,this.invalidateHitboxes())}getAnimationDuration(){return this._animator.getAnimationDuration()}getAnimationFrameCount(){return this._animator.getAnimationFrameCount()}hasAnimationEndedLegacy(){return this._animator.hasAnimationEndedLegacy()}hasAnimationEnded2(){return this._animator.hasAnimationEnded()}hasAnimationEnded(){return this._animator.hasAnimationEnded()}animationPaused(){return this._animator.isAnimationPaused()}isAnimationPaused(){return this._animator.isAnimationPaused()}pauseAnimation(){this._animator.pauseAnimation()}playAnimation(){this._animator.resumeAnimation()}resumeAnimation(){this._animator.resumeAnimation()}getAnimationSpeedScale(){return this._animator.getAnimationSpeedScale()}setAnimationSpeedScale(t){this._animator.setAnimationSpeedScale(t)}getPointX(t){const e=this._animator.getCurrentFrame();if(t.length===0||e===null)return this.getX();const i=e.getPoint(t),a=n.staticArray(s.prototype.getPointX);return this._transformToGlobal(i.x,i.y,a),a[0]}getPointY(t){const e=this._animator.getCurrentFrame();if(t.length===0||e===null)return this.getY();const i=e.getPoint(t),a=n.staticArray(s.prototype.getPointY);return this._transformToGlobal(i.x,i.y,a),a[1]}getPointPosition(t){const e=this._animator.getCurrentFrame();if(t.length===0||e===null)return[this.getX(),this.getY()];const i=e.getPoint(t),a=n.staticArray(s.prototype.getPointX);return this._transformToGlobal(i.x,i.y,a),[a[0],a[1]]}_transformToGlobal(t,e,i){const a=this._animator.getCurrentFrame();let r=a.center.x,o=a.center.y;this._flippedX&&(t=t+(r-t)*2),this._flippedY&&(e=e+(o-e)*2);const h=Math.abs(this._scaleX*this._preScale),l=Math.abs(this._scaleY*this._preScale);t*=h,e*=l,r*=h,o*=l;const d=this.angle/180*Math.PI,m=Math.cos(d),p=Math.sin(d),u=t-r,f=e-o;t=r+m*u-p*f,e=o+p*u+m*f,i.length=2,i[0]=t+(this.x-a.origin.x*h),i[1]=e+(this.y-a.origin.y*l)}getDrawableX(){const t=this._animator.getCurrentFrame();if(t===null)return this.x;const e=Math.abs(this._scaleX*this._preScale);return this._flippedX?this.x+(-t.origin.x-this._renderer.getUnscaledWidth()+2*t.center.x)*e:this.x-t.origin.x*e}getDrawableY(){const t=this._animator.getCurrentFrame();if(t===null)return this.y;const e=Math.abs(this._scaleY*this._preScale);return this._flippedY?this.y+(-t.origin.y-this._renderer.getUnscaledHeight()+2*t.center.y)*e:this.y-t.origin.y*e}getCenterX(){const t=this._animator.getCurrentFrame();return t===null?0:this._flippedX?(this._renderer.getUnscaledWidth()-t.center.x)*Math.abs(this._scaleX*this._preScale):t.center.x*Math.abs(this._scaleX*this._preScale)}getCenterY(){const t=this._animator.getCurrentFrame();return t===null?0:this._flippedY?(this._renderer.getUnscaledHeight()-t.center.y)*Math.abs(this._scaleY*this._preScale):t.center.y*Math.abs(this._scaleY*this._preScale)}setX(t){if(t===this.x)return;this.x=t,this._animator.getCurrentFrame()!==null&&(this.invalidateHitboxes(),this._renderer.updateX())}setY(t){if(t===this.y)return;this.y=t,this._animator.getCurrentFrame()!==null&&(this.invalidateHitboxes(),this._renderer.updateY())}setAngle(t){const e=this._animator.setAngle(this.angle,t);e!==null&&(this.angle=e,this.invalidateHitboxes(),this._renderer.updateAngle())}getAngle(){return this._animator.getAngle(this.angle)}setBlendMode(t){this._blendMode!==t&&(this._blendMode=t,this._renderer.update())}getBlendMode(){return this._blendMode}setOpacity(t){t<0&&(t=0),t>255&&(t=255),this.opacity=t,this._renderer.updateOpacity()}getOpacity(){return this.opacity}hide(t){t===void 0&&(t=!0),this.hidden=t,this._renderer.updateVisibility()}setColor(t){this._renderer.setColor(t)}getColor(){return this._renderer.getColor()}flipX(t){t!==this._flippedX&&(this._scaleX*=-1,this._flippedX=t,this.invalidateHitboxes(),this._renderer.update())}flipY(t){t!==this._flippedY&&(this._scaleY*=-1,this._flippedY=t,this.invalidateHitboxes(),this._renderer.update())}isFlippedX(){return this._flippedX}isFlippedY(){return this._flippedY}getWidth(){return this._animationFrameDirty&&this._updateAnimationFrame(),this._renderer.getWidth()}getHeight(){return this._animationFrameDirty&&this._updateAnimationFrame(),this._renderer.getHeight()}setWidth(t){this._animationFrameDirty&&this._updateAnimationFrame();const e=this._renderer.getUnscaledWidth();e!==0&&this.setScaleX(t/(e*this._preScale))}setHeight(t){this._animationFrameDirty&&this._updateAnimationFrame();const e=this._renderer.getUnscaledHeight();e!==0&&this.setScaleY(t/(e*this._preScale))}setSize(t,e){this.setWidth(t),this.setHeight(e)}setScale(t){t<0&&(t=0),!(t===Math.abs(this._scaleX)&&t===Math.abs(this._scaleY))&&(this._scaleX=t*(this._flippedX?-1:1),this._scaleY=t*(this._flippedY?-1:1),this._renderer.update(),this.invalidateHitboxes())}setScaleX(t){t<0&&(t=0),t!==Math.abs(this._scaleX)&&(this._scaleX=t*(this._flippedX?-1:1),this._renderer.update(),this.invalidateHitboxes())}setScaleY(t){t<0&&(t=0),t!==Math.abs(this._scaleY)&&(this._scaleY=t*(this._flippedY?-1:1),this._renderer.update(),this.invalidateHitboxes())}getScaleMean(){return(Math.abs(this._scaleX)+Math.abs(this._scaleY))/2}getScale(){const t=Math.abs(this._scaleX),e=Math.abs(this._scaleY);return t===e?t:Math.sqrt(t*e)}getScaleY(){return Math.abs(this._scaleY)}getScaleX(){return Math.abs(this._scaleX)}turnTowardObject(t,e){t!==null&&this.rotateTowardPosition(t.getDrawableX()+t.getCenterX(),t.getDrawableY()+t.getCenterY(),0,e)}}n.SpriteRuntimeObject=s,n.registerObject("Sprite",n.SpriteRuntimeObject),s.supportsReinitialization=!0})(gdjs||(gdjs={})); +//# sourceMappingURL=spriteruntimeobject.js.map diff --git a/timemanager.js b/timemanager.js new file mode 100644 index 0000000000000000000000000000000000000000..cbf80542cc40beea30bcf911dca116e0ea605fcb --- /dev/null +++ b/timemanager.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){class r{constructor(){this._elapsedTime=0;this._timeScale=1;this._timeFromStart=0;this._firstFrame=!0;this._timers=new Hashtable;this._firstUpdateDone=!1;this.reset()}reset(){this._elapsedTime=0,this._timeScale=1,this._timeFromStart=0,this._firstFrame=!0,this._timers=new Hashtable}update(e,s){this._firstUpdateDone&&(this._firstFrame=!1),this._firstUpdateDone=!0,this._elapsedTime=Math.min(e,1e3/s),this._elapsedTime*=this._timeScale;for(const t in this._timers.items)this._timers.items.hasOwnProperty(t)&&this._timers.items[t].updateTime(this._elapsedTime);this._timeFromStart+=this._elapsedTime}setTimeScale(e){e>=0&&(this._timeScale=e)}getTimeScale(){return this._timeScale}getTimeFromStart(){return this._timeFromStart}isFirstFrame(){return this._firstFrame}getElapsedTime(){return this._elapsedTime}addTimer(e){this._timers.put(e,new i.Timer(e))}hasTimer(e){return this._timers.containsKey(e)}getTimer(e){return this._timers.get(e)}removeTimer(e){this._timers.containsKey(e)&&this._timers.remove(e)}}i.TimeManager=r})(gdjs||(gdjs={})); +//# sourceMappingURL=timemanager.js.map diff --git a/timer.js b/timer.js new file mode 100644 index 0000000000000000000000000000000000000000..6d8ff116d1efbdbb26b065ae887ec171b202dce1 --- /dev/null +++ b/timer.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){class t{constructor(e){this._time=0;this._paused=!1;this._name=e}getName(){return this._name}getTime(){return this._time}updateTime(e){this._paused||(this._time+=e)}setTime(e){this._time=e}reset(){this.setTime(0)}setPaused(e){this._paused=e}isPaused(){return this._paused}getNetworkSyncData(){return{time:this._time,paused:this._paused}}updateFromNetworkSyncData(e){this._time=e.time,this._paused=e.paused}}i.Timer=t})(gdjs||(gdjs={})); +//# sourceMappingURL=timer.js.map diff --git a/variable.js b/variable.js new file mode 100644 index 0000000000000000000000000000000000000000..c7aac5eb829d5ef0360f8e5a675a9bade0ed4a48 --- /dev/null +++ b/variable.js @@ -0,0 +1,2 @@ +var gdjs;(function(i){const n=new i.Logger("Variables");class l{constructor(e){this._type="number";this._value=0;this._str="0";this._bool=!1;this._children={};this._childrenArray=[];this._undefinedInContainer=!1;this._playerNumber=0;this.reinitialize(e)}reinitialize(e){if(this._type="number",this._value=0,this._str="0",this._bool=!1,this._children={},this._childrenArray=[],this._undefinedInContainer=!1,e!==void 0){if(this._type=e.type||"number",this._type==="number")this._value=parseFloat(e.value||"0"),this._value!==this._value&&(this._value=0);else if(this._type==="string")this._str=""+e.value||"0";else if(this._type==="boolean")this._bool=!!e.value;else if(this._type==="structure"){if(e.children!==void 0)for(var t=0,r=e.children.length;tNumber.MAX_SAFE_INTEGER&&n.warn("Error while converting JS variable to GDevelop variable: Integers bigger than "+Number.MAX_SAFE_INTEGER+" aren't supported by GDevelop variables, it will be reduced to that size."),variable.setNumber(parseInt(e,10))):typeof e=="function"?n.error("Error while converting JS variable to GDevelop variable: Impossible to set variable value to a function."):n.error("Error while converting JS variable to GDevelop variable: Cannot identify type of object "+e);return this}fromJSON(e){try{var t=JSON.parse(e)}catch(r){return n.error("Unable to parse JSON: "+e+r),this}return this.fromJSObject(t),this}toJSObject(){switch(this._type){case"string":return this.getAsString();case"number":return this.getAsNumber();case"boolean":return this.getAsBoolean();case"structure":const e={};for(const r in this._children)e[r]=this._children[r].toJSObject();return e;case"array":const t=[];for(const r of this._childrenArray)t.push(r===void 0?void 0:r.toJSObject());return t}}isPrimitive(){return i.Variable.isPrimitive(this._type)}clone(){return i.Variable.copy(this,new i.Variable)}setUndefinedInContainer(){this._undefinedInContainer=!0}isUndefinedInContainer(){return this._undefinedInContainer}castTo(e){if(e==="string")this.setString(this.getAsString());else if(e==="number")this.setNumber(this.getAsNumber());else if(e==="boolean")this.setBoolean(this.getAsBoolean());else if(e==="structure"){if(this._type==="structure")return;this._children=this.getAllChildren(),this._type="structure"}else if(e==="array"){if(this._type==="array")return;this._childrenArray=this.getAllChildrenArray(),this._type="array"}}getChild(e){return this._type==="array"?this.getChildAt(Number.isInteger(e)?e:parseInt(e,10)||0):(this._type!=="structure"&&this.castTo("structure"),this.getChildNamed(""+e))}getChildNamed(e){const t=this._children[e];return t??(this._children[e]=new i.Variable)}addChild(e,t){return this._type!=="structure"&&this.castTo("structure"),this._children[e]=t,this}hasChild(e){return this._type==="structure"&&this._children.hasOwnProperty(e)}removeChild(e){this._type==="structure"&&delete this._children[e]}clearChildren(){this._children={},this._childrenArray=[]}replaceChildren(e){this._type="structure",this._children=e}replaceChildrenArray(e){this._type="array",this._childrenArray=e}getAsNumber(){if(this._type!=="number"){let e=0;return this._type==="string"?e=parseFloat(this._str):this._type==="boolean"&&(e=this._bool?1:0),e===e?e:0}return this._value}setNumber(e){this._type="number",e=parseFloat(e),this._value=e===e?e:0}getAsString(){return this._type!=="string"?this._type==="number"?this._value.toString():this._type==="boolean"?this._bool?"true":"false":this._type==="structure"?"[Structure]":this._type==="array"?"[Array]":"":this._str}setString(e){this._type="string",this._str=""+e}getAsNumberOrString(){return this._type==="number"?this._value:this.getAsString()}getAsBoolean(){return this._type!=="boolean"?this._type==="number"?this._value!==0:this._type==="string"?this._str!=="0"&&this._str!==""&&this._str!=="false":!0:this._bool}setBoolean(e){this._type="boolean",this._bool=!!e}toggle(){this.setBoolean(!this.getAsBoolean())}setValue(e){this._type==="string"?this.setString(e):this._type==="number"?this.setNumber(e):this._type==="boolean"&&this.setBoolean(e)}getValue(){return this._type==="number"?this.getAsNumber():this._type==="boolean"?this.getAsBoolean():this.getAsString()}isStructure(){return this._type==="structure"}isNumber(){return this._type==="number"}getType(){return this._type}getAllChildren(){return this._type==="structure"?this._children:this._type==="array"?Object.assign({},this._childrenArray):{}}getAllChildrenArray(){return this._type==="structure"?Object.values(this._children):this._type==="array"?this._childrenArray:[]}getChildrenCount(){return this._type==="structure"?Object.keys(this._children).length:this._type==="array"?this._childrenArray.length:0}add(e){this.setNumber(this.getAsNumber()+e)}sub(e){this.setNumber(this.getAsNumber()-e)}mul(e){this.setNumber(this.getAsNumber()*e)}div(e){this.setNumber(this.getAsNumber()/e)}concatenateString(e){this.setString(this.getAsString()+e)}concatenate(e){this.setString(this.getAsString()+e)}getChildAt(e){return this._type!=="array"&&this.castTo("array"),(this._childrenArray[e]===void 0||this._childrenArray[e]===null)&&(this._childrenArray[e]=new i.Variable),this._childrenArray[e]}removeAtIndex(e){this._type==="array"&&this._childrenArray.splice(e,1)}pushVariableCopy(e){this._type!=="array"&&this.castTo("array"),this._childrenArray.push(e.clone())}_pushVariable(e){this._type!=="array"&&this.castTo("array"),this._childrenArray.push(e)}pushValue(e){this._type!=="array"&&this.castTo("array"),this._childrenArray.push(new i.Variable({type:typeof e,value:e}))}getPlayerOwnership(){return this._playerNumber}setPlayerOwnership(e){this._playerNumber=e}disableSynchronization(){this._playerNumber=null}}i.Variable=l})(gdjs||(gdjs={})); +//# sourceMappingURL=variable.js.map diff --git a/variablescontainer.js b/variablescontainer.js new file mode 100644 index 0000000000000000000000000000000000000000..3b058976efa361ef43308bbc87adbbee35a32df3 --- /dev/null +++ b/variablescontainer.js @@ -0,0 +1,2 @@ +var gdjs;(function(o){const u=class{constructor(r){this._variablesArray=[];this._variables=new Hashtable,r!==void 0&&this.initFrom(r)}initFrom(r,e){e===void 0&&(e=!1),e||(u._deletedVars=u._deletedVars||[],this._variables.keys(u._deletedVars));const a=this;let i=0;for(let t=0;t=this._variablesArray.length){let e=new o.Variable;return this._variables.put("",e),e}else{let e=this._variablesArray[r];return e.isUndefinedInContainer()&&e.reinitialize(),e}}has(r){const e=this._variables.get(r);return!!e&&!e.isUndefinedInContainer()}hasVariable(r){const e=this._variablesArray.find(a=>a===r);return!!e&&!e.isUndefinedInContainer()}getVariableNameInContainerByLoopingThroughAllVariables(r){const e=this._variables.items;for(const a in e)if(e.hasOwnProperty(a)&&e[a]===r)return a;return null}getNetworkSyncData(r){const e=r.playerNumber,a=r.isHost,i=[],t=[];return this._variables.keys(t),t.forEach(n=>{const l=this._variables.get(n),s=l.getPlayerOwnership();if(l.isUndefinedInContainer()||s===null||e!==void 0&&s===0&&!a||s!==0&&e!==s)return;const c=l.getType(),b=c==="structure"||c==="array"?"":l.getValue();i.push({name:n,value:b,type:c,children:this.getStructureNetworkSyncData(l),owner:s})}),i}getStructureNetworkSyncData(r){if(r.getType()==="array"){const e=[];return r.getAllChildrenArray().forEach(a=>{const i=a.getType(),t=i==="structure"||i==="array"?"":a.getValue(),n=a.getPlayerOwnership();a.isUndefinedInContainer()||n===null||e.push({name:"",value:t,type:i,children:this.getStructureNetworkSyncData(a),owner:n})}),e}if(r.getType()==="structure"){const e=r.getAllChildren();if(!e)return;const a=[];return Object.entries(e).forEach(([i,t])=>{const n=t.getType(),l=n==="structure"||n==="array"?"":t.getValue(),s=t.getPlayerOwnership();t.isUndefinedInContainer()||s===null||a.push({name:i,value:l,type:n,children:this.getStructureNetworkSyncData(t),owner:s})}),a}}updateFromNetworkSyncData(r){const e=this;for(let a=0;athis._getVariableDataFromNetworkSyncData(e)):void 0}}};let d=u;d._deletedVars=[],d.badVariablesContainer={_variables:new Hashtable,_variablesArray:[],has:function(){return!1},getFromIndex:function(){return u.badVariable},get:function(){return u.badVariable},remove:function(){},add:function(){},_declare:function(){},initFrom:function(){},getNetworkSyncData:function(){return[]},updateFromNetworkSyncData:function(){},getStructureNetworkSyncData:function(){},_getVariableDataFromNetworkSyncData:function(){return{}},hasVariable:function(){return!1},getVariableNameInContainerByLoopingThroughAllVariables:function(){return""},rebuildIndexFrom:function(){}},d.badVariable={_type:"number",_bool:!1,_children:{},_childrenArray:[],_str:"",_undefinedInContainer:!0,_value:0,_playerNumber:0,fromJSON:()=>o.VariablesContainer.badVariable,toJSObject:()=>0,fromJSObject:()=>o.VariablesContainer.badVariable,reinitialize:()=>{},addChild:()=>o.VariablesContainer.badVariable,castTo:()=>{},clearChildren:()=>{},clone:()=>o.VariablesContainer.badVariable,getChildrenCount:()=>0,replaceChildren:()=>{},replaceChildrenArray:()=>{},getType:function(){return"number"},isPrimitive:function(){return!0},setValue:()=>{},toggle:()=>{},getValue:()=>0,getChild:()=>o.VariablesContainer.badVariable,getChildAt:()=>o.VariablesContainer.badVariable,getChildNamed:()=>o.VariablesContainer.badVariable,hasChild:function(){return!1},isStructure:function(){return!1},isNumber:function(){return!0},removeChild:function(){},setNumber:function(){},setString:function(){},setBoolean:function(){},getAsString:function(){return"0"},getAsNumber:function(){return 0},getAsNumberOrString:function(){return 0},getAsBoolean:function(){return!1},getAllChildren:function(){return{}},getAllChildrenArray:function(){return[]},pushVariableCopy:()=>{},_pushVariable:()=>{},pushValue:()=>{},removeAtIndex:function(){},add:function(){},sub:function(){},mul:function(){},div:function(){},concatenate:function(){},concatenateString:function(){},setUndefinedInContainer:function(){},isUndefinedInContainer:function(){return!0},getPlayerOwnership:function(){return 0},setPlayerOwnership:function(){},disableSynchronization:function(){}},o.VariablesContainer=d})(gdjs||(gdjs={})); +//# sourceMappingURL=variablescontainer.js.map