gdcore-tools 2.0.0-gd-v5.5.224-autobuild → 2.0.0-gd-v5.5.226-autobuild

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/dist/Runtime/CustomRuntimeObject.js +1 -1
  2. package/dist/Runtime/CustomRuntimeObject.js.map +2 -2
  3. package/dist/Runtime/CustomRuntimeObject2D.js.map +2 -2
  4. package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js.map +2 -2
  5. package/dist/Runtime/Extensions/3D/Base3DBehavior.js.map +2 -2
  6. package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js +1 -1
  7. package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js.map +2 -2
  8. package/dist/Runtime/Extensions/3D/Cube3DRuntimeObjectPixiRenderer.js +1 -1
  9. package/dist/Runtime/Extensions/3D/Cube3DRuntimeObjectPixiRenderer.js.map +2 -2
  10. package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js.map +2 -2
  11. package/dist/Runtime/Extensions/3D/CustomRuntimeObject3DRenderer.js +1 -1
  12. package/dist/Runtime/Extensions/3D/CustomRuntimeObject3DRenderer.js.map +2 -2
  13. package/dist/Runtime/Extensions/3D/JsExtension.js +219 -108
  14. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js +1 -1
  15. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js.map +2 -2
  16. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js +1 -1
  17. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js.map +2 -2
  18. package/dist/Runtime/Extensions/AdMob/JsExtension.js +63 -1
  19. package/dist/Runtime/Extensions/AdMob/admobtools.js +1 -1
  20. package/dist/Runtime/Extensions/AdMob/admobtools.js.map +2 -2
  21. package/dist/Runtime/Extensions/AdvancedWindow/electron-advancedwindowtools.js.map +2 -2
  22. package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js +1 -1
  23. package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js.map +2 -2
  24. package/dist/Runtime/Extensions/BBText/JsExtension.js +10 -9
  25. package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js.map +2 -2
  26. package/dist/Runtime/Extensions/BitmapText/JsExtension.js +4 -6
  27. package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject-pixi-renderer.js.map +2 -2
  28. package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js.map +2 -2
  29. package/dist/Runtime/Extensions/DialogueTree/dialoguetools.js.map +2 -2
  30. package/dist/Runtime/Extensions/DraggableBehavior/draggableruntimebehavior.js.map +2 -2
  31. package/dist/Runtime/Extensions/Effects/adjustment-pixi-filter.js.map +2 -2
  32. package/dist/Runtime/Extensions/Effects/advanced-bloom-pixi-filter.js.map +2 -2
  33. package/dist/Runtime/Extensions/Effects/ascii-pixi-filter.js.map +2 -2
  34. package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js.map +2 -2
  35. package/dist/Runtime/Extensions/Effects/black-and-white-pixi-filter.js.map +2 -2
  36. package/dist/Runtime/Extensions/Effects/blending-mode-pixi-filter.js.map +2 -2
  37. package/dist/Runtime/Extensions/Effects/brightness-pixi-filter.js.map +2 -2
  38. package/dist/Runtime/Extensions/Effects/bulge-pinch-pixi-filter.js.map +2 -2
  39. package/dist/Runtime/Extensions/Effects/color-map-pixi-filter.js.map +2 -2
  40. package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js.map +2 -2
  41. package/dist/Runtime/Extensions/Effects/crt-pixi-filter.js.map +2 -2
  42. package/dist/Runtime/Extensions/Effects/displacement-pixi-filter.js.map +2 -2
  43. package/dist/Runtime/Extensions/Effects/dot-pixi-filter.js.map +2 -2
  44. package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js.map +2 -2
  45. package/dist/Runtime/Extensions/Effects/glitch-pixi-filter.js.map +2 -2
  46. package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js.map +2 -2
  47. package/dist/Runtime/Extensions/Effects/godray-pixi-filter.js.map +2 -2
  48. package/dist/Runtime/Extensions/Effects/kawase-blur-pixi-filter.js.map +2 -2
  49. package/dist/Runtime/Extensions/Effects/noise-pixi-filter.js.map +2 -2
  50. package/dist/Runtime/Extensions/Effects/old-film-pixi-filter.js.map +2 -2
  51. package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js.map +2 -2
  52. package/dist/Runtime/Extensions/Effects/pixelate-pixi-filter.js.map +2 -2
  53. package/dist/Runtime/Extensions/Effects/pixi-filters/types/drop-shadow/types.d.ts +10 -4
  54. package/dist/Runtime/Extensions/Effects/radial-blur-pixi-filter.js.map +2 -2
  55. package/dist/Runtime/Extensions/Effects/reflection-pixi-filter.js.map +2 -2
  56. package/dist/Runtime/Extensions/Effects/rgb-split-pixi-filter.js.map +2 -2
  57. package/dist/Runtime/Extensions/Effects/sepia-pixi-filter.js.map +2 -2
  58. package/dist/Runtime/Extensions/Effects/shockwave-pixi-filter.js.map +2 -2
  59. package/dist/Runtime/Extensions/Effects/tilt-shift-pixi-filter.js.map +2 -2
  60. package/dist/Runtime/Extensions/Effects/twist-pixi-filter.js.map +2 -2
  61. package/dist/Runtime/Extensions/Effects/zoom-blur-pixi-filter.js.map +2 -2
  62. package/dist/Runtime/Extensions/ExampleJsExtension/dummyeffect.js.map +2 -2
  63. package/dist/Runtime/Extensions/FacebookInstantGames/facebookinstantgamestools.js.map +2 -2
  64. package/dist/Runtime/Extensions/Firebase/A_firebasejs/firebase.d.ts +5 -4
  65. package/dist/Runtime/Extensions/Firebase/B_firebasetools/D_cloudfirestoretools.js.map +2 -2
  66. package/dist/Runtime/Extensions/Firebase/B_firebasetools/D_remoteconfigtools.js.map +2 -2
  67. package/dist/Runtime/Extensions/Firebase/JsExtension.js +21 -21
  68. package/dist/Runtime/Extensions/JsExtensionTypes.d.ts +1 -0
  69. package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js.map +2 -2
  70. package/dist/Runtime/Extensions/Lighting/JsExtension.js +2 -2
  71. package/dist/Runtime/Extensions/Lighting/lightobstacleruntimebehavior.js.map +2 -2
  72. package/dist/Runtime/Extensions/Lighting/lightruntimeobject-pixi-renderer.js.map +2 -2
  73. package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js.map +2 -2
  74. package/dist/Runtime/Extensions/LinkedObjects/linkedobjects.js.map +2 -2
  75. package/dist/Runtime/Extensions/Multiplayer/JsExtension.js +122 -0
  76. package/dist/Runtime/Extensions/Multiplayer/messageManager.js.map +2 -2
  77. package/dist/Runtime/Extensions/Multiplayer/multiplayerVariablesManager.js.map +2 -2
  78. package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js +1 -1
  79. package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js.map +2 -2
  80. package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js.map +2 -2
  81. package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js +1 -1
  82. package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js.map +2 -2
  83. package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js +1 -1
  84. package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js.map +2 -2
  85. package/dist/Runtime/Extensions/Multiplayer/peerjs.d.ts +8 -10
  86. package/dist/Runtime/Extensions/P2P/peerjs.d.ts +8 -10
  87. package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject-pixi-renderer.js.map +2 -2
  88. package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js.map +2 -2
  89. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js.map +2 -2
  90. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js.map +2 -2
  91. package/dist/Runtime/Extensions/ParticleSystem/pixi-particles-pixi-renderer.d.ts +2 -1
  92. package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingobstacleruntimebehavior.js.map +2 -2
  93. package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js.map +2 -2
  94. package/dist/Runtime/Extensions/Physics2Behavior/JsExtension.js +106 -106
  95. package/dist/Runtime/Extensions/Physics2Behavior/box2d.d.ts +13 -7
  96. package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
  97. package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js.map +2 -2
  98. package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js +1 -1
  99. package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js.map +2 -2
  100. package/dist/Runtime/Extensions/PhysicsBehavior/physicsruntimebehavior.js.map +2 -2
  101. package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js.map +2 -2
  102. package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js.map +2 -2
  103. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationcomponents.js.map +1 -1
  104. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js +1 -1
  105. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js.map +2 -2
  106. package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject-pixi-renderer.js.map +2 -2
  107. package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js.map +2 -2
  108. package/dist/Runtime/Extensions/SpatialSound/spatialsoundtools.js +1 -1
  109. package/dist/Runtime/Extensions/SpatialSound/spatialsoundtools.js.map +2 -2
  110. package/dist/Runtime/Extensions/Spine/JsExtension.js +5 -4
  111. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-atlas-manager.js +1 -1
  112. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-atlas-manager.js.map +2 -2
  113. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-manager.js +1 -1
  114. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-manager.js.map +2 -2
  115. package/dist/Runtime/Extensions/Spine/spineruntimeobject-pixi-renderer.js +1 -1
  116. package/dist/Runtime/Extensions/Spine/spineruntimeobject-pixi-renderer.js.map +2 -2
  117. package/dist/Runtime/Extensions/Spine/spineruntimeobject.js.map +2 -2
  118. package/dist/Runtime/Extensions/Steamworks/JsExtension.js +12 -12
  119. package/dist/Runtime/Extensions/Steamworks/Z_steamworksinputtools.js.map +2 -2
  120. package/dist/Runtime/Extensions/Steamworks/steamworkstools.js.map +2 -2
  121. package/dist/Runtime/Extensions/TextEntryObject/textentryruntimeobject-pixi-renderer.js.map +2 -2
  122. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js +1 -1
  123. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js.map +2 -2
  124. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js.map +2 -2
  125. package/dist/Runtime/Extensions/TextObject/textruntimeobject-pixi-renderer.js.map +2 -2
  126. package/dist/Runtime/Extensions/TextObject/textruntimeobject.js.map +2 -2
  127. package/dist/Runtime/Extensions/TileMap/JsExtension.js +20 -18
  128. package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js.map +2 -2
  129. package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js.map +2 -2
  130. package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts +1 -3
  131. package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js.map +2 -2
  132. package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js.map +2 -2
  133. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js.map +1 -1
  134. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js.map +2 -2
  135. package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject-pixi-renderer.js.map +2 -2
  136. package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js.map +2 -2
  137. package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js.map +2 -2
  138. package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js.map +1 -1
  139. package/dist/Runtime/Extensions/Video/JsExtension.js +2 -1
  140. package/dist/Runtime/Extensions/Video/videoruntimeobject-pixi-renderer.js.map +2 -2
  141. package/dist/Runtime/Extensions/Video/videoruntimeobject.js.map +2 -2
  142. package/dist/Runtime/InAppTutorialMessage.js +6 -0
  143. package/dist/Runtime/InAppTutorialMessage.js.map +7 -0
  144. package/dist/Runtime/Model3DManager.js.map +2 -2
  145. package/dist/Runtime/ResourceLoader.js.map +2 -2
  146. package/dist/Runtime/RuntimeCustomObjectLayer.js +1 -1
  147. package/dist/Runtime/RuntimeCustomObjectLayer.js.map +2 -2
  148. package/dist/Runtime/RuntimeInstanceContainer.js.map +1 -1
  149. package/dist/Runtime/RuntimeLayer.js.map +2 -2
  150. package/dist/Runtime/SpriteAnimator.js.map +2 -2
  151. package/dist/Runtime/affinetransformation.js.map +1 -1
  152. package/dist/Runtime/debugger-client/abstract-debugger-client.js.map +2 -2
  153. package/dist/Runtime/debugger-client/hot-reloader.js +2 -2
  154. package/dist/Runtime/debugger-client/hot-reloader.js.map +2 -2
  155. package/dist/Runtime/debugger-client/websocket-debugger-client.js +1 -1
  156. package/dist/Runtime/debugger-client/websocket-debugger-client.js.map +2 -2
  157. package/dist/Runtime/events-tools/networktools.js +1 -1
  158. package/dist/Runtime/events-tools/networktools.js.map +2 -2
  159. package/dist/Runtime/fontfaceobserver-font-manager/fontfaceobserver-font-manager.js.map +2 -2
  160. package/dist/Runtime/gd.js.map +2 -2
  161. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js +1 -1
  162. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js.map +2 -2
  163. package/dist/Runtime/inputmanager.js.map +2 -2
  164. package/dist/Runtime/jsonmanager.js.map +2 -2
  165. package/dist/Runtime/layer.js.map +2 -2
  166. package/dist/Runtime/libs/nanomarkdown.js +5 -0
  167. package/dist/Runtime/libs/nanomarkdown.js.map +7 -0
  168. package/dist/Runtime/object-capabilities/AnimatableBehavior.js.map +2 -2
  169. package/dist/Runtime/object-capabilities/EffectBehavior.js.map +2 -2
  170. package/dist/Runtime/object-capabilities/FlippableBehavior.js.map +2 -2
  171. package/dist/Runtime/object-capabilities/OpacityBehavior.js.map +2 -2
  172. package/dist/Runtime/object-capabilities/ResizableBehavior.js.map +2 -2
  173. package/dist/Runtime/object-capabilities/ScalableBehavior.js.map +2 -2
  174. package/dist/Runtime/object-capabilities/TextContainerBehavior.js.map +2 -2
  175. package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js.map +2 -2
  176. package/dist/Runtime/pixi-renderers/DebuggerPixiRenderer.js.map +2 -2
  177. package/dist/Runtime/pixi-renderers/layer-pixi-renderer.js.map +2 -2
  178. package/dist/Runtime/pixi-renderers/loadingscreen-pixi-renderer.js.map +2 -2
  179. package/dist/Runtime/pixi-renderers/pixi-bitmapfont-manager.js.map +2 -2
  180. package/dist/Runtime/pixi-renderers/pixi-filters-tools.js.map +2 -2
  181. package/dist/Runtime/pixi-renderers/pixi-image-manager.js +1 -1
  182. package/dist/Runtime/pixi-renderers/pixi-image-manager.js.map +2 -2
  183. package/dist/Runtime/pixi-renderers/pixi.js +123 -177
  184. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js +1 -1
  185. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js.map +2 -2
  186. package/dist/Runtime/pixi-renderers/runtimescene-pixi-renderer.js.map +2 -2
  187. package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js.map +2 -2
  188. package/dist/Runtime/profiler.js.map +2 -2
  189. package/dist/Runtime/runtimegame.js +1 -1
  190. package/dist/Runtime/runtimegame.js.map +2 -2
  191. package/dist/Runtime/runtimeobject.js +1 -1
  192. package/dist/Runtime/runtimeobject.js.map +2 -2
  193. package/dist/Runtime/runtimescene.js.map +2 -2
  194. package/dist/Runtime/runtimewatermark.js.map +2 -2
  195. package/dist/Runtime/scenestack.js.map +2 -2
  196. package/dist/Runtime/spriteruntimeobject.js.map +2 -2
  197. package/dist/Runtime/variable.js.map +2 -2
  198. package/dist/Runtime/variablescontainer.js.map +2 -2
  199. package/dist/lib/libGD.cjs +1 -1
  200. package/dist/lib/libGD.wasm +0 -0
  201. package/gd.d.ts +5 -2
  202. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- 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<n;++i){const s=t.numberProperties[i];e&&s.name==="animation"&&e.setAnimationIndex(s.value)}t.customSize&&(this.setWidth(t.width),this.setHeight(t.height)),t.opacity!==void 0&&this.setOpacity(t.opacity),t.flippedX&&this.flipX(t.flippedX),t.flippedY&&this.flipY(t.flippedY)}onDeletedFromScene(t){this.onDestroy(t),super.onDeletedFromScene(t),this._instanceContainer.onDestroyFromScene(t)}update(t){this._instanceContainer._updateObjectsPreEvents(),this.doStepPreEvents(this._instanceContainer);const e=this.getRuntimeScene().getProfiler();e&&e.begin(this.type),this.doStepPostEvents(this._instanceContainer),e&&e.end(this.type),this._instanceContainer._updateObjectsPostEvents()}onHotReloading(t){}doStepPreEvents(t){}doStepPostEvents(t){}onDestroy(t){}updatePreRender(t){this._instanceContainer._updateObjectsPreRender(),this.getRenderer().ensureUpToDate()}getRenderer(){return this._renderer}getChildrenContainer(){return this._instanceContainer}onChildrenLocationChanged(){this._isUntransformedHitBoxesDirty=!0,this.invalidateHitboxes(),this.getRenderer().update()}updateHitBoxes(){this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes();const t=this.getLocalTransformation();for(let e=0;e<this._untransformedHitBoxes.length;++e){e>=this.hitBoxes.length&&this.hitBoxes.push(new r.Polygon);for(let i=0;i<this._untransformedHitBoxes[e].vertices.length;++i)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.length<this._untransformedHitBoxes.length;)this.hitBoxes.push(new r.Polygon);this.hitBoxes.length=this._untransformedHitBoxes.length}applyObjectTransformation(t,e,i){const n=i;n[0]=t,n[1]=e,this.getLocalTransformation().transform(n,i)}getLocalTransformation(){return this._isLocalTransformationDirty&&this._updateLocalTransformation(),this._localTransformation}getLocalInverseTransformation(){return this._isLocalTransformationDirty&&this._updateLocalTransformation(),this._localInverseTransformation}_updateLocalTransformation(){const t=Math.abs(this._scaleX),e=Math.abs(this._scaleY),i=this.getUnscaledCenterX()*t,n=this.getUnscaledCenterY()*e,s=this.angle*Math.PI/180;this._localTransformation.setToTranslation(this.x,this.y),this._localTransformation.rotateAround(s,i,n),this._flippedX&&this._localTransformation.flipX(i),this._flippedY&&this._localTransformation.flipY(n),this._localTransformation.scale(t,e),this._localInverseTransformation.copyFrom(this._localTransformation),this._localInverseTransformation.invert(),this._isLocalTransformationDirty=!1}applyObjectInverseTransformation(t,e,i){const n=i;n[0]=t,n[1]=e,this.getLocalInverseTransformation().transform(n,i)}getDrawableX(){let t=0;this._innerArea?t=this._innerArea.min[0]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),t=this._unrotatedAABB.min[0]);const e=this.getScaleX();return this._flippedX?this.x+(-t-this.getUnscaledWidth()+2*this.getUnscaledCenterX())*e:this.x+t*e}getDrawableY(){let t=0;this._innerArea?t=this._innerArea.min[1]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),t=this._unrotatedAABB.min[1]);const e=this.getScaleY();return this._flippedY?this.y+(-t-this.getUnscaledHeight()+2*this.getUnscaledCenterY())*e:this.y+t*e}getInnerAreaMinX(){return this._innerArea?this._innerArea.min[0]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._unrotatedAABB.min[0])}getInnerAreaMinY(){return this._innerArea?this._innerArea.min[1]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._unrotatedAABB.min[1])}getInnerAreaMaxX(){return this._innerArea?this._innerArea.max[0]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._unrotatedAABB.max[0])}getInnerAreaMaxY(){return this._innerArea?this._innerArea.max[1]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._unrotatedAABB.max[1])}getUnscaledWidth(){return this._innerArea?this._innerArea.max[0]-this._innerArea.min[0]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._unrotatedAABB.max[0]-this._unrotatedAABB.min[0])}getUnscaledHeight(){return this._innerArea?this._innerArea.max[1]-this._innerArea.min[1]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._unrotatedAABB.max[1]-this._unrotatedAABB.min[1])}getUnscaledCenterX(){return this._customCenter?this._customCenter[0]:this._innerArea?(this._innerArea.min[0]+this._innerArea.max[0])/2:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),(this._unrotatedAABB.min[0]+this._unrotatedAABB.max[0])/2)}getUnscaledCenterY(){return this._customCenter?this._customCenter[1]:this._innerArea?(this._innerArea.min[1]+this._innerArea.max[1])/2:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),(this._unrotatedAABB.min[1]+this._unrotatedAABB.max[1])/2)}setRotationCenter(t,e){this._customCenter||(this._customCenter=[0,0]),this._customCenter[0]=t,this._customCenter[1]=e,this._isLocalTransformationDirty=!0,this.invalidateHitboxes()}hasCustomRotationCenter(){return!!this._customCenter}getCenterX(){return(this.getUnscaledCenterX()-this._unrotatedAABB.min[0])*this.getScaleX()}getCenterY(){return(this.getUnscaledCenterY()-this._unrotatedAABB.min[1])*this.getScaleY()}getWidth(){return this.getUnscaledWidth()*this.getScaleX()}getHeight(){return this.getUnscaledHeight()*this.getScaleY()}setWidth(t){const e=this.getUnscaledWidth();if(e===0)return;const i=t/e;this._innerArea&&this._isInnerAreaFollowingParentSize?(this._innerArea.min[0]*=i,this._innerArea.max[0]*=i):this.setScaleX(i)}setHeight(t){const e=this.getUnscaledHeight();if(e===0)return;const i=t/e;this._innerArea&&this._isInnerAreaFollowingParentSize?(this._innerArea.min[1]*=i,this._innerArea.max[1]*=i):this.setScaleY(i)}setSize(t,e){this.setWidth(t),this.setHeight(e)}setX(t){t!==this.x&&(this.x=t,this._isLocalTransformationDirty=!0,this.invalidateHitboxes(),this.getRenderer().updateX())}setY(t){t!==this.y&&(this.y=t,this._isLocalTransformationDirty=!0,this.invalidateHitboxes(),this.getRenderer().updateY())}setAngle(t){this.angle!==t&&(this.angle=t,this._isLocalTransformationDirty=!0,this.invalidateHitboxes(),this.getRenderer().updateAngle())}setScale(t){this._innerArea&&this._isInnerAreaFollowingParentSize||(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._isLocalTransformationDirty=!0,this.invalidateHitboxes(),this.getRenderer().update()))}setScaleX(t){this._innerArea&&this._isInnerAreaFollowingParentSize||(t<0&&(t=0),t!==Math.abs(this._scaleX)&&(this._scaleX=t*(this._flippedX?-1:1),this._isLocalTransformationDirty=!0,this.invalidateHitboxes(),this.getRenderer().update()))}setScaleY(t){this._innerArea&&this._isInnerAreaFollowingParentSize||(t<0&&(t=0),t!==Math.abs(this._scaleY)&&(this._scaleY=t*(this._flippedY?-1:1),this.invalidateHitboxes(),this.getRenderer().update()))}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)}setOpacity(t){t<0&&(t=0),t>255&&(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={}));
1
+ var gdjs;(function(s){const o=new s.Logger("CustomRuntimeObject");class h extends s.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 s.AffineTransformation;this._localInverseTransformation=new s.AffineTransformation;this._isLocalTransformationDirty=!0;this._type=e.type,this._instanceContainer=new s.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<n;++i){const r=t.numberProperties[i];e&&r.name==="animation"&&e.setAnimationIndex(r.value)}t.customSize&&(this.setWidth(t.width),this.setHeight(t.height)),t.opacity!==void 0&&this.setOpacity(t.opacity),t.flippedX&&this.flipX(t.flippedX),t.flippedY&&this.flipY(t.flippedY)}onDeletedFromScene(t){this.onDestroy(t),super.onDeletedFromScene(t),this._instanceContainer.onDestroyFromScene(t)}update(t){this._instanceContainer._updateObjectsPreEvents(),this.doStepPreEvents(this._instanceContainer);const e=this.getRuntimeScene().getProfiler();e&&e.begin(this.type),this.doStepPostEvents(this._instanceContainer),e&&e.end(this.type),this._instanceContainer._updateObjectsPostEvents()}onHotReloading(t){}doStepPreEvents(t){}doStepPostEvents(t){}onDestroy(t){}updatePreRender(t){this._instanceContainer._updateObjectsPreRender(),this.getRenderer().ensureUpToDate()}getRenderer(){return this._renderer}getChildrenContainer(){return this._instanceContainer}onChildrenLocationChanged(){this._isUntransformedHitBoxesDirty=!0,this.invalidateHitboxes(),this.getRenderer().update()}updateHitBoxes(){this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes();const t=this.getLocalTransformation();for(let e=0;e<this._untransformedHitBoxes.length;++e){e>=this.hitBoxes.length&&this.hitBoxes.push(new s.Polygon);for(let i=0;i<this._untransformedHitBoxes[e].vertices.length;++i)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 r of this._instanceContainer.getAdhocListOfAllInstances()){if(!r.isIncludedInParentCollisionMask())continue;Array.prototype.push.apply(this._untransformedHitBoxes,r.getHitBoxes());const a=r.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.length<this._untransformedHitBoxes.length;)this.hitBoxes.push(new s.Polygon);this.hitBoxes.length=this._untransformedHitBoxes.length}applyObjectTransformation(t,e,i){const n=i;n[0]=t,n[1]=e,this.getLocalTransformation().transform(n,i)}getLocalTransformation(){return this._isLocalTransformationDirty&&this._updateLocalTransformation(),this._localTransformation}getLocalInverseTransformation(){return this._isLocalTransformationDirty&&this._updateLocalTransformation(),this._localInverseTransformation}_updateLocalTransformation(){const t=Math.abs(this._scaleX),e=Math.abs(this._scaleY),i=this.getUnscaledCenterX()*t,n=this.getUnscaledCenterY()*e,r=this.angle*Math.PI/180;this._localTransformation.setToTranslation(this.x,this.y),this._localTransformation.rotateAround(r,i,n),this._flippedX&&this._localTransformation.flipX(i),this._flippedY&&this._localTransformation.flipY(n),this._localTransformation.scale(t,e),this._localInverseTransformation.copyFrom(this._localTransformation),this._localInverseTransformation.invert(),this._isLocalTransformationDirty=!1}applyObjectInverseTransformation(t,e,i){const n=i;n[0]=t,n[1]=e,this.getLocalInverseTransformation().transform(n,i)}getDrawableX(){let t=0;this._innerArea?t=this._innerArea.min[0]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),t=this._unrotatedAABB.min[0]);const e=this.getScaleX();return this._flippedX?this.x+(-t-this.getUnscaledWidth()+2*this.getUnscaledCenterX())*e:this.x+t*e}getDrawableY(){let t=0;this._innerArea?t=this._innerArea.min[1]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),t=this._unrotatedAABB.min[1]);const e=this.getScaleY();return this._flippedY?this.y+(-t-this.getUnscaledHeight()+2*this.getUnscaledCenterY())*e:this.y+t*e}getInnerAreaMinX(){return this._innerArea?this._innerArea.min[0]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._unrotatedAABB.min[0])}getInnerAreaMinY(){return this._innerArea?this._innerArea.min[1]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._unrotatedAABB.min[1])}getInnerAreaMaxX(){return this._innerArea?this._innerArea.max[0]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._unrotatedAABB.max[0])}getInnerAreaMaxY(){return this._innerArea?this._innerArea.max[1]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._unrotatedAABB.max[1])}getUnscaledWidth(){return this._innerArea?this._innerArea.max[0]-this._innerArea.min[0]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._unrotatedAABB.max[0]-this._unrotatedAABB.min[0])}getUnscaledHeight(){return this._innerArea?this._innerArea.max[1]-this._innerArea.min[1]:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),this._unrotatedAABB.max[1]-this._unrotatedAABB.min[1])}getUnscaledCenterX(){return this._customCenter?this._customCenter[0]:this._innerArea?(this._innerArea.min[0]+this._innerArea.max[0])/2:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),(this._unrotatedAABB.min[0]+this._unrotatedAABB.max[0])/2)}getUnscaledCenterY(){return this._customCenter?this._customCenter[1]:this._innerArea?(this._innerArea.min[1]+this._innerArea.max[1])/2:(this._isUntransformedHitBoxesDirty&&this._updateUntransformedHitBoxes(),(this._unrotatedAABB.min[1]+this._unrotatedAABB.max[1])/2)}setRotationCenter(t,e){this._customCenter||(this._customCenter=[0,0]),this._customCenter[0]=t,this._customCenter[1]=e,this._isLocalTransformationDirty=!0,this.invalidateHitboxes()}hasCustomRotationCenter(){return!!this._customCenter}getCenterX(){return(this.getUnscaledCenterX()-this._unrotatedAABB.min[0])*this.getScaleX()}getCenterY(){return(this.getUnscaledCenterY()-this._unrotatedAABB.min[1])*this.getScaleY()}getWidth(){return this.getUnscaledWidth()*this.getScaleX()}getHeight(){return this.getUnscaledHeight()*this.getScaleY()}setWidth(t){const e=this.getUnscaledWidth();if(e===0)return;const i=t/e;this._innerArea&&this._isInnerAreaFollowingParentSize?(this._innerArea.min[0]*=i,this._innerArea.max[0]*=i):this.setScaleX(i)}setHeight(t){const e=this.getUnscaledHeight();if(e===0)return;const i=t/e;this._innerArea&&this._isInnerAreaFollowingParentSize?(this._innerArea.min[1]*=i,this._innerArea.max[1]*=i):this.setScaleY(i)}setSize(t,e){this.setWidth(t),this.setHeight(e)}setX(t){t!==this.x&&(this.x=t,this._isLocalTransformationDirty=!0,this.invalidateHitboxes(),this.getRenderer().updateX())}setY(t){t!==this.y&&(this.y=t,this._isLocalTransformationDirty=!0,this.invalidateHitboxes(),this.getRenderer().updateY())}setAngle(t){this.angle!==t&&(this.angle=t,this._isLocalTransformationDirty=!0,this.invalidateHitboxes(),this.getRenderer().updateAngle())}setScale(t){this._innerArea&&this._isInnerAreaFollowingParentSize||(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._isLocalTransformationDirty=!0,this.invalidateHitboxes(),this.getRenderer().update()))}setScaleX(t){this._innerArea&&this._isInnerAreaFollowingParentSize||(t<0&&(t=0),t!==Math.abs(this._scaleX)&&(this._scaleX=t*(this._flippedX?-1:1),this._isLocalTransformationDirty=!0,this.invalidateHitboxes(),this.getRenderer().update()))}setScaleY(t){this._innerArea&&this._isInnerAreaFollowingParentSize||(t<0&&(t=0),t!==Math.abs(this._scaleY)&&(this._scaleY=t*(this._flippedY?-1:1),this.invalidateHitboxes(),this.getRenderer().update()))}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)}setOpacity(t){t<0&&(t=0),t>255&&(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}}s.CustomRuntimeObject=h,h.supportsReinitialization=!1})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=CustomRuntimeObject.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../GDevelop/GDJS/Runtime/CustomRuntimeObject.ts"],
4
- "sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-2022 Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n const logger = new gdjs.Logger('CustomRuntimeObject');\n\n export type ObjectConfiguration = {\n content: any;\n };\n\n export type CustomObjectConfiguration = ObjectConfiguration & {\n animatable?: SpriteAnimationData[];\n childrenContent: { [objectName: string]: ObjectConfiguration & any };\n };\n\n /**\n * An object that contains other object.\n *\n * This is the base class for objects generated from EventsBasedObject.\n *\n * @see gdjs.CustomRuntimeObjectInstanceContainer\n */\n export abstract class CustomRuntimeObject\n extends gdjs.RuntimeObject\n implements\n gdjs.Resizable,\n gdjs.Scalable,\n gdjs.Flippable,\n gdjs.OpacityHandler {\n _renderer:\n | gdjs.CustomRuntimeObject2DRenderer\n | gdjs.CustomRuntimeObject3DRenderer;\n /** It contains the children of this object. */\n _instanceContainer: gdjs.CustomRuntimeObjectInstanceContainer;\n _isUntransformedHitBoxesDirty: boolean = true;\n /** It contains shallow copies of the children hitboxes */\n private _untransformedHitBoxes: gdjs.Polygon[] = [];\n /** The dimension of this object is calculated from its children AABBs. */\n private _unrotatedAABB: AABB = { min: [0, 0], max: [0, 0] };\n /**\n * The bounds of the object content before any transformation.\n * @see gdjs.CustomRuntimeObjectInstanceContainer._initialInnerArea\n **/\n protected _innerArea: {\n min: [float, float, float];\n max: [float, float, float];\n } | null = null;\n /**\n * When the parent dimensions change:\n * - if `false`, the object is stretch proportionally while children local\n * positions stay the same ({@link gdjs.CustomRuntimeObject._innerArea} don't change).\n * - if `true`, the children local positions need to be adapted by events\n * to follow their parent size.\n */\n protected _isInnerAreaFollowingParentSize = false;\n private _scaleX: float = 1;\n private _scaleY: float = 1;\n private _flippedX: boolean = false;\n private _flippedY: boolean = false;\n private opacity: float = 255;\n private _customCenter: FloatPoint | null = null;\n private _localTransformation: gdjs.AffineTransformation = new gdjs.AffineTransformation();\n private _localInverseTransformation: gdjs.AffineTransformation = new gdjs.AffineTransformation();\n private _isLocalTransformationDirty: boolean = true;\n _type: string;\n\n /**\n * @param parent The container the object belongs to\n * @param objectData The object data used to initialize the object\n */\n constructor(\n parent: gdjs.RuntimeInstanceContainer,\n objectData: ObjectData & CustomObjectConfiguration\n ) {\n super(parent, objectData);\n this._type = objectData.type;\n this._instanceContainer = new gdjs.CustomRuntimeObjectInstanceContainer(\n parent,\n this\n );\n this._renderer = this._createRender();\n\n this._initializeFromObjectData(objectData);\n\n // The generated code calls onCreated at the constructor end\n // and onCreated calls its super implementation at its end.\n }\n\n private _initializeFromObjectData(\n objectData: ObjectData & CustomObjectConfiguration\n ) {\n const eventsBasedObjectData = this._runtimeScene\n .getGame()\n .getEventsBasedObjectData(objectData.type);\n if (!eventsBasedObjectData) {\n logger.error(\n `A CustomRuntimeObject was initialized (or re-initialized) from object data referring to an non existing events based object data with type \"${objectData.type}\".`\n );\n return;\n }\n this._isInnerAreaFollowingParentSize =\n eventsBasedObjectData.isInnerAreaFollowingParentSize;\n if (eventsBasedObjectData.instances.length > 0) {\n if (!this._innerArea) {\n this._innerArea = {\n min: [0, 0, 0],\n max: [0, 0, 0],\n };\n }\n this._innerArea.min[0] = eventsBasedObjectData.areaMinX;\n this._innerArea.min[1] = eventsBasedObjectData.areaMinY;\n this._innerArea.min[2] = eventsBasedObjectData.areaMinZ;\n this._innerArea.max[0] = eventsBasedObjectData.areaMaxX;\n this._innerArea.max[1] = eventsBasedObjectData.areaMaxY;\n this._innerArea.max[2] = eventsBasedObjectData.areaMaxZ;\n }\n this._instanceContainer.loadFrom(objectData, eventsBasedObjectData);\n }\n\n protected abstract _createRender():\n | gdjs.CustomRuntimeObject2DRenderer\n | gdjs.CustomRuntimeObject3DRenderer;\n protected abstract _reinitializeRenderer(): void;\n\n reinitialize(objectData: ObjectData & CustomObjectConfiguration) {\n super.reinitialize(objectData);\n\n this._initializeFromObjectData(objectData);\n this._reinitializeRenderer();\n\n // The generated code calls the onCreated super implementation at the end.\n this.onCreated();\n }\n\n updateFromObjectData(\n oldObjectData: ObjectData & CustomObjectConfiguration,\n newObjectData: ObjectData & CustomObjectConfiguration\n ): boolean {\n const animator = this.getAnimator();\n if (animator) {\n animator.updateFromObjectData(\n oldObjectData.animatable || [],\n newObjectData.animatable || []\n );\n }\n return true;\n }\n\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n const animator = this.getAnimator();\n if (initialInstanceData.numberProperties) {\n for (\n let i = 0, len = initialInstanceData.numberProperties.length;\n i < len;\n ++i\n ) {\n const extraData = initialInstanceData.numberProperties[i];\n if (animator && extraData.name === 'animation') {\n animator.setAnimationIndex(extraData.value);\n }\n }\n }\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n if (initialInstanceData.opacity !== undefined) {\n this.setOpacity(initialInstanceData.opacity);\n }\n if (initialInstanceData.flippedX) {\n this.flipX(initialInstanceData.flippedX);\n }\n if (initialInstanceData.flippedY) {\n this.flipY(initialInstanceData.flippedY);\n }\n }\n\n onDeletedFromScene(parent: gdjs.RuntimeInstanceContainer): void {\n // Let subclasses do something before the object is destroyed.\n this.onDestroy(parent);\n // Let behaviors do something before the object is destroyed.\n super.onDeletedFromScene(parent);\n // Destroy the children.\n this._instanceContainer.onDestroyFromScene(parent);\n }\n\n update(parent: gdjs.RuntimeInstanceContainer): void {\n this._instanceContainer._updateObjectsPreEvents();\n\n this.doStepPreEvents(this._instanceContainer);\n\n const profiler = this.getRuntimeScene().getProfiler();\n if (profiler) {\n profiler.begin(this.type);\n }\n // This is a bit like the \"scene\" events for custom objects.\n this.doStepPostEvents(this._instanceContainer);\n if (profiler) {\n profiler.end(this.type);\n }\n\n this._instanceContainer._updateObjectsPostEvents();\n }\n\n /**\n * This method is called when the preview is being hot-reloaded.\n */\n onHotReloading(parent: gdjs.RuntimeInstanceContainer) {}\n\n // This is only to handle trigger once.\n doStepPreEvents(parent: gdjs.RuntimeInstanceContainer) {}\n\n /**\n * This method is called each tick after events are done.\n * @param parent The instanceContainer owning the object\n */\n doStepPostEvents(parent: gdjs.RuntimeInstanceContainer) {}\n\n /**\n * This method is called when the object is being removed from its parent\n * container and is about to be destroyed/reused later.\n */\n onDestroy(parent: gdjs.RuntimeInstanceContainer) {}\n\n updatePreRender(parent: gdjs.RuntimeInstanceContainer): void {\n this._instanceContainer._updateObjectsPreRender();\n this.getRenderer().ensureUpToDate();\n }\n\n getRenderer():\n | gdjs.CustomRuntimeObject2DRenderer\n | gdjs.CustomRuntimeObject3DRenderer {\n return this._renderer;\n }\n\n getChildrenContainer(): gdjs.RuntimeInstanceContainer {\n return this._instanceContainer;\n }\n\n onChildrenLocationChanged() {\n this._isUntransformedHitBoxesDirty = true;\n this.invalidateHitboxes();\n this.getRenderer().update();\n }\n\n updateHitBoxes(): void {\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n\n // Update the current hitboxes with the frame custom hit boxes\n // and apply transformations.\n const localTransformation = this.getLocalTransformation();\n for (let i = 0; i < this._untransformedHitBoxes.length; ++i) {\n if (i >= this.hitBoxes.length) {\n this.hitBoxes.push(new gdjs.Polygon());\n }\n for (\n let j = 0;\n j < this._untransformedHitBoxes[i].vertices.length;\n ++j\n ) {\n if (j >= this.hitBoxes[i].vertices.length) {\n this.hitBoxes[i].vertices.push([0, 0]);\n }\n localTransformation.transform(\n this._untransformedHitBoxes[i].vertices[j],\n this.hitBoxes[i].vertices[j]\n );\n }\n this.hitBoxes[i].vertices.length = this._untransformedHitBoxes[\n i\n ].vertices.length;\n }\n }\n\n /**\n * Merge the hitboxes of the children.\n */\n _updateUntransformedHitBoxes() {\n this._isUntransformedHitBoxesDirty = false;\n\n this._untransformedHitBoxes.length = 0;\n let minX = Number.MAX_VALUE;\n let minY = Number.MAX_VALUE;\n let maxX = -Number.MAX_VALUE;\n let maxY = -Number.MAX_VALUE;\n for (const childInstance of this._instanceContainer.getAdhocListOfAllInstances()) {\n if (!childInstance.isIncludedInParentCollisionMask()) {\n continue;\n }\n Array.prototype.push.apply(\n this._untransformedHitBoxes,\n childInstance.getHitBoxes()\n );\n const childAABB = childInstance.getAABB();\n minX = Math.min(minX, childAABB.min[0]);\n minY = Math.min(minY, childAABB.min[1]);\n maxX = Math.max(maxX, childAABB.max[0]);\n maxY = Math.max(maxY, childAABB.max[1]);\n }\n if (minX === Number.MAX_VALUE) {\n // The unscaled size can't be 0 because setWidth and setHeight wouldn't\n // have any effect.\n minX = 0;\n minY = 0;\n maxX = 1;\n maxY = 1;\n }\n this._unrotatedAABB.min[0] = minX;\n this._unrotatedAABB.min[1] = minY;\n this._unrotatedAABB.max[0] = maxX;\n this._unrotatedAABB.max[1] = maxY;\n\n while (this.hitBoxes.length < this._untransformedHitBoxes.length) {\n this.hitBoxes.push(new gdjs.Polygon());\n }\n this.hitBoxes.length = this._untransformedHitBoxes.length;\n }\n\n // Position:\n /**\n * Return an array containing the coordinates of the point passed as parameter\n * in parent coordinate coordinates (as opposed to the object local coordinates).\n *\n * All transformations (flipping, scale, rotation) are supported.\n *\n * @param x The X position of the point, in object coordinates.\n * @param y The Y position of the point, in object coordinates.\n * @param result Array that will be updated with the result\n * (x and y position of the point in parent coordinates).\n */\n applyObjectTransformation(x: float, y: float, destination: FloatPoint) {\n const source = destination;\n source[0] = x;\n source[1] = y;\n this.getLocalTransformation().transform(source, destination);\n }\n\n /**\n * Return the affine transformation that represents\n * flipping, scale, rotation and translation of the object.\n * @returns the affine transformation.\n */\n getLocalTransformation(): gdjs.AffineTransformation {\n if (this._isLocalTransformationDirty) {\n this._updateLocalTransformation();\n }\n return this._localTransformation;\n }\n\n getLocalInverseTransformation(): gdjs.AffineTransformation {\n if (this._isLocalTransformationDirty) {\n this._updateLocalTransformation();\n }\n return this._localInverseTransformation;\n }\n\n _updateLocalTransformation() {\n const absScaleX = Math.abs(this._scaleX);\n const absScaleY = Math.abs(this._scaleY);\n const centerX = this.getUnscaledCenterX() * absScaleX;\n const centerY = this.getUnscaledCenterY() * absScaleY;\n const angleInRadians = (this.angle * Math.PI) / 180;\n\n this._localTransformation.setToTranslation(this.x, this.y);\n this._localTransformation.rotateAround(angleInRadians, centerX, centerY);\n if (this._flippedX) {\n this._localTransformation.flipX(centerX);\n }\n if (this._flippedY) {\n this._localTransformation.flipY(centerY);\n }\n this._localTransformation.scale(absScaleX, absScaleY);\n\n this._localInverseTransformation.copyFrom(this._localTransformation);\n this._localInverseTransformation.invert();\n this._isLocalTransformationDirty = false;\n }\n\n /**\n * Return an array containing the coordinates of the point passed as parameter\n * in object local coordinates (as opposed to the parent coordinate coordinates).\n *\n * All transformations (flipping, scale, rotation) are supported.\n *\n * @param x The X position of the point, in parent coordinates.\n * @param y The Y position of the point, in parent coordinates.\n * @param result Array that will be updated with the result\n * (x and y position of the point in object coordinates).\n */\n applyObjectInverseTransformation(\n x: float,\n y: float,\n destination: FloatPoint\n ) {\n const source = destination;\n source[0] = x;\n source[1] = y;\n this.getLocalInverseTransformation().transform(source, destination);\n }\n\n getDrawableX(): float {\n let minX = 0;\n if (this._innerArea) {\n minX = this._innerArea.min[0];\n } else {\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n minX = this._unrotatedAABB.min[0];\n }\n const absScaleX = this.getScaleX();\n if (!this._flippedX) {\n return this.x + minX * absScaleX;\n } else {\n return (\n this.x +\n (-minX - this.getUnscaledWidth() + 2 * this.getUnscaledCenterX()) *\n absScaleX\n );\n }\n }\n\n getDrawableY(): float {\n let minY = 0;\n if (this._innerArea) {\n minY = this._innerArea.min[1];\n } else {\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n minY = this._unrotatedAABB.min[1];\n }\n const absScaleY = this.getScaleY();\n if (!this._flippedY) {\n return this.y + minY * absScaleY;\n } else {\n return (\n this.y +\n (-minY - this.getUnscaledHeight() + 2 * this.getUnscaledCenterY()) *\n absScaleY\n );\n }\n }\n\n /**\n * @return the internal left bound of the object according to its children.\n */\n getInnerAreaMinX(): number {\n if (this._innerArea) {\n return this._innerArea.min[0];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._unrotatedAABB.min[0];\n }\n\n /**\n * @return the internal top bound of the object according to its children.\n */\n getInnerAreaMinY(): number {\n if (this._innerArea) {\n return this._innerArea.min[1];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._unrotatedAABB.min[1];\n }\n\n /**\n * @return the internal right bound of the object according to its children.\n */\n getInnerAreaMaxX(): number {\n if (this._innerArea) {\n return this._innerArea.max[0];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._unrotatedAABB.max[0];\n }\n\n /**\n * @return the internal bottom bound of the object according to its children.\n */\n getInnerAreaMaxY(): number {\n if (this._innerArea) {\n return this._innerArea.max[1];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._unrotatedAABB.max[1];\n }\n\n /**\n * @return the internal width of the object according to its children.\n */\n getUnscaledWidth(): float {\n if (this._innerArea) {\n return this._innerArea.max[0] - this._innerArea.min[0];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._unrotatedAABB.max[0] - this._unrotatedAABB.min[0];\n }\n\n /**\n * @return the internal height of the object according to its children.\n */\n getUnscaledHeight(): float {\n if (this._innerArea) {\n return this._innerArea.max[1] - this._innerArea.min[1];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._unrotatedAABB.max[1] - this._unrotatedAABB.min[1];\n }\n\n /**\n * @returns the center X from the local origin (0;0).\n */\n getUnscaledCenterX(): float {\n if (this._customCenter) {\n return this._customCenter[0];\n }\n if (this._innerArea) {\n return (this._innerArea.min[0] + this._innerArea.max[0]) / 2;\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return (this._unrotatedAABB.min[0] + this._unrotatedAABB.max[0]) / 2;\n }\n\n /**\n * @returns the center Y from the local origin (0;0).\n */\n getUnscaledCenterY(): float {\n if (this._customCenter) {\n return this._customCenter[1];\n }\n if (this._innerArea) {\n return (this._innerArea.min[1] + this._innerArea.max[1]) / 2;\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return (this._unrotatedAABB.min[1] + this._unrotatedAABB.max[1]) / 2;\n }\n\n /**\n * The center of rotation is defined relatively to the origin (the object\n * position).\n * This avoids the center to move when children push the bounds.\n *\n * When no custom center is defined, it will move\n * to stay at the center of the children bounds.\n *\n * @param x coordinate of the custom center\n * @param y coordinate of the custom center\n */\n setRotationCenter(x: float, y: float) {\n if (!this._customCenter) {\n this._customCenter = [0, 0];\n }\n this._customCenter[0] = x;\n this._customCenter[1] = y;\n\n this._isLocalTransformationDirty = true;\n this.invalidateHitboxes();\n }\n\n hasCustomRotationCenter(): boolean {\n return !!this._customCenter;\n }\n\n getCenterX(): float {\n return (\n (this.getUnscaledCenterX() - this._unrotatedAABB.min[0]) *\n this.getScaleX()\n );\n }\n\n getCenterY(): float {\n return (\n (this.getUnscaledCenterY() - this._unrotatedAABB.min[1]) *\n this.getScaleY()\n );\n }\n\n getWidth(): float {\n return this.getUnscaledWidth() * this.getScaleX();\n }\n\n getHeight(): float {\n return this.getUnscaledHeight() * this.getScaleY();\n }\n\n setWidth(newWidth: float): void {\n const unscaledWidth = this.getUnscaledWidth();\n if (unscaledWidth === 0) {\n return;\n }\n const scaleX = newWidth / unscaledWidth;\n if (this._innerArea && this._isInnerAreaFollowingParentSize) {\n this._innerArea.min[0] *= scaleX;\n this._innerArea.max[0] *= scaleX;\n } else {\n this.setScaleX(scaleX);\n }\n }\n\n setHeight(newHeight: float): void {\n const unscaledHeight = this.getUnscaledHeight();\n if (unscaledHeight === 0) {\n return;\n }\n const scaleY = newHeight / unscaledHeight;\n if (this._innerArea && this._isInnerAreaFollowingParentSize) {\n this._innerArea.min[1] *= scaleY;\n this._innerArea.max[1] *= scaleY;\n } else {\n this.setScaleY(scaleY);\n }\n }\n\n /**\n * Change the size of the object.\n *\n * @param newWidth The new width of the object, in pixels.\n * @param newHeight The new height of the object, in pixels.\n */\n setSize(newWidth: float, newHeight: float): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n }\n\n setX(x: float): void {\n if (x === this.x) {\n return;\n }\n this.x = x;\n this._isLocalTransformationDirty = true;\n this.invalidateHitboxes();\n this.getRenderer().updateX();\n }\n\n setY(y: float): void {\n if (y === this.y) {\n return;\n }\n this.y = y;\n this._isLocalTransformationDirty = true;\n this.invalidateHitboxes();\n this.getRenderer().updateY();\n }\n\n setAngle(angle: float): void {\n if (this.angle === angle) {\n return;\n }\n this.angle = angle;\n this._isLocalTransformationDirty = true;\n this.invalidateHitboxes();\n this.getRenderer().updateAngle();\n }\n\n /**\n * Change the scale on X and Y axis of the object.\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScale(newScale: float): void {\n if (this._innerArea && this._isInnerAreaFollowingParentSize) {\n // The scale is always 1;\n return;\n }\n if (newScale < 0) {\n newScale = 0;\n }\n if (\n newScale === Math.abs(this._scaleX) &&\n newScale === Math.abs(this._scaleY)\n ) {\n return;\n }\n this._scaleX = newScale * (this._flippedX ? -1 : 1);\n this._scaleY = newScale * (this._flippedY ? -1 : 1);\n this._isLocalTransformationDirty = true;\n this.invalidateHitboxes();\n this.getRenderer().update();\n }\n\n /**\n * Change the scale on X axis of the object (changing its width).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleX(newScale: float): void {\n if (this._innerArea && this._isInnerAreaFollowingParentSize) {\n // The scale is always 1;\n return;\n }\n if (newScale < 0) {\n newScale = 0;\n }\n if (newScale === Math.abs(this._scaleX)) {\n return;\n }\n this._scaleX = newScale * (this._flippedX ? -1 : 1);\n this._isLocalTransformationDirty = true;\n this.invalidateHitboxes();\n this.getRenderer().update();\n }\n\n /**\n * Change the scale on Y axis of the object (changing its height).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleY(newScale: float): void {\n if (this._innerArea && this._isInnerAreaFollowingParentSize) {\n // The scale is always 1;\n return;\n }\n if (newScale < 0) {\n newScale = 0;\n }\n if (newScale === Math.abs(this._scaleY)) {\n return;\n }\n this._scaleY = newScale * (this._flippedY ? -1 : 1);\n this.invalidateHitboxes();\n this.getRenderer().update();\n }\n\n /**\n * Get the scale of the object (or the arithmetic mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the arithmetic mean of the X and Y scale in case they are different).\n * @deprecated Use `getScale` instead.\n */\n getScaleMean(): float {\n return (Math.abs(this._scaleX) + Math.abs(this._scaleY)) / 2.0;\n }\n\n /**\n * Get the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n */\n getScale(): float {\n const scaleX = Math.abs(this._scaleX);\n const scaleY = Math.abs(this._scaleY);\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Get the scale of the object on Y axis.\n *\n * @return the scale of the object on Y axis\n */\n getScaleY(): float {\n return Math.abs(this._scaleY);\n }\n\n /**\n * Get the scale of the object on X axis.\n *\n * @return the scale of the object on X axis\n */\n getScaleX(): float {\n return Math.abs(this._scaleX);\n }\n\n // Visibility and display :\n\n setOpacity(opacity: float): void {\n if (opacity < 0) {\n opacity = 0;\n }\n if (opacity > 255) {\n opacity = 255;\n }\n this.opacity = opacity;\n this.getRenderer().updateOpacity();\n }\n\n getOpacity(): number {\n return this.opacity;\n }\n\n /**\n * Hide (or show) the object\n * @param enable true to hide the object, false to show it again.\n */\n hide(enable: boolean): void {\n if (enable === undefined) {\n enable = true;\n }\n this.hidden = enable;\n this.getRenderer().updateVisibility();\n }\n\n flipX(enable: boolean) {\n if (enable !== this._flippedX) {\n this._scaleX *= -1;\n this._flippedX = enable;\n this.invalidateHitboxes();\n this.getRenderer().update();\n }\n }\n\n flipY(enable: boolean) {\n if (enable !== this._flippedY) {\n this._scaleY *= -1;\n this._flippedY = enable;\n this.invalidateHitboxes();\n this.getRenderer().update();\n }\n }\n\n isFlippedX(): boolean {\n return this._flippedX;\n }\n\n isFlippedY(): boolean {\n return this._flippedY;\n }\n\n /**\n * Return the sprite animator.\n *\n * It returns `null` when custom objects don't have the Animatable capability.\n */\n getAnimator(): gdjs.SpriteAnimator<any> | null {\n return null;\n }\n }\n\n // Others initialization and internal state management :\n // TODO EBO Activate and test instance recycling.\n CustomRuntimeObject.supportsReinitialization = false;\n}\n"],
5
- "mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,uBAkBxB,eACG,GAAK,aAKS,C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Gd,YAAsB,CACpB,MAAO,MAAK,UAQd,aAA+C,CAC7C,MAAO,OApzBJ,EAAe,sBA0zBtB,EAAoB,yBAA2B,KA70BvC",
4
+ "sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-2022 Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n const logger = new gdjs.Logger('CustomRuntimeObject');\n\n export type ObjectConfiguration = {\n content: any;\n };\n\n export type CustomObjectConfiguration = ObjectConfiguration & {\n animatable?: SpriteAnimationData[];\n childrenContent: { [objectName: string]: ObjectConfiguration & any };\n };\n\n /**\n * An object that contains other object.\n *\n * This is the base class for objects generated from EventsBasedObject.\n *\n * @see gdjs.CustomRuntimeObjectInstanceContainer\n */\n export abstract class CustomRuntimeObject\n extends gdjs.RuntimeObject\n implements\n gdjs.Resizable,\n gdjs.Scalable,\n gdjs.Flippable,\n gdjs.OpacityHandler\n {\n _renderer:\n | gdjs.CustomRuntimeObject2DRenderer\n | gdjs.CustomRuntimeObject3DRenderer;\n /** It contains the children of this object. */\n _instanceContainer: gdjs.CustomRuntimeObjectInstanceContainer;\n _isUntransformedHitBoxesDirty: boolean = true;\n /** It contains shallow copies of the children hitboxes */\n private _untransformedHitBoxes: gdjs.Polygon[] = [];\n /** The dimension of this object is calculated from its children AABBs. */\n private _unrotatedAABB: AABB = { min: [0, 0], max: [0, 0] };\n /**\n * The bounds of the object content before any transformation.\n * @see gdjs.CustomRuntimeObjectInstanceContainer._initialInnerArea\n **/\n protected _innerArea: {\n min: [float, float, float];\n max: [float, float, float];\n } | null = null;\n /**\n * When the parent dimensions change:\n * - if `false`, the object is stretch proportionally while children local\n * positions stay the same ({@link gdjs.CustomRuntimeObject._innerArea} don't change).\n * - if `true`, the children local positions need to be adapted by events\n * to follow their parent size.\n */\n protected _isInnerAreaFollowingParentSize = false;\n private _scaleX: float = 1;\n private _scaleY: float = 1;\n private _flippedX: boolean = false;\n private _flippedY: boolean = false;\n private opacity: float = 255;\n private _customCenter: FloatPoint | null = null;\n private _localTransformation: gdjs.AffineTransformation =\n new gdjs.AffineTransformation();\n private _localInverseTransformation: gdjs.AffineTransformation =\n new gdjs.AffineTransformation();\n private _isLocalTransformationDirty: boolean = true;\n _type: string;\n\n /**\n * @param parent The container the object belongs to\n * @param objectData The object data used to initialize the object\n */\n constructor(\n parent: gdjs.RuntimeInstanceContainer,\n objectData: ObjectData & CustomObjectConfiguration\n ) {\n super(parent, objectData);\n this._type = objectData.type;\n this._instanceContainer = new gdjs.CustomRuntimeObjectInstanceContainer(\n parent,\n this\n );\n this._renderer = this._createRender();\n\n this._initializeFromObjectData(objectData);\n\n // The generated code calls onCreated at the constructor end\n // and onCreated calls its super implementation at its end.\n }\n\n private _initializeFromObjectData(\n objectData: ObjectData & CustomObjectConfiguration\n ) {\n const eventsBasedObjectData = this._runtimeScene\n .getGame()\n .getEventsBasedObjectData(objectData.type);\n if (!eventsBasedObjectData) {\n logger.error(\n `A CustomRuntimeObject was initialized (or re-initialized) from object data referring to an non existing events based object data with type \"${objectData.type}\".`\n );\n return;\n }\n this._isInnerAreaFollowingParentSize =\n eventsBasedObjectData.isInnerAreaFollowingParentSize;\n if (eventsBasedObjectData.instances.length > 0) {\n if (!this._innerArea) {\n this._innerArea = {\n min: [0, 0, 0],\n max: [0, 0, 0],\n };\n }\n this._innerArea.min[0] = eventsBasedObjectData.areaMinX;\n this._innerArea.min[1] = eventsBasedObjectData.areaMinY;\n this._innerArea.min[2] = eventsBasedObjectData.areaMinZ;\n this._innerArea.max[0] = eventsBasedObjectData.areaMaxX;\n this._innerArea.max[1] = eventsBasedObjectData.areaMaxY;\n this._innerArea.max[2] = eventsBasedObjectData.areaMaxZ;\n }\n this._instanceContainer.loadFrom(objectData, eventsBasedObjectData);\n }\n\n protected abstract _createRender():\n | gdjs.CustomRuntimeObject2DRenderer\n | gdjs.CustomRuntimeObject3DRenderer;\n protected abstract _reinitializeRenderer(): void;\n\n override reinitialize(objectData: ObjectData & CustomObjectConfiguration) {\n super.reinitialize(objectData);\n\n this._initializeFromObjectData(objectData);\n this._reinitializeRenderer();\n\n // The generated code calls the onCreated super implementation at the end.\n this.onCreated();\n }\n\n override updateFromObjectData(\n oldObjectData: ObjectData & CustomObjectConfiguration,\n newObjectData: ObjectData & CustomObjectConfiguration\n ): boolean {\n const animator = this.getAnimator();\n if (animator) {\n animator.updateFromObjectData(\n oldObjectData.animatable || [],\n newObjectData.animatable || []\n );\n }\n return true;\n }\n\n override extraInitializationFromInitialInstance(\n initialInstanceData: InstanceData\n ) {\n const animator = this.getAnimator();\n if (initialInstanceData.numberProperties) {\n for (\n let i = 0, len = initialInstanceData.numberProperties.length;\n i < len;\n ++i\n ) {\n const extraData = initialInstanceData.numberProperties[i];\n if (animator && extraData.name === 'animation') {\n animator.setAnimationIndex(extraData.value);\n }\n }\n }\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n if (initialInstanceData.opacity !== undefined) {\n this.setOpacity(initialInstanceData.opacity);\n }\n if (initialInstanceData.flippedX) {\n this.flipX(initialInstanceData.flippedX);\n }\n if (initialInstanceData.flippedY) {\n this.flipY(initialInstanceData.flippedY);\n }\n }\n\n override onDeletedFromScene(parent: gdjs.RuntimeInstanceContainer): void {\n // Let subclasses do something before the object is destroyed.\n this.onDestroy(parent);\n // Let behaviors do something before the object is destroyed.\n super.onDeletedFromScene(parent);\n // Destroy the children.\n this._instanceContainer.onDestroyFromScene(parent);\n }\n\n override update(parent: gdjs.RuntimeInstanceContainer): void {\n this._instanceContainer._updateObjectsPreEvents();\n\n this.doStepPreEvents(this._instanceContainer);\n\n const profiler = this.getRuntimeScene().getProfiler();\n if (profiler) {\n profiler.begin(this.type);\n }\n // This is a bit like the \"scene\" events for custom objects.\n this.doStepPostEvents(this._instanceContainer);\n if (profiler) {\n profiler.end(this.type);\n }\n\n this._instanceContainer._updateObjectsPostEvents();\n }\n\n /**\n * This method is called when the preview is being hot-reloaded.\n */\n onHotReloading(parent: gdjs.RuntimeInstanceContainer) {}\n\n // This is only to handle trigger once.\n doStepPreEvents(parent: gdjs.RuntimeInstanceContainer) {}\n\n /**\n * This method is called each tick after events are done.\n * @param parent The instanceContainer owning the object\n */\n doStepPostEvents(parent: gdjs.RuntimeInstanceContainer) {}\n\n /**\n * This method is called when the object is being removed from its parent\n * container and is about to be destroyed/reused later.\n */\n onDestroy(parent: gdjs.RuntimeInstanceContainer) {}\n\n override updatePreRender(parent: gdjs.RuntimeInstanceContainer): void {\n this._instanceContainer._updateObjectsPreRender();\n this.getRenderer().ensureUpToDate();\n }\n\n getRenderer():\n | gdjs.CustomRuntimeObject2DRenderer\n | gdjs.CustomRuntimeObject3DRenderer {\n return this._renderer;\n }\n\n getChildrenContainer(): gdjs.RuntimeInstanceContainer {\n return this._instanceContainer;\n }\n\n onChildrenLocationChanged() {\n this._isUntransformedHitBoxesDirty = true;\n this.invalidateHitboxes();\n this.getRenderer().update();\n }\n\n override updateHitBoxes(): void {\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n\n // Update the current hitboxes with the frame custom hit boxes\n // and apply transformations.\n const localTransformation = this.getLocalTransformation();\n for (let i = 0; i < this._untransformedHitBoxes.length; ++i) {\n if (i >= this.hitBoxes.length) {\n this.hitBoxes.push(new gdjs.Polygon());\n }\n for (\n let j = 0;\n j < this._untransformedHitBoxes[i].vertices.length;\n ++j\n ) {\n if (j >= this.hitBoxes[i].vertices.length) {\n this.hitBoxes[i].vertices.push([0, 0]);\n }\n localTransformation.transform(\n this._untransformedHitBoxes[i].vertices[j],\n this.hitBoxes[i].vertices[j]\n );\n }\n this.hitBoxes[i].vertices.length =\n this._untransformedHitBoxes[i].vertices.length;\n }\n }\n\n /**\n * Merge the hitboxes of the children.\n */\n _updateUntransformedHitBoxes() {\n this._isUntransformedHitBoxesDirty = false;\n\n this._untransformedHitBoxes.length = 0;\n let minX = Number.MAX_VALUE;\n let minY = Number.MAX_VALUE;\n let maxX = -Number.MAX_VALUE;\n let maxY = -Number.MAX_VALUE;\n for (const childInstance of this._instanceContainer.getAdhocListOfAllInstances()) {\n if (!childInstance.isIncludedInParentCollisionMask()) {\n continue;\n }\n Array.prototype.push.apply(\n this._untransformedHitBoxes,\n childInstance.getHitBoxes()\n );\n const childAABB = childInstance.getAABB();\n minX = Math.min(minX, childAABB.min[0]);\n minY = Math.min(minY, childAABB.min[1]);\n maxX = Math.max(maxX, childAABB.max[0]);\n maxY = Math.max(maxY, childAABB.max[1]);\n }\n if (minX === Number.MAX_VALUE) {\n // The unscaled size can't be 0 because setWidth and setHeight wouldn't\n // have any effect.\n minX = 0;\n minY = 0;\n maxX = 1;\n maxY = 1;\n }\n this._unrotatedAABB.min[0] = minX;\n this._unrotatedAABB.min[1] = minY;\n this._unrotatedAABB.max[0] = maxX;\n this._unrotatedAABB.max[1] = maxY;\n\n while (this.hitBoxes.length < this._untransformedHitBoxes.length) {\n this.hitBoxes.push(new gdjs.Polygon());\n }\n this.hitBoxes.length = this._untransformedHitBoxes.length;\n }\n\n // Position:\n /**\n * Return an array containing the coordinates of the point passed as parameter\n * in parent coordinate coordinates (as opposed to the object local coordinates).\n *\n * All transformations (flipping, scale, rotation) are supported.\n *\n * @param x The X position of the point, in object coordinates.\n * @param y The Y position of the point, in object coordinates.\n * @param destination Array that will be updated with the result\n * (x and y position of the point in parent coordinates).\n */\n applyObjectTransformation(x: float, y: float, destination: FloatPoint) {\n const source = destination;\n source[0] = x;\n source[1] = y;\n this.getLocalTransformation().transform(source, destination);\n }\n\n /**\n * Return the affine transformation that represents\n * flipping, scale, rotation and translation of the object.\n * @returns the affine transformation.\n */\n getLocalTransformation(): gdjs.AffineTransformation {\n if (this._isLocalTransformationDirty) {\n this._updateLocalTransformation();\n }\n return this._localTransformation;\n }\n\n getLocalInverseTransformation(): gdjs.AffineTransformation {\n if (this._isLocalTransformationDirty) {\n this._updateLocalTransformation();\n }\n return this._localInverseTransformation;\n }\n\n _updateLocalTransformation() {\n const absScaleX = Math.abs(this._scaleX);\n const absScaleY = Math.abs(this._scaleY);\n const centerX = this.getUnscaledCenterX() * absScaleX;\n const centerY = this.getUnscaledCenterY() * absScaleY;\n const angleInRadians = (this.angle * Math.PI) / 180;\n\n this._localTransformation.setToTranslation(this.x, this.y);\n this._localTransformation.rotateAround(angleInRadians, centerX, centerY);\n if (this._flippedX) {\n this._localTransformation.flipX(centerX);\n }\n if (this._flippedY) {\n this._localTransformation.flipY(centerY);\n }\n this._localTransformation.scale(absScaleX, absScaleY);\n\n this._localInverseTransformation.copyFrom(this._localTransformation);\n this._localInverseTransformation.invert();\n this._isLocalTransformationDirty = false;\n }\n\n /**\n * Return an array containing the coordinates of the point passed as parameter\n * in object local coordinates (as opposed to the parent coordinate coordinates).\n *\n * All transformations (flipping, scale, rotation) are supported.\n *\n * @param x The X position of the point, in parent coordinates.\n * @param y The Y position of the point, in parent coordinates.\n * @param destination Array that will be updated with the result\n * (x and y position of the point in object coordinates).\n */\n applyObjectInverseTransformation(\n x: float,\n y: float,\n destination: FloatPoint\n ) {\n const source = destination;\n source[0] = x;\n source[1] = y;\n this.getLocalInverseTransformation().transform(source, destination);\n }\n\n override getDrawableX(): float {\n let minX = 0;\n if (this._innerArea) {\n minX = this._innerArea.min[0];\n } else {\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n minX = this._unrotatedAABB.min[0];\n }\n const absScaleX = this.getScaleX();\n if (!this._flippedX) {\n return this.x + minX * absScaleX;\n } else {\n return (\n this.x +\n (-minX - this.getUnscaledWidth() + 2 * this.getUnscaledCenterX()) *\n absScaleX\n );\n }\n }\n\n override getDrawableY(): float {\n let minY = 0;\n if (this._innerArea) {\n minY = this._innerArea.min[1];\n } else {\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n minY = this._unrotatedAABB.min[1];\n }\n const absScaleY = this.getScaleY();\n if (!this._flippedY) {\n return this.y + minY * absScaleY;\n } else {\n return (\n this.y +\n (-minY - this.getUnscaledHeight() + 2 * this.getUnscaledCenterY()) *\n absScaleY\n );\n }\n }\n\n /**\n * @return the internal left bound of the object according to its children.\n */\n getInnerAreaMinX(): number {\n if (this._innerArea) {\n return this._innerArea.min[0];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._unrotatedAABB.min[0];\n }\n\n /**\n * @return the internal top bound of the object according to its children.\n */\n getInnerAreaMinY(): number {\n if (this._innerArea) {\n return this._innerArea.min[1];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._unrotatedAABB.min[1];\n }\n\n /**\n * @return the internal right bound of the object according to its children.\n */\n getInnerAreaMaxX(): number {\n if (this._innerArea) {\n return this._innerArea.max[0];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._unrotatedAABB.max[0];\n }\n\n /**\n * @return the internal bottom bound of the object according to its children.\n */\n getInnerAreaMaxY(): number {\n if (this._innerArea) {\n return this._innerArea.max[1];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._unrotatedAABB.max[1];\n }\n\n /**\n * @return the internal width of the object according to its children.\n */\n getUnscaledWidth(): float {\n if (this._innerArea) {\n return this._innerArea.max[0] - this._innerArea.min[0];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._unrotatedAABB.max[0] - this._unrotatedAABB.min[0];\n }\n\n /**\n * @return the internal height of the object according to its children.\n */\n getUnscaledHeight(): float {\n if (this._innerArea) {\n return this._innerArea.max[1] - this._innerArea.min[1];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._unrotatedAABB.max[1] - this._unrotatedAABB.min[1];\n }\n\n /**\n * @returns the center X from the local origin (0;0).\n */\n getUnscaledCenterX(): float {\n if (this._customCenter) {\n return this._customCenter[0];\n }\n if (this._innerArea) {\n return (this._innerArea.min[0] + this._innerArea.max[0]) / 2;\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return (this._unrotatedAABB.min[0] + this._unrotatedAABB.max[0]) / 2;\n }\n\n /**\n * @returns the center Y from the local origin (0;0).\n */\n getUnscaledCenterY(): float {\n if (this._customCenter) {\n return this._customCenter[1];\n }\n if (this._innerArea) {\n return (this._innerArea.min[1] + this._innerArea.max[1]) / 2;\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return (this._unrotatedAABB.min[1] + this._unrotatedAABB.max[1]) / 2;\n }\n\n /**\n * The center of rotation is defined relatively to the origin (the object\n * position).\n * This avoids the center to move when children push the bounds.\n *\n * When no custom center is defined, it will move\n * to stay at the center of the children bounds.\n *\n * @param x coordinate of the custom center\n * @param y coordinate of the custom center\n */\n setRotationCenter(x: float, y: float) {\n if (!this._customCenter) {\n this._customCenter = [0, 0];\n }\n this._customCenter[0] = x;\n this._customCenter[1] = y;\n\n this._isLocalTransformationDirty = true;\n this.invalidateHitboxes();\n }\n\n hasCustomRotationCenter(): boolean {\n return !!this._customCenter;\n }\n\n override getCenterX(): float {\n return (\n (this.getUnscaledCenterX() - this._unrotatedAABB.min[0]) *\n this.getScaleX()\n );\n }\n\n override getCenterY(): float {\n return (\n (this.getUnscaledCenterY() - this._unrotatedAABB.min[1]) *\n this.getScaleY()\n );\n }\n\n override getWidth(): float {\n return this.getUnscaledWidth() * this.getScaleX();\n }\n\n override getHeight(): float {\n return this.getUnscaledHeight() * this.getScaleY();\n }\n\n override setWidth(newWidth: float): void {\n const unscaledWidth = this.getUnscaledWidth();\n if (unscaledWidth === 0) {\n return;\n }\n const scaleX = newWidth / unscaledWidth;\n if (this._innerArea && this._isInnerAreaFollowingParentSize) {\n this._innerArea.min[0] *= scaleX;\n this._innerArea.max[0] *= scaleX;\n } else {\n this.setScaleX(scaleX);\n }\n }\n\n override setHeight(newHeight: float): void {\n const unscaledHeight = this.getUnscaledHeight();\n if (unscaledHeight === 0) {\n return;\n }\n const scaleY = newHeight / unscaledHeight;\n if (this._innerArea && this._isInnerAreaFollowingParentSize) {\n this._innerArea.min[1] *= scaleY;\n this._innerArea.max[1] *= scaleY;\n } else {\n this.setScaleY(scaleY);\n }\n }\n\n /**\n * Change the size of the object.\n *\n * @param newWidth The new width of the object, in pixels.\n * @param newHeight The new height of the object, in pixels.\n */\n setSize(newWidth: float, newHeight: float): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n }\n\n override setX(x: float): void {\n if (x === this.x) {\n return;\n }\n this.x = x;\n this._isLocalTransformationDirty = true;\n this.invalidateHitboxes();\n this.getRenderer().updateX();\n }\n\n override setY(y: float): void {\n if (y === this.y) {\n return;\n }\n this.y = y;\n this._isLocalTransformationDirty = true;\n this.invalidateHitboxes();\n this.getRenderer().updateY();\n }\n\n override setAngle(angle: float): void {\n if (this.angle === angle) {\n return;\n }\n this.angle = angle;\n this._isLocalTransformationDirty = true;\n this.invalidateHitboxes();\n this.getRenderer().updateAngle();\n }\n\n /**\n * Change the scale on X and Y axis of the object.\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScale(newScale: float): void {\n if (this._innerArea && this._isInnerAreaFollowingParentSize) {\n // The scale is always 1;\n return;\n }\n if (newScale < 0) {\n newScale = 0;\n }\n if (\n newScale === Math.abs(this._scaleX) &&\n newScale === Math.abs(this._scaleY)\n ) {\n return;\n }\n this._scaleX = newScale * (this._flippedX ? -1 : 1);\n this._scaleY = newScale * (this._flippedY ? -1 : 1);\n this._isLocalTransformationDirty = true;\n this.invalidateHitboxes();\n this.getRenderer().update();\n }\n\n /**\n * Change the scale on X axis of the object (changing its width).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleX(newScale: float): void {\n if (this._innerArea && this._isInnerAreaFollowingParentSize) {\n // The scale is always 1;\n return;\n }\n if (newScale < 0) {\n newScale = 0;\n }\n if (newScale === Math.abs(this._scaleX)) {\n return;\n }\n this._scaleX = newScale * (this._flippedX ? -1 : 1);\n this._isLocalTransformationDirty = true;\n this.invalidateHitboxes();\n this.getRenderer().update();\n }\n\n /**\n * Change the scale on Y axis of the object (changing its height).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleY(newScale: float): void {\n if (this._innerArea && this._isInnerAreaFollowingParentSize) {\n // The scale is always 1;\n return;\n }\n if (newScale < 0) {\n newScale = 0;\n }\n if (newScale === Math.abs(this._scaleY)) {\n return;\n }\n this._scaleY = newScale * (this._flippedY ? -1 : 1);\n this.invalidateHitboxes();\n this.getRenderer().update();\n }\n\n /**\n * Get the scale of the object (or the arithmetic mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the arithmetic mean of the X and Y scale in case they are different).\n * @deprecated Use `getScale` instead.\n */\n getScaleMean(): float {\n return (Math.abs(this._scaleX) + Math.abs(this._scaleY)) / 2.0;\n }\n\n /**\n * Get the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n *\n * @return the scale of the object (or the geometric mean of the X and Y scale in case they are different).\n */\n getScale(): float {\n const scaleX = Math.abs(this._scaleX);\n const scaleY = Math.abs(this._scaleY);\n return scaleX === scaleY ? scaleX : Math.sqrt(scaleX * scaleY);\n }\n\n /**\n * Get the scale of the object on Y axis.\n *\n * @return the scale of the object on Y axis\n */\n getScaleY(): float {\n return Math.abs(this._scaleY);\n }\n\n /**\n * Get the scale of the object on X axis.\n *\n * @return the scale of the object on X axis\n */\n getScaleX(): float {\n return Math.abs(this._scaleX);\n }\n\n // Visibility and display :\n\n setOpacity(opacity: float): void {\n if (opacity < 0) {\n opacity = 0;\n }\n if (opacity > 255) {\n opacity = 255;\n }\n this.opacity = opacity;\n this.getRenderer().updateOpacity();\n }\n\n getOpacity(): number {\n return this.opacity;\n }\n\n override hide(enable: boolean): void {\n if (enable === undefined) {\n enable = true;\n }\n this.hidden = enable;\n this.getRenderer().updateVisibility();\n }\n\n flipX(enable: boolean) {\n if (enable !== this._flippedX) {\n this._scaleX *= -1;\n this._flippedX = enable;\n this.invalidateHitboxes();\n this.getRenderer().update();\n }\n }\n\n flipY(enable: boolean) {\n if (enable !== this._flippedY) {\n this._scaleY *= -1;\n this._flippedY = enable;\n this.invalidateHitboxes();\n this.getRenderer().update();\n }\n }\n\n isFlippedX(): boolean {\n return this._flippedX;\n }\n\n isFlippedY(): boolean {\n return this._flippedY;\n }\n\n /**\n * Return the sprite animator.\n *\n * It returns `null` when custom objects don't have the Animatable capability.\n */\n getAnimator(): gdjs.SpriteAnimator<any> | null {\n return null;\n }\n }\n\n // Others initialization and internal state management :\n // TODO EBO Activate and test instance recycling.\n CustomRuntimeObject.supportsReinitialization = false;\n}\n"],
5
+ "mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CACE,KAAM,GAAS,GAAI,GAAK,OAAO,uBAkBxB,eACG,GAAK,aAMf,CA4CE,YACE,EACA,EACA,CACA,MAAM,EAAQ,GA1ChB,mCAAyC,GAEjC,4BAAyC,GAEzC,oBAAuB,CAAE,IAAK,CAAC,EAAG,GAAI,IAAK,CAAC,EAAG,IAK7C,gBAGC,KAQD,qCAAkC,GACpC,aAAiB,EACjB,aAAiB,EACjB,eAAqB,GACrB,eAAqB,GACrB,aAAiB,IACjB,mBAAmC,KACnC,0BACN,GAAI,GAAK,qBACH,iCACN,GAAI,GAAK,qBACH,iCAAuC,GAY7C,KAAK,MAAQ,EAAW,KACxB,KAAK,mBAAqB,GAAI,GAAK,qCACjC,EACA,MAEF,KAAK,UAAY,KAAK,gBAEtB,KAAK,0BAA0B,GAMzB,0BACN,EACA,CACA,KAAM,GAAwB,KAAK,cAChC,UACA,yBAAyB,EAAW,MACvC,GAAI,CAAC,EAAuB,CAC1B,EAAO,MACL,+IAA+I,EAAW,UAE5J,OAEF,KAAK,gCACH,EAAsB,+BACpB,EAAsB,UAAU,OAAS,GACtC,MAAK,YACR,MAAK,WAAa,CAChB,IAAK,CAAC,EAAG,EAAG,GACZ,IAAK,CAAC,EAAG,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,SAQvB,WAAmB,CACjB,MAAO,MAAK,IAAI,KAAK,SAKvB,WAAW,EAAsB,CAC/B,AAAI,EAAU,GACZ,GAAU,GAER,EAAU,KACZ,GAAU,KAEZ,KAAK,QAAU,EACf,KAAK,cAAc,gBAGrB,YAAqB,CACnB,MAAO,MAAK,QAGL,KAAK,EAAuB,CACnC,AAAI,IAAW,QACb,GAAS,IAEX,KAAK,OAAS,EACd,KAAK,cAAc,mBAGrB,MAAM,EAAiB,CACrB,AAAI,IAAW,KAAK,WAClB,MAAK,SAAW,GAChB,KAAK,UAAY,EACjB,KAAK,qBACL,KAAK,cAAc,UAIvB,MAAM,EAAiB,CACrB,AAAI,IAAW,KAAK,WAClB,MAAK,SAAW,GAChB,KAAK,UAAY,EACjB,KAAK,qBACL,KAAK,cAAc,UAIvB,YAAsB,CACpB,MAAO,MAAK,UAGd,YAAsB,CACpB,MAAO,MAAK,UAQd,aAA+C,CAC7C,MAAO,OApzBJ,EAAe,sBA0zBtB,EAAoB,yBAA2B,KA70BvC",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../GDevelop/GDJS/Runtime/CustomRuntimeObject2D.ts"],
4
- "sourcesContent": ["namespace gdjs {\n /**\n * Base class for 2D custom objects.\n */\n export class CustomRuntimeObject2D extends gdjs.CustomRuntimeObject {\n constructor(\n parent: gdjs.RuntimeInstanceContainer,\n objectData: ObjectData & CustomObjectConfiguration\n ) {\n super(parent, objectData);\n this.getRenderer().reinitialize(this, parent);\n }\n\n protected _createRender(): gdjs.CustomRuntimeObject2DRenderer {\n const parent = this._runtimeScene;\n return new gdjs.CustomRuntimeObject2DRenderer(\n this,\n this._instanceContainer,\n parent\n );\n }\n\n protected _reinitializeRenderer(): void {\n this.getRenderer().reinitialize(this, this.getParent());\n }\n\n getRenderer(): gdjs.CustomRuntimeObject2DRenderer {\n return super.getRenderer() as gdjs.CustomRuntimeObject2DRenderer;\n }\n\n getRendererObject() {\n return this.getRenderer().getRendererObject();\n }\n }\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAIS,eAAoC,GAAK,mBAAoB,CAClE,YACE,EACA,EACA,CACA,MAAM,EAAQ,GACd,KAAK,cAAc,aAAa,KAAM,GAG9B,eAAoD,CAC5D,KAAM,GAAS,KAAK,cACpB,MAAO,IAAI,GAAK,8BACd,KACA,KAAK,mBACL,GAIM,uBAA8B,CACtC,KAAK,cAAc,aAAa,KAAM,KAAK,aAG7C,aAAkD,CAChD,MAAO,OAAM,cAGf,mBAAoB,CAClB,MAAO,MAAK,cAAc,qBA3BvB,EAAM,0BAJL",
4
+ "sourcesContent": ["namespace gdjs {\n /**\n * Base class for 2D custom objects.\n */\n export class CustomRuntimeObject2D extends gdjs.CustomRuntimeObject {\n constructor(\n parent: gdjs.RuntimeInstanceContainer,\n objectData: ObjectData & CustomObjectConfiguration\n ) {\n super(parent, objectData);\n this.getRenderer().reinitialize(this, parent);\n }\n\n protected override _createRender(): gdjs.CustomRuntimeObject2DRenderer {\n const parent = this._runtimeScene;\n return new gdjs.CustomRuntimeObject2DRenderer(\n this,\n this._instanceContainer,\n parent\n );\n }\n\n protected override _reinitializeRenderer(): void {\n this.getRenderer().reinitialize(this, this.getParent());\n }\n\n override getRenderer(): gdjs.CustomRuntimeObject2DRenderer {\n return super.getRenderer() as gdjs.CustomRuntimeObject2DRenderer;\n }\n\n override getRendererObject() {\n return this.getRenderer().getRendererObject();\n }\n }\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAIS,eAAoC,GAAK,mBAAoB,CAClE,YACE,EACA,EACA,CACA,MAAM,EAAQ,GACd,KAAK,cAAc,aAAa,KAAM,GAGrB,eAAoD,CACrE,KAAM,GAAS,KAAK,cACpB,MAAO,IAAI,GAAK,8BACd,KACA,KAAK,mBACL,GAIe,uBAA8B,CAC/C,KAAK,cAAc,aAAa,KAAM,KAAK,aAGpC,aAAkD,CACzD,MAAO,OAAM,cAGN,mBAAoB,CAC3B,MAAO,MAAK,cAAc,qBA3BvB,EAAM,0BAJL",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/3D/A_RuntimeObject3D.ts"],
4
- "sourcesContent": ["namespace gdjs {\n export interface Object3DDataContent {\n width: float;\n height: float;\n depth: float;\n }\n /** Base parameters for {@link gdjs.RuntimeObject3D} */\n export interface Object3DData extends ObjectData {\n /** The base parameters of the RuntimeObject3D */\n content: Object3DDataContent;\n }\n\n const getValidDimensionValue = (value: float | undefined) =>\n value === undefined ? 100 : value <= 0 ? 1 : value;\n\n type Object3DNetworkSyncDataType = {\n // z is position on the Z axis, different from zo, which is Z order\n z: number;\n w: number;\n h: number;\n d: number;\n rx: number;\n ry: number;\n // no need for rz, as it is the angle from gdjs.RuntimeObject\n flipX: boolean;\n flipY: boolean;\n flipZ: boolean;\n };\n\n export type Object3DNetworkSyncData = ObjectNetworkSyncData &\n Object3DNetworkSyncDataType;\n\n /**\n * Base class for 3D objects.\n */\n export abstract class RuntimeObject3D\n extends gdjs.RuntimeObject\n implements\n gdjs.Resizable,\n gdjs.Scalable,\n gdjs.Flippable,\n gdjs.Base3DHandler {\n /**\n * Position on the Z axis.\n */\n private _z: float = 0;\n /**\n * `_width` takes this value when the scale equals 1.\n *\n * It can't be 0.\n */\n private _originalWidth: float;\n /**\n * `_height` takes this value when the scale equals 1.\n *\n * It can't be 0.\n */\n private _originalHeight: float;\n /**\n * `depth` takes this value when the scale equals 1.\n *\n * It can't be 0.\n */\n private _originalDepth: float;\n private _width: float;\n private _height: float;\n private _depth: float;\n private _flippedX: boolean = false;\n private _flippedY: boolean = false;\n private _flippedZ: boolean = false;\n /**\n * Euler angle with the `ZYX` order.\n *\n * Note that `_rotationZ` is `angle` from `gdjs.RuntimeObject`.\n */\n private _rotationX: float = 0;\n /**\n * Euler angle with the `ZYX` order.\n *\n * Note that `_rotationZ` is `angle` from `gdjs.RuntimeObject`.\n */\n private _rotationY: float = 0;\n private static _temporaryVector = new THREE.Vector3();\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n objectData: Object3DData\n ) {\n super(instanceContainer, objectData);\n // TODO Should 0 be replaced by 0.01 instead of using the default value?\n this._width = this._originalWidth = getValidDimensionValue(\n objectData.content.width\n );\n this._height = this._originalHeight = getValidDimensionValue(\n objectData.content.height\n );\n this._depth = this._originalDepth = getValidDimensionValue(\n objectData.content.depth\n );\n }\n\n abstract getRenderer(): gdjs.RuntimeObject3DRenderer;\n\n getRendererObject() {\n return null;\n }\n\n get3DRendererObject() {\n return this.getRenderer().get3DRendererObject();\n }\n\n updateFromObjectData(\n oldObjectData: Object3DData,\n newObjectData: Object3DData\n ): boolean {\n // There is no need to check if they changed because events can't modify them.\n this._setOriginalWidth(\n getValidDimensionValue(newObjectData.content.width)\n );\n this._setOriginalHeight(\n getValidDimensionValue(newObjectData.content.height)\n );\n this._setOriginalDepth(\n getValidDimensionValue(newObjectData.content.depth)\n );\n return true;\n }\n\n getNetworkSyncData(): Object3DNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n z: this.getZ(),\n w: this.getWidth(),\n h: this.getHeight(),\n d: this.getDepth(),\n rx: this.getRotationX(),\n ry: this.getRotationY(),\n flipX: this.isFlippedX(),\n flipY: this.isFlippedY(),\n flipZ: this.isFlippedZ(),\n };\n }\n\n updateFromNetworkSyncData(networkSyncData: Object3DNetworkSyncData) {\n super.updateFromNetworkSyncData(networkSyncData);\n if (networkSyncData.z !== undefined) this.setZ(networkSyncData.z);\n if (networkSyncData.w !== undefined) this.setWidth(networkSyncData.w);\n if (networkSyncData.h !== undefined) this.setHeight(networkSyncData.h);\n if (networkSyncData.d !== undefined) this.setDepth(networkSyncData.d);\n if (networkSyncData.rx !== undefined)\n this.setRotationX(networkSyncData.rx);\n if (networkSyncData.ry !== undefined)\n this.setRotationY(networkSyncData.ry);\n if (networkSyncData.flipX !== undefined)\n this.flipX(networkSyncData.flipX);\n if (networkSyncData.flipY !== undefined)\n this.flipY(networkSyncData.flipY);\n if (networkSyncData.flipZ !== undefined)\n this.flipZ(networkSyncData.flipZ);\n }\n\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n if (initialInstanceData.depth !== undefined) {\n this.setDepth(initialInstanceData.depth);\n }\n if (initialInstanceData.flippedX) {\n this.flipX(initialInstanceData.flippedX);\n }\n if (initialInstanceData.flippedY) {\n this.flipY(initialInstanceData.flippedY);\n }\n if (initialInstanceData.flippedZ) {\n this.flipZ(initialInstanceData.flippedZ);\n }\n }\n\n setX(x: float): void {\n super.setX(x);\n this.getRenderer().updatePosition();\n }\n\n setY(y: float): void {\n super.setY(y);\n this.getRenderer().updatePosition();\n }\n\n /**\n * Set the object position on the Z axis.\n */\n setZ(z: float): void {\n if (z === this._z) return;\n this._z = z;\n this.getRenderer().updatePosition();\n }\n\n /**\n * Get the object position on the Z axis.\n */\n getZ(): float {\n return this._z;\n }\n\n /**\n * Get the Z position of the rendered object.\n *\n * For most objects, this will returns the same value as getZ(). But if the\n * object has an origin that is not the same as the point (0,0,0) of the\n * object displayed, getDrawableZ will differ.\n *\n * @return The Z position of the rendered object.\n */\n getDrawableZ(): float {\n return this._z;\n }\n\n /**\n * Return the bottom Z of the object.\n * Rotations around X and Y are not taken into account.\n */\n getUnrotatedAABBMinZ(): number {\n return this.getDrawableZ();\n }\n\n /**\n * Return the top Z of the object.\n * Rotations around X and Y are not taken into account.\n */\n getUnrotatedAABBMaxZ(): number {\n return this.getDrawableZ() + this.getDepth();\n }\n\n /**\n * Return the Z position of the object center, **relative to the object Z\n * position** (`getDrawableX`).\n *\n * Use `getCenterZInScene` to get the position of the center in the scene.\n *\n * @return the Z position of the object center, relative to\n * `getDrawableZ()`.\n */\n getCenterZ(): float {\n return this.getDepth() / 2;\n }\n\n getCenterZInScene(): float {\n return this.getDrawableZ() + this.getCenterZ();\n }\n\n setCenterZInScene(z: float): void {\n this.setZ(z + this._z - (this.getDrawableZ() + this.getCenterZ()));\n }\n\n setAngle(angle: float): void {\n super.setAngle(angle);\n this.getRenderer().updateRotation();\n }\n\n /**\n * Set the object rotation on the X axis.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n */\n setRotationX(angle: float): void {\n this._rotationX = angle;\n this.getRenderer().updateRotation();\n }\n\n /**\n * Set the object rotation on the Y axis.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n */\n setRotationY(angle: float): void {\n this._rotationY = angle;\n this.getRenderer().updateRotation();\n }\n\n /**\n * Get the object rotation on the X axis.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n */\n getRotationX(): float {\n return this._rotationX;\n }\n\n /**\n * Get the object rotation on the Y axis.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n */\n getRotationY(): float {\n return this._rotationY;\n }\n\n /**\n * Turn the object around the scene x axis at its center.\n * @param deltaAngle the rotation angle\n */\n turnAroundX(deltaAngle: float): void {\n const axisX = gdjs.RuntimeObject3D._temporaryVector;\n axisX.set(1, 0, 0);\n\n const mesh = this.getRenderer().get3DRendererObject();\n mesh.rotateOnWorldAxis(axisX, gdjs.toRad(deltaAngle));\n this._rotationX = gdjs.toDegrees(mesh.rotation.x);\n this._rotationY = gdjs.toDegrees(mesh.rotation.y);\n this.setAngle(gdjs.toDegrees(mesh.rotation.z));\n }\n\n /**\n * Turn the object around the scene y axis at its center.\n * @param deltaAngle the rotation angle\n */\n turnAroundY(deltaAngle: float): void {\n const axisY = gdjs.RuntimeObject3D._temporaryVector;\n axisY.set(0, 1, 0);\n\n const mesh = this.getRenderer().get3DRendererObject();\n mesh.rotateOnWorldAxis(axisY, gdjs.toRad(deltaAngle));\n this._rotationX = gdjs.toDegrees(mesh.rotation.x);\n this._rotationY = gdjs.toDegrees(mesh.rotation.y);\n this.setAngle(gdjs.toDegrees(mesh.rotation.z));\n }\n\n /**\n * Turn the object around the scene z axis at its center.\n * @param deltaAngle the rotation angle\n */\n turnAroundZ(deltaAngle: float): void {\n const axisZ = gdjs.RuntimeObject3D._temporaryVector;\n axisZ.set(0, 0, 1);\n\n const mesh = this.getRenderer().get3DRendererObject();\n mesh.rotateOnWorldAxis(axisZ, gdjs.toRad(deltaAngle));\n this._rotationX = gdjs.toDegrees(mesh.rotation.x);\n this._rotationY = gdjs.toDegrees(mesh.rotation.y);\n this.setAngle(gdjs.toDegrees(mesh.rotation.z));\n }\n\n getWidth(): float {\n return this._width;\n }\n\n getHeight(): float {\n return this._height;\n }\n\n /**\n * Get the object size on the Z axis (called \"depth\").\n */\n getDepth(): float {\n return this._depth;\n }\n\n setWidth(width: float): void {\n if (this._width === width) return;\n\n this._width = width;\n this.getRenderer().updateSize();\n this.invalidateHitboxes();\n }\n\n setHeight(height: float): void {\n if (this._height === height) return;\n\n this._height = height;\n this.getRenderer().updateSize();\n this.invalidateHitboxes();\n }\n\n setSize(newWidth: number, newHeight: number): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n }\n\n /**\n * Set the object size on the Z axis (called \"depth\").\n */\n setDepth(depth: float): void {\n if (this._depth === depth) return;\n\n this._depth = depth;\n this.getRenderer().updateSize();\n }\n\n /**\n * Return the width of the object for a scale of 1.\n *\n * It can't be 0.\n */\n _getOriginalWidth(): float {\n return this._originalWidth;\n }\n\n /**\n * Return the height of the object for a scale of 1.\n *\n * It can't be 0.\n */\n _getOriginalHeight(): float {\n return this._originalHeight;\n }\n\n /**\n * Return the object size on the Z axis (called \"depth\") when the scale equals 1.\n */\n _getOriginalDepth(): float {\n return this._originalDepth;\n }\n\n /**\n * Set the width of the object for a scale of 1.\n */\n _setOriginalWidth(originalWidth: float): void {\n if (originalWidth <= 0) {\n originalWidth = 1;\n }\n const oldOriginalWidth = this._originalWidth;\n this._originalWidth = originalWidth;\n if (oldOriginalWidth === this._width) {\n this.setWidth(originalWidth);\n }\n }\n\n /**\n * Set the height of the object for a scale of 1.\n */\n _setOriginalHeight(originalHeight: float): void {\n if (originalHeight <= 0) {\n originalHeight = 1;\n }\n const oldOriginalHeight = this._originalHeight;\n this._originalHeight = originalHeight;\n if (oldOriginalHeight === this._height) {\n this.setHeight(originalHeight);\n }\n }\n\n /**\n * Set the object size on the Z axis (called \"depth\") when the scale equals 1.\n */\n _setOriginalDepth(originalDepth: float): void {\n if (originalDepth <= 0) {\n originalDepth = 1;\n }\n const oldOriginalDepth = this._originalDepth;\n this._originalDepth = originalDepth;\n if (oldOriginalDepth === this._depth) {\n this.setDepth(originalDepth);\n }\n }\n\n /**\n * Change the scale on X, Y and Z axis of the object.\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScale(newScale: number): void {\n this.setScaleX(newScale);\n this.setScaleY(newScale);\n this.setScaleZ(newScale);\n }\n\n /**\n * Change the scale on X axis of the object (changing its width).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleX(newScale: number): void {\n if (newScale < 0) {\n newScale = 0;\n }\n this.setWidth(this._originalWidth * newScale);\n }\n\n /**\n * Change the scale on Y axis of the object (changing its height).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleY(newScale: number): void {\n if (newScale < 0) {\n newScale = 0;\n }\n this.setHeight(this._originalHeight * newScale);\n }\n\n /**\n * Change the scale on Z axis of the object (changing its height).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleZ(newScale: number): void {\n if (newScale < 0) {\n newScale = 0;\n }\n this.setDepth(this._originalDepth * newScale);\n }\n\n /**\n * Get the scale of the object (or the geometric average of X, Y and Z scale in case they are different).\n *\n * @return the scale of the object (or the geometric average of X, Y and Z scale in case they are different).\n */\n getScale(): number {\n const scaleX = this.getScaleX();\n const scaleY = this.getScaleY();\n const scaleZ = this.getScaleZ();\n return scaleX === scaleY && scaleX === scaleZ\n ? scaleX\n : Math.pow(scaleX * scaleY * scaleZ, 1 / 3);\n }\n\n /**\n * Get the scale of the object on X axis.\n *\n * @return the scale of the object on X axis\n */\n getScaleX(): float {\n return Math.abs(this._width / this._originalWidth);\n }\n\n /**\n * Get the scale of the object on Y axis.\n *\n * @return the scale of the object on Y axis\n */\n getScaleY(): float {\n return Math.abs(this._height / this._originalHeight);\n }\n\n /**\n * Get the scale of the object on Z axis.\n *\n * @return the scale of the object on Z axis\n */\n getScaleZ(): float {\n return Math.abs(this._depth / this._originalDepth);\n }\n\n flipX(enable: boolean) {\n if (enable !== this._flippedX) {\n this._flippedX = enable;\n this.getRenderer().updateSize();\n }\n }\n\n flipY(enable: boolean) {\n if (enable !== this._flippedY) {\n this._flippedY = enable;\n this.getRenderer().updateSize();\n }\n }\n\n flipZ(enable: boolean) {\n if (enable !== this._flippedZ) {\n this._flippedZ = enable;\n this.getRenderer().updateSize();\n }\n }\n\n isFlippedX(): boolean {\n return this._flippedX;\n }\n\n isFlippedY(): boolean {\n return this._flippedY;\n }\n\n isFlippedZ(): boolean {\n return this._flippedZ;\n }\n\n hide(enable: boolean): void {\n super.hide(enable);\n this.getRenderer().updateVisibility();\n }\n }\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAYE,KAAM,GAAyB,AAAC,GAC9B,IAAU,OAAY,IAAM,GAAS,EAAI,EAAI,EAsBxC,eACG,GAAK,aAKQ,CA2CrB,YACE,EACA,EACA,CACA,MAAM,EAAmB,GA3CnB,QAAY,EAsBZ,eAAqB,GACrB,eAAqB,GACrB,eAAqB,GAMrB,gBAAoB,EAMpB,gBAAoB,EAS1B,KAAK,OAAS,KAAK,eAAiB,EAClC,EAAW,QAAQ,OAErB,KAAK,QAAU,KAAK,gBAAkB,EACpC,EAAW,QAAQ,QAErB,KAAK,OAAS,KAAK,eAAiB,EAClC,EAAW,QAAQ,OAMvB,mBAAoB,CAClB,MAAO,MAGT,qBAAsB,CACpB,MAAO,MAAK,cAAc,sBAG5B,qBACE,EACA,EACS,CAET,YAAK,kBACH,EAAuB,EAAc,QAAQ,QAE/C,KAAK,mBACH,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I,EAAW,GACb,GAAW,GAEb,KAAK,UAAU,KAAK,gBAAkB,GAQxC,UAAU,EAAwB,CAChC,AAAI,EAAW,GACb,GAAW,GAEb,KAAK,SAAS,KAAK,eAAiB,GAQtC,UAAmB,CACjB,KAAM,GAAS,KAAK,YACd,EAAS,KAAK,YACd,EAAS,KAAK,YACpB,MAAO,KAAW,GAAU,IAAW,EACnC,EACA,KAAK,IAAI,EAAS,EAAS,EAAQ,EAAI,GAQ7C,WAAmB,CACjB,MAAO,MAAK,IAAI,KAAK,OAAS,KAAK,gBAQrC,WAAmB,CACjB,MAAO,MAAK,IAAI,KAAK,QAAU,KAAK,iBAQtC,WAAmB,CACjB,MAAO,MAAK,IAAI,KAAK,OAAS,KAAK,gBAGrC,MAAM,EAAiB,CACrB,AAAI,IAAW,KAAK,WAClB,MAAK,UAAY,EACjB,KAAK,cAAc,cAIvB,MAAM,EAAiB,CACrB,AAAI,IAAW,KAAK,WAClB,MAAK,UAAY,EACjB,KAAK,cAAc,cAIvB,MAAM,EAAiB,CACrB,AAAI,IAAW,KAAK,WAClB,MAAK,UAAY,EACjB,KAAK,cAAc,cAIvB,YAAsB,CACpB,MAAO,MAAK,UAGd,YAAsB,CACpB,MAAO,MAAK,UAGd,YAAsB,CACpB,MAAO,MAAK,UAGd,KAAK,EAAuB,CAC1B,MAAM,KAAK,GACX,KAAK,cAAc,oBAlfN,AA/CV,EA+CU,iBAAmB,GAAI,OAAM,QA/CvC,EAAe,oBAnCd",
4
+ "sourcesContent": ["namespace gdjs {\n const getValidDimensionValue = (value: float | undefined) =>\n value === undefined ? 100 : value <= 0 ? 1 : value;\n\n type Object3DNetworkSyncDataType = {\n // z is position on the Z axis, different from zo, which is Z order\n z: number;\n w: number;\n h: number;\n d: number;\n rx: number;\n ry: number;\n // no need for rz, as it is the angle from gdjs.RuntimeObject\n flipX: boolean;\n flipY: boolean;\n flipZ: boolean;\n };\n\n export type Object3DNetworkSyncData = ObjectNetworkSyncData &\n Object3DNetworkSyncDataType;\n\n /**\n * Base class for 3D objects.\n */\n export abstract class RuntimeObject3D\n extends gdjs.RuntimeObject\n implements gdjs.Resizable, gdjs.Scalable, gdjs.Flippable, gdjs.Base3DHandler\n {\n /**\n * Position on the Z axis.\n */\n private _z: float = 0;\n /**\n * `_width` takes this value when the scale equals 1.\n *\n * It can't be 0.\n */\n private _originalWidth: float;\n /**\n * `_height` takes this value when the scale equals 1.\n *\n * It can't be 0.\n */\n private _originalHeight: float;\n /**\n * `depth` takes this value when the scale equals 1.\n *\n * It can't be 0.\n */\n private _originalDepth: float;\n private _width: float;\n private _height: float;\n private _depth: float;\n private _flippedX: boolean = false;\n private _flippedY: boolean = false;\n private _flippedZ: boolean = false;\n /**\n * Euler angle with the `ZYX` order.\n *\n * Note that `_rotationZ` is `angle` from `gdjs.RuntimeObject`.\n */\n private _rotationX: float = 0;\n /**\n * Euler angle with the `ZYX` order.\n *\n * Note that `_rotationZ` is `angle` from `gdjs.RuntimeObject`.\n */\n private _rotationY: float = 0;\n private static _temporaryVector = new THREE.Vector3();\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n objectData: gdjs.Object3DData\n ) {\n super(instanceContainer, objectData);\n // TODO Should 0 be replaced by 0.01 instead of using the default value?\n this._width = this._originalWidth = getValidDimensionValue(\n objectData.content.width\n );\n this._height = this._originalHeight = getValidDimensionValue(\n objectData.content.height\n );\n this._depth = this._originalDepth = getValidDimensionValue(\n objectData.content.depth\n );\n }\n\n abstract getRenderer(): gdjs.RuntimeObject3DRenderer;\n\n getRendererObject() {\n return null;\n }\n\n get3DRendererObject() {\n return this.getRenderer().get3DRendererObject();\n }\n\n updateFromObjectData(\n oldObjectData: Object3DData,\n newObjectData: Object3DData\n ): boolean {\n // There is no need to check if they changed because events can't modify them.\n this._setOriginalWidth(\n getValidDimensionValue(newObjectData.content.width)\n );\n this._setOriginalHeight(\n getValidDimensionValue(newObjectData.content.height)\n );\n this._setOriginalDepth(\n getValidDimensionValue(newObjectData.content.depth)\n );\n return true;\n }\n\n getNetworkSyncData(): Object3DNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n z: this.getZ(),\n w: this.getWidth(),\n h: this.getHeight(),\n d: this.getDepth(),\n rx: this.getRotationX(),\n ry: this.getRotationY(),\n flipX: this.isFlippedX(),\n flipY: this.isFlippedY(),\n flipZ: this.isFlippedZ(),\n };\n }\n\n updateFromNetworkSyncData(networkSyncData: Object3DNetworkSyncData) {\n super.updateFromNetworkSyncData(networkSyncData);\n if (networkSyncData.z !== undefined) this.setZ(networkSyncData.z);\n if (networkSyncData.w !== undefined) this.setWidth(networkSyncData.w);\n if (networkSyncData.h !== undefined) this.setHeight(networkSyncData.h);\n if (networkSyncData.d !== undefined) this.setDepth(networkSyncData.d);\n if (networkSyncData.rx !== undefined)\n this.setRotationX(networkSyncData.rx);\n if (networkSyncData.ry !== undefined)\n this.setRotationY(networkSyncData.ry);\n if (networkSyncData.flipX !== undefined)\n this.flipX(networkSyncData.flipX);\n if (networkSyncData.flipY !== undefined)\n this.flipY(networkSyncData.flipY);\n if (networkSyncData.flipZ !== undefined)\n this.flipZ(networkSyncData.flipZ);\n }\n\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n if (initialInstanceData.customSize) {\n this.setWidth(initialInstanceData.width);\n this.setHeight(initialInstanceData.height);\n }\n if (initialInstanceData.depth !== undefined) {\n this.setDepth(initialInstanceData.depth);\n }\n if (initialInstanceData.flippedX) {\n this.flipX(initialInstanceData.flippedX);\n }\n if (initialInstanceData.flippedY) {\n this.flipY(initialInstanceData.flippedY);\n }\n if (initialInstanceData.flippedZ) {\n this.flipZ(initialInstanceData.flippedZ);\n }\n }\n\n setX(x: float): void {\n super.setX(x);\n this.getRenderer().updatePosition();\n }\n\n setY(y: float): void {\n super.setY(y);\n this.getRenderer().updatePosition();\n }\n\n /**\n * Set the object position on the Z axis.\n */\n setZ(z: float): void {\n if (z === this._z) return;\n this._z = z;\n this.getRenderer().updatePosition();\n }\n\n /**\n * Get the object position on the Z axis.\n */\n getZ(): float {\n return this._z;\n }\n\n /**\n * Get the Z position of the rendered object.\n *\n * For most objects, this will returns the same value as getZ(). But if the\n * object has an origin that is not the same as the point (0,0,0) of the\n * object displayed, getDrawableZ will differ.\n *\n * @return The Z position of the rendered object.\n */\n getDrawableZ(): float {\n return this._z;\n }\n\n /**\n * Return the bottom Z of the object.\n * Rotations around X and Y are not taken into account.\n */\n getUnrotatedAABBMinZ(): number {\n return this.getDrawableZ();\n }\n\n /**\n * Return the top Z of the object.\n * Rotations around X and Y are not taken into account.\n */\n getUnrotatedAABBMaxZ(): number {\n return this.getDrawableZ() + this.getDepth();\n }\n\n /**\n * Return the Z position of the object center, **relative to the object Z\n * position** (`getDrawableX`).\n *\n * Use `getCenterZInScene` to get the position of the center in the scene.\n *\n * @return the Z position of the object center, relative to\n * `getDrawableZ()`.\n */\n getCenterZ(): float {\n return this.getDepth() / 2;\n }\n\n getCenterZInScene(): float {\n return this.getDrawableZ() + this.getCenterZ();\n }\n\n setCenterZInScene(z: float): void {\n this.setZ(z + this._z - (this.getDrawableZ() + this.getCenterZ()));\n }\n\n setAngle(angle: float): void {\n super.setAngle(angle);\n this.getRenderer().updateRotation();\n }\n\n /**\n * Set the object rotation on the X axis.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n */\n setRotationX(angle: float): void {\n this._rotationX = angle;\n this.getRenderer().updateRotation();\n }\n\n /**\n * Set the object rotation on the Y axis.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n */\n setRotationY(angle: float): void {\n this._rotationY = angle;\n this.getRenderer().updateRotation();\n }\n\n /**\n * Get the object rotation on the X axis.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n */\n getRotationX(): float {\n return this._rotationX;\n }\n\n /**\n * Get the object rotation on the Y axis.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n */\n getRotationY(): float {\n return this._rotationY;\n }\n\n /**\n * Turn the object around the scene x axis at its center.\n * @param deltaAngle the rotation angle\n */\n turnAroundX(deltaAngle: float): void {\n const axisX = gdjs.RuntimeObject3D._temporaryVector;\n axisX.set(1, 0, 0);\n\n const mesh = this.getRenderer().get3DRendererObject();\n mesh.rotateOnWorldAxis(axisX, gdjs.toRad(deltaAngle));\n this._rotationX = gdjs.toDegrees(mesh.rotation.x);\n this._rotationY = gdjs.toDegrees(mesh.rotation.y);\n this.setAngle(gdjs.toDegrees(mesh.rotation.z));\n }\n\n /**\n * Turn the object around the scene y axis at its center.\n * @param deltaAngle the rotation angle\n */\n turnAroundY(deltaAngle: float): void {\n const axisY = gdjs.RuntimeObject3D._temporaryVector;\n axisY.set(0, 1, 0);\n\n const mesh = this.getRenderer().get3DRendererObject();\n mesh.rotateOnWorldAxis(axisY, gdjs.toRad(deltaAngle));\n this._rotationX = gdjs.toDegrees(mesh.rotation.x);\n this._rotationY = gdjs.toDegrees(mesh.rotation.y);\n this.setAngle(gdjs.toDegrees(mesh.rotation.z));\n }\n\n /**\n * Turn the object around the scene z axis at its center.\n * @param deltaAngle the rotation angle\n */\n turnAroundZ(deltaAngle: float): void {\n const axisZ = gdjs.RuntimeObject3D._temporaryVector;\n axisZ.set(0, 0, 1);\n\n const mesh = this.getRenderer().get3DRendererObject();\n mesh.rotateOnWorldAxis(axisZ, gdjs.toRad(deltaAngle));\n this._rotationX = gdjs.toDegrees(mesh.rotation.x);\n this._rotationY = gdjs.toDegrees(mesh.rotation.y);\n this.setAngle(gdjs.toDegrees(mesh.rotation.z));\n }\n\n getWidth(): float {\n return this._width;\n }\n\n getHeight(): float {\n return this._height;\n }\n\n /**\n * Get the object size on the Z axis (called \"depth\").\n */\n getDepth(): float {\n return this._depth;\n }\n\n setWidth(width: float): void {\n if (this._width === width) return;\n\n this._width = width;\n this.getRenderer().updateSize();\n this.invalidateHitboxes();\n }\n\n setHeight(height: float): void {\n if (this._height === height) return;\n\n this._height = height;\n this.getRenderer().updateSize();\n this.invalidateHitboxes();\n }\n\n setSize(newWidth: number, newHeight: number): void {\n this.setWidth(newWidth);\n this.setHeight(newHeight);\n }\n\n /**\n * Set the object size on the Z axis (called \"depth\").\n */\n setDepth(depth: float): void {\n if (this._depth === depth) return;\n\n this._depth = depth;\n this.getRenderer().updateSize();\n }\n\n /**\n * Return the width of the object for a scale of 1.\n *\n * It can't be 0.\n */\n _getOriginalWidth(): float {\n return this._originalWidth;\n }\n\n /**\n * Return the height of the object for a scale of 1.\n *\n * It can't be 0.\n */\n _getOriginalHeight(): float {\n return this._originalHeight;\n }\n\n /**\n * Return the object size on the Z axis (called \"depth\") when the scale equals 1.\n */\n _getOriginalDepth(): float {\n return this._originalDepth;\n }\n\n /**\n * Set the width of the object for a scale of 1.\n */\n _setOriginalWidth(originalWidth: float): void {\n if (originalWidth <= 0) {\n originalWidth = 1;\n }\n const oldOriginalWidth = this._originalWidth;\n this._originalWidth = originalWidth;\n if (oldOriginalWidth === this._width) {\n this.setWidth(originalWidth);\n }\n }\n\n /**\n * Set the height of the object for a scale of 1.\n */\n _setOriginalHeight(originalHeight: float): void {\n if (originalHeight <= 0) {\n originalHeight = 1;\n }\n const oldOriginalHeight = this._originalHeight;\n this._originalHeight = originalHeight;\n if (oldOriginalHeight === this._height) {\n this.setHeight(originalHeight);\n }\n }\n\n /**\n * Set the object size on the Z axis (called \"depth\") when the scale equals 1.\n */\n _setOriginalDepth(originalDepth: float): void {\n if (originalDepth <= 0) {\n originalDepth = 1;\n }\n const oldOriginalDepth = this._originalDepth;\n this._originalDepth = originalDepth;\n if (oldOriginalDepth === this._depth) {\n this.setDepth(originalDepth);\n }\n }\n\n /**\n * Change the scale on X, Y and Z axis of the object.\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScale(newScale: number): void {\n this.setScaleX(newScale);\n this.setScaleY(newScale);\n this.setScaleZ(newScale);\n }\n\n /**\n * Change the scale on X axis of the object (changing its width).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleX(newScale: number): void {\n if (newScale < 0) {\n newScale = 0;\n }\n this.setWidth(this._originalWidth * newScale);\n }\n\n /**\n * Change the scale on Y axis of the object (changing its height).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleY(newScale: number): void {\n if (newScale < 0) {\n newScale = 0;\n }\n this.setHeight(this._originalHeight * newScale);\n }\n\n /**\n * Change the scale on Z axis of the object (changing its height).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleZ(newScale: number): void {\n if (newScale < 0) {\n newScale = 0;\n }\n this.setDepth(this._originalDepth * newScale);\n }\n\n /**\n * Get the scale of the object (or the geometric average of X, Y and Z scale in case they are different).\n *\n * @return the scale of the object (or the geometric average of X, Y and Z scale in case they are different).\n */\n getScale(): number {\n const scaleX = this.getScaleX();\n const scaleY = this.getScaleY();\n const scaleZ = this.getScaleZ();\n return scaleX === scaleY && scaleX === scaleZ\n ? scaleX\n : Math.pow(scaleX * scaleY * scaleZ, 1 / 3);\n }\n\n /**\n * Get the scale of the object on X axis.\n *\n * @return the scale of the object on X axis\n */\n getScaleX(): float {\n return Math.abs(this._width / this._originalWidth);\n }\n\n /**\n * Get the scale of the object on Y axis.\n *\n * @return the scale of the object on Y axis\n */\n getScaleY(): float {\n return Math.abs(this._height / this._originalHeight);\n }\n\n /**\n * Get the scale of the object on Z axis.\n *\n * @return the scale of the object on Z axis\n */\n getScaleZ(): float {\n return Math.abs(this._depth / this._originalDepth);\n }\n\n flipX(enable: boolean) {\n if (enable !== this._flippedX) {\n this._flippedX = enable;\n this.getRenderer().updateSize();\n }\n }\n\n flipY(enable: boolean) {\n if (enable !== this._flippedY) {\n this._flippedY = enable;\n this.getRenderer().updateSize();\n }\n }\n\n flipZ(enable: boolean) {\n if (enable !== this._flippedZ) {\n this._flippedZ = enable;\n this.getRenderer().updateSize();\n }\n }\n\n isFlippedX(): boolean {\n return this._flippedX;\n }\n\n isFlippedY(): boolean {\n return this._flippedY;\n }\n\n isFlippedZ(): boolean {\n return this._flippedZ;\n }\n\n hide(enable: boolean): void {\n super.hide(enable);\n this.getRenderer().updateVisibility();\n }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,KAAK,WAClB,MAAK,UAAY,EACjB,KAAK,cAAc,cAIvB,YAAsB,CACpB,MAAO,MAAK,UAGd,YAAsB,CACpB,MAAO,MAAK,UAGd,YAAsB,CACpB,MAAO,MAAK,UAGd,KAAK,EAAuB,CAC1B,MAAM,KAAK,GACX,KAAK,cAAc,oBAlfN,AA5CV,EA4CU,iBAAmB,GAAI,OAAM,QA5CvC,EAAe,oBAxBd",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/3D/Base3DBehavior.ts"],
4
- "sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-2023 Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n export interface Base3DHandler {\n /**\n * Set the object position on the Z axis.\n */\n setZ(z: float): void;\n\n /**\n * Get the object position on the Z axis.\n */\n getZ(): float;\n\n /**\n * Return the Z position of the object center, **relative to the scene origin**.\n */\n getCenterZInScene(): float;\n\n /**\n * Change the object center Z position in the scene.\n * @param z The new Z position of the center in the scene.\n */\n setCenterZInScene(z: float): void;\n\n /**\n * Set the object rotation on the X axis.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n *\n * @param angle the rotation angle on the X axis in degree\n */\n setRotationX(angle: float): void;\n\n /**\n * Set the object rotation on the Y axis.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n *\n * @param angle the rotation angle on the Y axis in degree\n */\n setRotationY(angle: float): void;\n\n /**\n * Get the object rotation on the X axis in degree.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n */\n getRotationX(): float;\n\n /**\n * Get the object rotation on the Y axis in degree.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n */\n getRotationY(): float;\n\n /**\n * Turn the object around the scene X axis at its center.\n * @param deltaAngle the rotation angle in degree\n */\n turnAroundX(deltaAngle: float): void;\n\n /**\n * Turn the object around the scene Y axis at its center.\n * @param deltaAngle the rotation angle in degree\n */\n turnAroundY(deltaAngle: float): void;\n\n /**\n * Turn the object around the scene Z axis at its center.\n * @param deltaAngle the rotation angle in degree\n */\n turnAroundZ(deltaAngle: float): void;\n\n /**\n * Get the object size on the Z axis (called \"depth\").\n */\n getDepth(): float;\n\n /**\n * Set the object size on the Z axis (called \"depth\").\n */\n setDepth(depth: float): void;\n\n /**\n * Change the scale on Z axis of the object (changing its depth).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleZ(newScale: number): void;\n\n /**\n * Get the scale of the object on Z axis.\n *\n * @return the scale of the object on Z axis\n */\n getScaleZ(): float;\n\n flipZ(enable: boolean): void;\n\n isFlippedZ(): boolean;\n\n /**\n * Return the bottom Z of the object.\n * Rotations around X and Y are not taken into account.\n */\n getUnrotatedAABBMinZ(): number;\n\n /**\n * Return the top Z of the object.\n * Rotations around X and Y are not taken into account.\n */\n getUnrotatedAABBMaxZ(): number;\n }\n\n export namespace Base3DHandler {\n export const is3D = (\n object: gdjs.RuntimeObject\n ): object is gdjs.RuntimeObject & gdjs.Base3DHandler => {\n //@ts-ignore We are checking if the methods are present.\n return object.getZ && object.setZ;\n };\n }\n\n /**\n * A behavior that forwards the Base3D interface to its object.\n */\n export class Base3DBehavior\n extends gdjs.RuntimeBehavior\n implements Base3DHandler {\n private object: gdjs.RuntimeObject & Base3DHandler;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n behaviorData,\n owner: gdjs.RuntimeObject & Base3DHandler\n ) {\n super(instanceContainer, behaviorData, owner);\n this.object = owner;\n }\n\n updateFromBehaviorData(oldBehaviorData, newBehaviorData): boolean {\n // Nothing to update.\n return true;\n }\n\n onDeActivate() {}\n\n onDestroy() {}\n\n doStepPreEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {}\n\n doStepPostEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {}\n\n setZ(z: float): void {\n this.object.setZ(z);\n }\n\n getZ(): float {\n return this.object.getZ();\n }\n\n getCenterZInScene(): number {\n return this.object.getCenterZInScene();\n }\n\n setCenterZInScene(z: number): void {\n this.object.setCenterZInScene(z);\n }\n\n setRotationX(angle: float): void {\n this.object.setRotationX(angle);\n }\n\n setRotationY(angle: float): void {\n this.object.setRotationY(angle);\n }\n\n getRotationX(): float {\n return this.object.getRotationX();\n }\n\n getRotationY(): float {\n return this.object.getRotationY();\n }\n\n turnAroundX(deltaAngle: float): void {\n this.object.turnAroundX(deltaAngle);\n }\n\n turnAroundY(deltaAngle: float): void {\n this.object.turnAroundY(deltaAngle);\n }\n\n turnAroundZ(deltaAngle: float): void {\n this.object.turnAroundZ(deltaAngle);\n }\n\n getDepth(): float {\n return this.object.getDepth();\n }\n\n setDepth(depth: float): void {\n this.object.setDepth(depth);\n }\n\n setScaleZ(newScale: number): void {\n this.object.setScaleZ(newScale);\n }\n\n getScaleZ(): float {\n return this.object.getScaleZ();\n }\n\n flipZ(enable: boolean): void {\n this.object.flipZ(enable);\n }\n\n isFlippedZ(): boolean {\n return this.object.isFlippedZ();\n }\n\n getUnrotatedAABBMinZ(): number {\n return this.object.getUnrotatedAABBMinZ();\n }\n\n getUnrotatedAABBMaxZ(): number {\n return this.object.getUnrotatedAABBMaxZ();\n }\n }\n\n gdjs.registerBehavior('Scene3D::Base3DBehavior', gdjs.Base3DBehavior);\n}\n"],
5
- "mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CAkHS,GAAU,GAAV,UAAU,EAAV,CACE,AAAM,OAAO,AAClB,GAGO,EAAO,MAAQ,EAAO,OALhB,yCAYV,eACG,GAAK,eACY,CAGzB,YACE,EACA,EACA,EACA,CACA,MAAM,EAAmB,EAAc,GACvC,KAAK,OAAS,EAGhB,uBAAuB,EAAiB,EAA0B,CAEhE,MAAO,GAGT,cAAe,EAEf,WAAY,EAEZ,gBAAgB,EAAkD,EAElE,iBAAiB,EAAkD,EAEnE,KAAK,EAAgB,CACnB,KAAK,OAAO,KAAK,GAGnB,MAAc,CACZ,MAAO,MAAK,OAAO,OAGrB,mBAA4B,CAC1B,MAAO,MAAK,OAAO,oBAGrB,kBAAkB,EAAiB,CACjC,KAAK,OAAO,kBAAkB,GAGhC,aAAa,EAAoB,CAC/B,KAAK,OAAO,aAAa,GAG3B,aAAa,EAAoB,CAC/B,KAAK,OAAO,aAAa,GAG3B,cAAsB,CACpB,MAAO,MAAK,OAAO,eAGrB,cAAsB,CACpB,MAAO,MAAK,OAAO,eAGrB,YAAY,EAAyB,CACnC,KAAK,OAAO,YAAY,GAG1B,YAAY,EAAyB,CACnC,KAAK,OAAO,YAAY,GAG1B,YAAY,EAAyB,CACnC,KAAK,OAAO,YAAY,GAG1B,UAAkB,CAChB,MAAO,MAAK,OAAO,WAGrB,SAAS,EAAoB,CAC3B,KAAK,OAAO,SAAS,GAGvB,UAAU,EAAwB,CAChC,KAAK,OAAO,UAAU,GAGxB,WAAmB,CACjB,MAAO,MAAK,OAAO,YAGrB,MAAM,EAAuB,CAC3B,KAAK,OAAO,MAAM,GAGpB,YAAsB,CACpB,MAAO,MAAK,OAAO,aAGrB,sBAA+B,CAC7B,MAAO,MAAK,OAAO,uBAGrB,sBAA+B,CAC7B,MAAO,MAAK,OAAO,wBApGhB,EAAM,iBAwGb,EAAK,iBAAiB,0BAA2B,EAAK,kBAtO9C",
4
+ "sourcesContent": ["/*\n * GDevelop JS Platform\n * Copyright 2013-2023 Florian Rival (Florian.Rival@gmail.com). All rights reserved.\n * This project is released under the MIT License.\n */\nnamespace gdjs {\n export interface Base3DHandler {\n /**\n * Set the object position on the Z axis.\n */\n setZ(z: float): void;\n\n /**\n * Get the object position on the Z axis.\n */\n getZ(): float;\n\n /**\n * Return the Z position of the object center, **relative to the scene origin**.\n */\n getCenterZInScene(): float;\n\n /**\n * Change the object center Z position in the scene.\n * @param z The new Z position of the center in the scene.\n */\n setCenterZInScene(z: float): void;\n\n /**\n * Set the object rotation on the X axis.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n *\n * @param angle the rotation angle on the X axis in degree\n */\n setRotationX(angle: float): void;\n\n /**\n * Set the object rotation on the Y axis.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n *\n * @param angle the rotation angle on the Y axis in degree\n */\n setRotationY(angle: float): void;\n\n /**\n * Get the object rotation on the X axis in degree.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n */\n getRotationX(): float;\n\n /**\n * Get the object rotation on the Y axis in degree.\n *\n * This is an Euler angle. Objects use the `ZYX` order.\n */\n getRotationY(): float;\n\n /**\n * Turn the object around the scene X axis at its center.\n * @param deltaAngle the rotation angle in degree\n */\n turnAroundX(deltaAngle: float): void;\n\n /**\n * Turn the object around the scene Y axis at its center.\n * @param deltaAngle the rotation angle in degree\n */\n turnAroundY(deltaAngle: float): void;\n\n /**\n * Turn the object around the scene Z axis at its center.\n * @param deltaAngle the rotation angle in degree\n */\n turnAroundZ(deltaAngle: float): void;\n\n /**\n * Get the object size on the Z axis (called \"depth\").\n */\n getDepth(): float;\n\n /**\n * Set the object size on the Z axis (called \"depth\").\n */\n setDepth(depth: float): void;\n\n /**\n * Change the scale on Z axis of the object (changing its depth).\n *\n * @param newScale The new scale (must be greater than 0).\n */\n setScaleZ(newScale: number): void;\n\n /**\n * Get the scale of the object on Z axis.\n *\n * @return the scale of the object on Z axis\n */\n getScaleZ(): float;\n\n flipZ(enable: boolean): void;\n\n isFlippedZ(): boolean;\n\n /**\n * Return the bottom Z of the object.\n * Rotations around X and Y are not taken into account.\n */\n getUnrotatedAABBMinZ(): number;\n\n /**\n * Return the top Z of the object.\n * Rotations around X and Y are not taken into account.\n */\n getUnrotatedAABBMaxZ(): number;\n }\n\n export interface Object3DDataContent {\n width: float;\n height: float;\n depth: float;\n }\n /** Base parameters for {@link gdjs.RuntimeObject3D} */\n export interface Object3DData extends ObjectData {\n /** The base parameters of the RuntimeObject3D */\n content: Object3DDataContent;\n }\n\n export namespace Base3DHandler {\n export const is3D = (\n object: gdjs.RuntimeObject\n ): object is gdjs.RuntimeObject & gdjs.Base3DHandler => {\n //@ts-ignore We are checking if the methods are present.\n return object.getZ && object.setZ;\n };\n }\n\n /**\n * A behavior that forwards the Base3D interface to its object.\n */\n export class Base3DBehavior\n extends gdjs.RuntimeBehavior\n implements Base3DHandler\n {\n private object: gdjs.RuntimeObject & Base3DHandler;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n behaviorData,\n owner: gdjs.RuntimeObject & Base3DHandler\n ) {\n super(instanceContainer, behaviorData, owner);\n this.object = owner;\n }\n\n updateFromBehaviorData(oldBehaviorData, newBehaviorData): boolean {\n // Nothing to update.\n return true;\n }\n\n onDeActivate() {}\n\n onDestroy() {}\n\n doStepPreEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {}\n\n doStepPostEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {}\n\n setZ(z: float): void {\n this.object.setZ(z);\n }\n\n getZ(): float {\n return this.object.getZ();\n }\n\n getCenterZInScene(): number {\n return this.object.getCenterZInScene();\n }\n\n setCenterZInScene(z: number): void {\n this.object.setCenterZInScene(z);\n }\n\n setRotationX(angle: float): void {\n this.object.setRotationX(angle);\n }\n\n setRotationY(angle: float): void {\n this.object.setRotationY(angle);\n }\n\n getRotationX(): float {\n return this.object.getRotationX();\n }\n\n getRotationY(): float {\n return this.object.getRotationY();\n }\n\n turnAroundX(deltaAngle: float): void {\n this.object.turnAroundX(deltaAngle);\n }\n\n turnAroundY(deltaAngle: float): void {\n this.object.turnAroundY(deltaAngle);\n }\n\n turnAroundZ(deltaAngle: float): void {\n this.object.turnAroundZ(deltaAngle);\n }\n\n getDepth(): float {\n return this.object.getDepth();\n }\n\n setDepth(depth: float): void {\n this.object.setDepth(depth);\n }\n\n setScaleZ(newScale: number): void {\n this.object.setScaleZ(newScale);\n }\n\n getScaleZ(): float {\n return this.object.getScaleZ();\n }\n\n flipZ(enable: boolean): void {\n this.object.flipZ(enable);\n }\n\n isFlippedZ(): boolean {\n return this.object.isFlippedZ();\n }\n\n getUnrotatedAABBMinZ(): number {\n return this.object.getUnrotatedAABBMinZ();\n }\n\n getUnrotatedAABBMaxZ(): number {\n return this.object.getUnrotatedAABBMaxZ();\n }\n }\n\n gdjs.registerBehavior('Scene3D::Base3DBehavior', gdjs.Base3DBehavior);\n}\n"],
5
+ "mappings": "AAKA,GAAU,MAAV,UAAU,EAAV,CA6HS,GAAU,GAAV,UAAU,EAAV,CACE,AAAM,OAAO,AAClB,GAGO,EAAO,MAAQ,EAAO,OALhB,yCAYV,eACG,GAAK,eAEf,CAGE,YACE,EACA,EACA,EACA,CACA,MAAM,EAAmB,EAAc,GACvC,KAAK,OAAS,EAGhB,uBAAuB,EAAiB,EAA0B,CAEhE,MAAO,GAGT,cAAe,EAEf,WAAY,EAEZ,gBAAgB,EAAkD,EAElE,iBAAiB,EAAkD,EAEnE,KAAK,EAAgB,CACnB,KAAK,OAAO,KAAK,GAGnB,MAAc,CACZ,MAAO,MAAK,OAAO,OAGrB,mBAA4B,CAC1B,MAAO,MAAK,OAAO,oBAGrB,kBAAkB,EAAiB,CACjC,KAAK,OAAO,kBAAkB,GAGhC,aAAa,EAAoB,CAC/B,KAAK,OAAO,aAAa,GAG3B,aAAa,EAAoB,CAC/B,KAAK,OAAO,aAAa,GAG3B,cAAsB,CACpB,MAAO,MAAK,OAAO,eAGrB,cAAsB,CACpB,MAAO,MAAK,OAAO,eAGrB,YAAY,EAAyB,CACnC,KAAK,OAAO,YAAY,GAG1B,YAAY,EAAyB,CACnC,KAAK,OAAO,YAAY,GAG1B,YAAY,EAAyB,CACnC,KAAK,OAAO,YAAY,GAG1B,UAAkB,CAChB,MAAO,MAAK,OAAO,WAGrB,SAAS,EAAoB,CAC3B,KAAK,OAAO,SAAS,GAGvB,UAAU,EAAwB,CAChC,KAAK,OAAO,UAAU,GAGxB,WAAmB,CACjB,MAAO,MAAK,OAAO,YAGrB,MAAM,EAAuB,CAC3B,KAAK,OAAO,MAAM,GAGpB,YAAsB,CACpB,MAAO,MAAK,OAAO,aAGrB,sBAA+B,CAC7B,MAAO,MAAK,OAAO,uBAGrB,sBAA+B,CAC7B,MAAO,MAAK,OAAO,wBArGhB,EAAM,iBAyGb,EAAK,iBAAiB,0BAA2B,EAAK,kBAlP9C",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- 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<<i.front),e.content.backFaceVisible&&(this._visibleFacesBitmask|=1<<i.back),e.content.leftFaceVisible&&(this._visibleFacesBitmask|=1<<i.left),e.content.rightFaceVisible&&(this._visibleFacesBitmask|=1<<i.right),e.content.topFaceVisible&&(this._visibleFacesBitmask|=1<<i.top),e.content.bottomFaceVisible&&(this._visibleFacesBitmask|=1<<i.bottom),this._textureRepeatFacesBitmask=0,e.content.frontFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.front),e.content.backFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.back),e.content.leftFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.left),e.content.rightFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.right),e.content.topFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.top),e.content.bottomFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.bottom),this._backFaceUpThroughWhichAxisRotation=e.content.backFaceUpThroughWhichAxisRotation||"X",this._faceResourceNames=[e.content.frontFaceResourceName,e.content.backFaceResourceName,e.content.leftFaceResourceName,e.content.rightFaceResourceName,e.content.topFaceResourceName,e.content.bottomFaceResourceName],this._materialType=this._convertMaterialType(e.content.materialType),this._renderer=new c.Cube3DRuntimeObjectRenderer(this,t),this.onCreated()}setFaceVisibility(t,e){const s=i[t];s!==void 0&&e!==this.isFaceAtIndexVisible(s)&&(e?this._visibleFacesBitmask|=1<<s:this._visibleFacesBitmask&=~(1<<s),this._renderer.updateFace(s))}setRepeatTextureOnFace(t,e){const s=i[t];s!==void 0&&e!==this.shouldRepeatTextureOnFaceAtIndex(s)&&(e?this._textureRepeatFacesBitmask|=1<<s:this._textureRepeatFacesBitmask&=~(1<<s),this._renderer.updateFace(s))}isFaceVisible(t){const e=i[t];return e===void 0?!1:this.isFaceAtIndexVisible(e)}isFaceAtIndexVisible(t){return(this._visibleFacesBitmask&1<<t)!=0}shouldRepeatTextureOnFaceAtIndex(t){return(this._textureRepeatFacesBitmask&1<<t)!=0}setFaceResourceName(t,e){const s=i[t];s!==void 0&&this._faceResourceNames[s]!==e&&(this._faceResourceNames[s]=e,this._renderer.updateFace(s))}getFaceAtIndexResourceName(t){return this._faceResourceNames[t]}getRenderer(){return this._renderer}getBackFaceUpThroughWhichAxisRotation(){return this._backFaceUpThroughWhichAxisRotation}setBackFaceUpThroughWhichAxisRotation(t){this._backFaceUpThroughWhichAxisRotation=t,this._renderer.updateFace(i.back)}getFacesOrientation(){return this._facesOrientation}setFacesOrientation(t){this._facesOrientation=t,this._renderer.updateFace(i.left),this._renderer.updateFace(i.right),this._renderer.updateFace(i.top)}updateFromObjectData(t,e){return super.updateFromObjectData(t,e),t.content.frontFaceVisible!==e.content.frontFaceVisible&&this.setFaceVisibility("front",e.content.frontFaceVisible),t.content.backFaceVisible!==e.content.backFaceVisible&&this.setFaceVisibility("back",e.content.backFaceVisible),t.content.leftFaceVisible!==e.content.leftFaceVisible&&this.setFaceVisibility("left",e.content.leftFaceVisible),t.content.rightFaceVisible!==e.content.rightFaceVisible&&this.setFaceVisibility("right",e.content.rightFaceVisible),t.content.topFaceVisible!==e.content.topFaceVisible&&this.setFaceVisibility("top",e.content.topFaceVisible),t.content.bottomFaceVisible!==e.content.bottomFaceVisible&&this.setFaceVisibility("bottom",e.content.bottomFaceVisible),t.content.frontFaceResourceName!==e.content.frontFaceResourceName&&this.setFaceResourceName("front",e.content.frontFaceResourceName),t.content.backFaceResourceName!==e.content.backFaceResourceName&&this.setFaceResourceName("back",e.content.backFaceResourceName),t.content.leftFaceResourceName!==e.content.leftFaceResourceName&&this.setFaceResourceName("left",e.content.leftFaceResourceName),t.content.rightFaceResourceName!==e.content.rightFaceResourceName&&this.setFaceResourceName("right",e.content.rightFaceResourceName),t.content.topFaceResourceName!==e.content.topFaceResourceName&&this.setFaceResourceName("top",e.content.topFaceResourceName),t.content.bottomFaceResourceName!==e.content.bottomFaceResourceName&&this.setFaceResourceName("bottom",e.content.bottomFaceResourceName),t.content.frontFaceResourceRepeat!==e.content.frontFaceResourceRepeat&&this.setRepeatTextureOnFace("front",e.content.frontFaceResourceRepeat),t.content.backFaceResourceRepeat!==e.content.backFaceResourceRepeat&&this.setRepeatTextureOnFace("back",e.content.backFaceResourceRepeat),t.content.leftFaceResourceRepeat!==e.content.leftFaceResourceRepeat&&this.setRepeatTextureOnFace("left",e.content.leftFaceResourceRepeat),t.content.rightFaceResourceRepeat!==e.content.rightFaceResourceRepeat&&this.setRepeatTextureOnFace("right",e.content.rightFaceResourceRepeat),t.content.topFaceResourceRepeat!==e.content.topFaceResourceRepeat&&this.setRepeatTextureOnFace("top",e.content.topFaceResourceRepeat),t.content.bottomFaceResourceRepeat!==e.content.bottomFaceResourceRepeat&&this.setRepeatTextureOnFace("bottom",e.content.bottomFaceResourceRepeat),t.content.backFaceUpThroughWhichAxisRotation!==e.content.backFaceUpThroughWhichAxisRotation&&this.setBackFaceUpThroughWhichAxisRotation(e.content.backFaceUpThroughWhichAxisRotation),t.content.facesOrientation!==e.content.facesOrientation&&this.setFacesOrientation(e.content.facesOrientation),t.content.materialType!==e.content.materialType&&this.setMaterialType(e.content.materialType),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),mt:this._materialType,fo:this._facesOrientation,bfu:this._backFaceUpThroughWhichAxisRotation,vfb:this._visibleFacesBitmask,trfb:this._textureRepeatFacesBitmask,frn:this._faceResourceNames}}updateFromNetworkSyncData(t){if(super.updateFromNetworkSyncData(t),t.mt!==void 0&&(this._materialType=t.mt),t.fo!==void 0&&this._facesOrientation!==t.fo&&this.setFacesOrientation(t.fo),t.bfu!==void 0&&this._backFaceUpThroughWhichAxisRotation!==t.bfu&&this.setBackFaceUpThroughWhichAxisRotation(t.bfu),t.vfb!==void 0&&this._visibleFacesBitmask!==t.vfb){this._visibleFacesBitmask=t.vfb;for(let e=0;e<this._faceResourceNames.length;e++)this._renderer.updateFace(e)}if(t.trfb!==void 0&&this._textureRepeatFacesBitmask!==t.trfb){this._textureRepeatFacesBitmask=t.trfb;for(let e=0;e<this._faceResourceNames.length;e++)this._renderer.updateFace(e)}if(t.frn!==void 0&&!this._faceResourceNames.every((e,s)=>e===t.frn[s])){this._faceResourceNames=t.frn;for(let e=0;e<this._faceResourceNames.length;e++)this._renderer.updateFace(e)}}shouldUseTransparentTexture(){return this._shouldUseTransparentTexture}_convertMaterialType(t){return t==="StandardWithoutMetalness"?c.Cube3DRuntimeObject.MaterialType.StandardWithoutMetalness:c.Cube3DRuntimeObject.MaterialType.Basic}setMaterialType(t){const e=this._convertMaterialType(t);this._materialType!==e&&(this._materialType=e,this._renderer._updateMaterials())}}c.Cube3DRuntimeObject=a,function(t){let n;(function(r){r[r.Basic=0]="Basic",r[r.StandardWithoutMetalness=1]="StandardWithoutMetalness"})(n=t.MaterialType||(t.MaterialType={}))}(a=c.Cube3DRuntimeObject||(c.Cube3DRuntimeObject={})),c.registerObject("Scene3D::Cube3DObject",c.Cube3DRuntimeObject)})(gdjs||(gdjs={}));
1
+ var gdjs;(function(n){const i={front:0,back:1,left:2,right:3,top:4,bottom:5};class c extends n.RuntimeObject3D{constructor(t,e){super(t,e);this._materialType=n.Cube3DRuntimeObject.MaterialType.Basic;this._shouldUseTransparentTexture=e.content.enableTextureTransparency||!1,this._facesOrientation=e.content.facesOrientation||"Y",this._visibleFacesBitmask=0,e.content.frontFaceVisible&&(this._visibleFacesBitmask|=1<<i.front),e.content.backFaceVisible&&(this._visibleFacesBitmask|=1<<i.back),e.content.leftFaceVisible&&(this._visibleFacesBitmask|=1<<i.left),e.content.rightFaceVisible&&(this._visibleFacesBitmask|=1<<i.right),e.content.topFaceVisible&&(this._visibleFacesBitmask|=1<<i.top),e.content.bottomFaceVisible&&(this._visibleFacesBitmask|=1<<i.bottom),this._textureRepeatFacesBitmask=0,e.content.frontFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.front),e.content.backFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.back),e.content.leftFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.left),e.content.rightFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.right),e.content.topFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.top),e.content.bottomFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.bottom),this._backFaceUpThroughWhichAxisRotation=e.content.backFaceUpThroughWhichAxisRotation||"X",this._faceResourceNames=[e.content.frontFaceResourceName,e.content.backFaceResourceName,e.content.leftFaceResourceName,e.content.rightFaceResourceName,e.content.topFaceResourceName,e.content.bottomFaceResourceName],this._tint=e.content.tint||"255;255;255",this._materialType=this._convertMaterialType(e.content.materialType),this._renderer=new n.Cube3DRuntimeObjectRenderer(this,t),this.onCreated()}setFaceVisibility(t,e){const s=i[t];s!==void 0&&e!==this.isFaceAtIndexVisible(s)&&(e?this._visibleFacesBitmask|=1<<s:this._visibleFacesBitmask&=~(1<<s),this._renderer.updateFace(s))}setRepeatTextureOnFace(t,e){const s=i[t];s!==void 0&&e!==this.shouldRepeatTextureOnFaceAtIndex(s)&&(e?this._textureRepeatFacesBitmask|=1<<s:this._textureRepeatFacesBitmask&=~(1<<s),this._renderer.updateFace(s))}isFaceVisible(t){const e=i[t];return e===void 0?!1:this.isFaceAtIndexVisible(e)}isFaceAtIndexVisible(t){return(this._visibleFacesBitmask&1<<t)!=0}shouldRepeatTextureOnFaceAtIndex(t){return(this._textureRepeatFacesBitmask&1<<t)!=0}setFaceResourceName(t,e){const s=i[t];s!==void 0&&this._faceResourceNames[s]!==e&&(this._faceResourceNames[s]=e,this._renderer.updateFace(s))}setColor(t){this._tint!==t&&(this._tint=t,this._renderer.updateTint())}getColor(){return this._tint}getFaceAtIndexResourceName(t){return this._faceResourceNames[t]}getRenderer(){return this._renderer}getBackFaceUpThroughWhichAxisRotation(){return this._backFaceUpThroughWhichAxisRotation}setBackFaceUpThroughWhichAxisRotation(t){this._backFaceUpThroughWhichAxisRotation=t,this._renderer.updateFace(i.back)}getFacesOrientation(){return this._facesOrientation}setFacesOrientation(t){this._facesOrientation=t,this._renderer.updateFace(i.left),this._renderer.updateFace(i.right),this._renderer.updateFace(i.top)}updateFromObjectData(t,e){return super.updateFromObjectData(t,e),t.content.frontFaceVisible!==e.content.frontFaceVisible&&this.setFaceVisibility("front",e.content.frontFaceVisible),t.content.backFaceVisible!==e.content.backFaceVisible&&this.setFaceVisibility("back",e.content.backFaceVisible),t.content.leftFaceVisible!==e.content.leftFaceVisible&&this.setFaceVisibility("left",e.content.leftFaceVisible),t.content.rightFaceVisible!==e.content.rightFaceVisible&&this.setFaceVisibility("right",e.content.rightFaceVisible),t.content.topFaceVisible!==e.content.topFaceVisible&&this.setFaceVisibility("top",e.content.topFaceVisible),t.content.bottomFaceVisible!==e.content.bottomFaceVisible&&this.setFaceVisibility("bottom",e.content.bottomFaceVisible),t.content.frontFaceResourceName!==e.content.frontFaceResourceName&&this.setFaceResourceName("front",e.content.frontFaceResourceName),t.content.tint!==e.content.tint&&this.setColor(e.content.tint||"255;255;255"),t.content.backFaceResourceName!==e.content.backFaceResourceName&&this.setFaceResourceName("back",e.content.backFaceResourceName),t.content.leftFaceResourceName!==e.content.leftFaceResourceName&&this.setFaceResourceName("left",e.content.leftFaceResourceName),t.content.rightFaceResourceName!==e.content.rightFaceResourceName&&this.setFaceResourceName("right",e.content.rightFaceResourceName),t.content.topFaceResourceName!==e.content.topFaceResourceName&&this.setFaceResourceName("top",e.content.topFaceResourceName),t.content.bottomFaceResourceName!==e.content.bottomFaceResourceName&&this.setFaceResourceName("bottom",e.content.bottomFaceResourceName),t.content.frontFaceResourceRepeat!==e.content.frontFaceResourceRepeat&&this.setRepeatTextureOnFace("front",e.content.frontFaceResourceRepeat||!1),t.content.backFaceResourceRepeat!==e.content.backFaceResourceRepeat&&this.setRepeatTextureOnFace("back",e.content.backFaceResourceRepeat||!1),t.content.leftFaceResourceRepeat!==e.content.leftFaceResourceRepeat&&this.setRepeatTextureOnFace("left",e.content.leftFaceResourceRepeat||!1),t.content.rightFaceResourceRepeat!==e.content.rightFaceResourceRepeat&&this.setRepeatTextureOnFace("right",e.content.rightFaceResourceRepeat||!1),t.content.topFaceResourceRepeat!==e.content.topFaceResourceRepeat&&this.setRepeatTextureOnFace("top",e.content.topFaceResourceRepeat||!1),t.content.bottomFaceResourceRepeat!==e.content.bottomFaceResourceRepeat&&this.setRepeatTextureOnFace("bottom",e.content.bottomFaceResourceRepeat||!1),t.content.backFaceUpThroughWhichAxisRotation!==e.content.backFaceUpThroughWhichAxisRotation&&this.setBackFaceUpThroughWhichAxisRotation(e.content.backFaceUpThroughWhichAxisRotation||"X"),t.content.facesOrientation!==e.content.facesOrientation&&this.setFacesOrientation(e.content.facesOrientation||"Y"),t.content.materialType!==e.content.materialType&&this.setMaterialType(e.content.materialType),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),mt:this._materialType,fo:this._facesOrientation,bfu:this._backFaceUpThroughWhichAxisRotation,vfb:this._visibleFacesBitmask,trfb:this._textureRepeatFacesBitmask,frn:this._faceResourceNames,tint:this._tint}}updateFromNetworkSyncData(t){if(super.updateFromNetworkSyncData(t),t.mt!==void 0&&(this._materialType=t.mt),t.fo!==void 0&&this._facesOrientation!==t.fo&&this.setFacesOrientation(t.fo),t.bfu!==void 0&&this._backFaceUpThroughWhichAxisRotation!==t.bfu&&this.setBackFaceUpThroughWhichAxisRotation(t.bfu),t.vfb!==void 0&&this._visibleFacesBitmask!==t.vfb){this._visibleFacesBitmask=t.vfb;for(let e=0;e<this._faceResourceNames.length;e++)this._renderer.updateFace(e)}if(t.trfb!==void 0&&this._textureRepeatFacesBitmask!==t.trfb){this._textureRepeatFacesBitmask=t.trfb;for(let e=0;e<this._faceResourceNames.length;e++)this._renderer.updateFace(e)}if(t.frn!==void 0&&!this._faceResourceNames.every((e,s)=>e===t.frn[s])){this._faceResourceNames=t.frn;for(let e=0;e<this._faceResourceNames.length;e++)this._renderer.updateFace(e)}t.tint!==void 0&&this._tint!==t.tint&&(this._tint=t.tint,this._renderer.updateTint())}shouldUseTransparentTexture(){return this._shouldUseTransparentTexture}_convertMaterialType(t){return t==="StandardWithoutMetalness"?n.Cube3DRuntimeObject.MaterialType.StandardWithoutMetalness:n.Cube3DRuntimeObject.MaterialType.Basic}setMaterialType(t){const e=this._convertMaterialType(t);this._materialType!==e&&(this._materialType=e,this._renderer._updateMaterials())}}n.Cube3DRuntimeObject=c,function(t){let a;(function(r){r[r.Basic=0]="Basic",r[r.StandardWithoutMetalness=1]="StandardWithoutMetalness"})(a=t.MaterialType||(t.MaterialType={}))}(c=n.Cube3DRuntimeObject||(n.Cube3DRuntimeObject={})),n.registerObject("Scene3D::Cube3DObject",n.Cube3DRuntimeObject)})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=Cube3DRuntimeObject.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/3D/Cube3DRuntimeObject.ts"],
4
- "sourcesContent": ["namespace gdjs {\n /** Base parameters for {@link gdjs.Cube3DRuntimeObject} */\n export interface Cube3DObjectData extends Object3DData {\n /** The base parameters of the Cube3D object */\n content: Object3DDataContent & {\n enableTextureTransparency: boolean;\n facesOrientation: 'Y' | 'Z';\n frontFaceResourceName: string;\n backFaceResourceName: string;\n backFaceUpThroughWhichAxisRotation: 'X' | 'Y';\n leftFaceResourceName: string;\n rightFaceResourceName: string;\n topFaceResourceName: string;\n bottomFaceResourceName: string;\n frontFaceResourceRepeat: boolean;\n backFaceResourceRepeat: boolean;\n leftFaceResourceRepeat: boolean;\n rightFaceResourceRepeat: boolean;\n topFaceResourceRepeat: boolean;\n bottomFaceResourceRepeat: boolean;\n frontFaceVisible: boolean;\n backFaceVisible: boolean;\n leftFaceVisible: boolean;\n rightFaceVisible: boolean;\n topFaceVisible: boolean;\n bottomFaceVisible: boolean;\n materialType: 'Basic' | 'StandardWithoutMetalness';\n };\n }\n\n type FaceName = 'front' | 'back' | 'left' | 'right' | 'top' | 'bottom';\n const faceNameToBitmaskIndex = {\n front: 0,\n back: 1,\n left: 2,\n right: 3,\n top: 4,\n bottom: 5,\n };\n\n type Cube3DObjectNetworkSyncDataType = {\n fo: 'Y' | 'Z';\n bfu: 'X' | 'Y';\n vfb: integer;\n trfb: integer;\n frn: [string, string, string, string, string, string];\n mt: number;\n };\n\n type Cube3DObjectNetworkSyncData = Object3DNetworkSyncData &\n Cube3DObjectNetworkSyncDataType;\n\n /**\n * Shows a 3D box object.\n */\n export class Cube3DRuntimeObject extends gdjs.RuntimeObject3D {\n private _renderer: Cube3DRuntimeObjectRenderer;\n private _facesOrientation: 'Y' | 'Z';\n private _backFaceUpThroughWhichAxisRotation: 'X' | 'Y';\n private _shouldUseTransparentTexture: boolean;\n // `_rotationZ` is `angle` from `gdjs.RuntimeObject`.\n private _visibleFacesBitmask: integer;\n private _textureRepeatFacesBitmask: integer;\n private _faceResourceNames: [\n string,\n string,\n string,\n string,\n string,\n string\n ];\n _materialType: gdjs.Cube3DRuntimeObject.MaterialType =\n gdjs.Cube3DRuntimeObject.MaterialType.Basic;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n objectData: Cube3DObjectData\n ) {\n super(instanceContainer, objectData);\n this._shouldUseTransparentTexture =\n objectData.content.enableTextureTransparency || false;\n this._facesOrientation = objectData.content.facesOrientation || 'Y';\n this._visibleFacesBitmask = 0;\n if (objectData.content.frontFaceVisible)\n this._visibleFacesBitmask |= 1 << faceNameToBitmaskIndex['front'];\n if (objectData.content.backFaceVisible)\n this._visibleFacesBitmask |= 1 << faceNameToBitmaskIndex['back'];\n if (objectData.content.leftFaceVisible)\n this._visibleFacesBitmask |= 1 << faceNameToBitmaskIndex['left'];\n if (objectData.content.rightFaceVisible)\n this._visibleFacesBitmask |= 1 << faceNameToBitmaskIndex['right'];\n if (objectData.content.topFaceVisible)\n this._visibleFacesBitmask |= 1 << faceNameToBitmaskIndex['top'];\n if (objectData.content.bottomFaceVisible)\n this._visibleFacesBitmask |= 1 << faceNameToBitmaskIndex['bottom'];\n this._textureRepeatFacesBitmask = 0;\n if (objectData.content.frontFaceResourceRepeat)\n this._textureRepeatFacesBitmask |= 1 << faceNameToBitmaskIndex['front'];\n if (objectData.content.backFaceResourceRepeat)\n this._textureRepeatFacesBitmask |= 1 << faceNameToBitmaskIndex['back'];\n if (objectData.content.leftFaceResourceRepeat)\n this._textureRepeatFacesBitmask |= 1 << faceNameToBitmaskIndex['left'];\n if (objectData.content.rightFaceResourceRepeat)\n this._textureRepeatFacesBitmask |= 1 << faceNameToBitmaskIndex['right'];\n if (objectData.content.topFaceResourceRepeat)\n this._textureRepeatFacesBitmask |= 1 << faceNameToBitmaskIndex['top'];\n if (objectData.content.bottomFaceResourceRepeat)\n this._textureRepeatFacesBitmask |=\n 1 << faceNameToBitmaskIndex['bottom'];\n this._backFaceUpThroughWhichAxisRotation =\n objectData.content.backFaceUpThroughWhichAxisRotation || 'X';\n this._faceResourceNames = [\n objectData.content.frontFaceResourceName,\n objectData.content.backFaceResourceName,\n objectData.content.leftFaceResourceName,\n objectData.content.rightFaceResourceName,\n objectData.content.topFaceResourceName,\n objectData.content.bottomFaceResourceName,\n ];\n this._materialType = this._convertMaterialType(\n objectData.content.materialType\n );\n\n this._renderer = new gdjs.Cube3DRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n /**\n * Sets the visibility of a face of the 3D box.\n *\n * @param faceName - The name of the face to set visibility for.\n * @param value - The visibility value to set.\n */\n setFaceVisibility(faceName: FaceName, enable: boolean) {\n const faceIndex = faceNameToBitmaskIndex[faceName];\n if (faceIndex === undefined) {\n return;\n }\n if (enable === this.isFaceAtIndexVisible(faceIndex)) {\n return;\n }\n\n if (enable) {\n this._visibleFacesBitmask |= 1 << faceIndex;\n } else {\n this._visibleFacesBitmask &= ~(1 << faceIndex);\n }\n this._renderer.updateFace(faceIndex);\n }\n\n /**\n * Sets the texture repeat of a face of the 3D box.\n *\n * @param faceName - The name of the face to set visibility for.\n * @param value - The visibility value to set.\n */\n setRepeatTextureOnFace(faceName: FaceName, enable: boolean) {\n const faceIndex = faceNameToBitmaskIndex[faceName];\n if (faceIndex === undefined) {\n return;\n }\n if (enable === this.shouldRepeatTextureOnFaceAtIndex(faceIndex)) {\n return;\n }\n\n if (enable) {\n this._textureRepeatFacesBitmask |= 1 << faceIndex;\n } else {\n this._textureRepeatFacesBitmask &= ~(1 << faceIndex);\n }\n this._renderer.updateFace(faceIndex);\n }\n\n isFaceVisible(faceName: FaceName): boolean {\n const faceIndex = faceNameToBitmaskIndex[faceName];\n if (faceIndex === undefined) {\n return false;\n }\n\n return this.isFaceAtIndexVisible(faceIndex);\n }\n\n /** @internal */\n isFaceAtIndexVisible(faceIndex): boolean {\n return (this._visibleFacesBitmask & (1 << faceIndex)) !== 0;\n }\n\n /** @internal */\n shouldRepeatTextureOnFaceAtIndex(faceIndex): boolean {\n return (this._textureRepeatFacesBitmask & (1 << faceIndex)) !== 0;\n }\n\n setFaceResourceName(faceName: FaceName, resourceName: string): void {\n const faceIndex = faceNameToBitmaskIndex[faceName];\n if (faceIndex === undefined) {\n return;\n }\n if (this._faceResourceNames[faceIndex] === resourceName) {\n return;\n }\n\n this._faceResourceNames[faceIndex] = resourceName;\n this._renderer.updateFace(faceIndex);\n }\n\n /** @internal */\n getFaceAtIndexResourceName(faceIndex: integer): string {\n return this._faceResourceNames[faceIndex];\n }\n\n getRenderer(): gdjs.RuntimeObject3DRenderer {\n return this._renderer;\n }\n\n getBackFaceUpThroughWhichAxisRotation(): 'X' | 'Y' {\n return this._backFaceUpThroughWhichAxisRotation;\n }\n\n setBackFaceUpThroughWhichAxisRotation(axis: 'X' | 'Y'): void {\n this._backFaceUpThroughWhichAxisRotation = axis;\n this._renderer.updateFace(faceNameToBitmaskIndex['back']);\n }\n\n getFacesOrientation(): 'Y' | 'Z' {\n return this._facesOrientation;\n }\n\n setFacesOrientation(orientation: 'Y' | 'Z'): void {\n this._facesOrientation = orientation;\n this._renderer.updateFace(faceNameToBitmaskIndex['left']);\n this._renderer.updateFace(faceNameToBitmaskIndex['right']);\n this._renderer.updateFace(faceNameToBitmaskIndex['top']);\n // Bottom texture should not change based on that setting.\n }\n\n updateFromObjectData(\n oldObjectData: Cube3DObjectData,\n newObjectData: Cube3DObjectData\n ): boolean {\n super.updateFromObjectData(oldObjectData, newObjectData);\n if (\n oldObjectData.content.frontFaceVisible !==\n newObjectData.content.frontFaceVisible\n ) {\n this.setFaceVisibility('front', newObjectData.content.frontFaceVisible);\n }\n if (\n oldObjectData.content.backFaceVisible !==\n newObjectData.content.backFaceVisible\n ) {\n this.setFaceVisibility('back', newObjectData.content.backFaceVisible);\n }\n if (\n oldObjectData.content.leftFaceVisible !==\n newObjectData.content.leftFaceVisible\n ) {\n this.setFaceVisibility('left', newObjectData.content.leftFaceVisible);\n }\n if (\n oldObjectData.content.rightFaceVisible !==\n newObjectData.content.rightFaceVisible\n ) {\n this.setFaceVisibility('right', newObjectData.content.rightFaceVisible);\n }\n if (\n oldObjectData.content.topFaceVisible !==\n newObjectData.content.topFaceVisible\n ) {\n this.setFaceVisibility('top', newObjectData.content.topFaceVisible);\n }\n if (\n oldObjectData.content.bottomFaceVisible !==\n newObjectData.content.bottomFaceVisible\n ) {\n this.setFaceVisibility(\n 'bottom',\n newObjectData.content.bottomFaceVisible\n );\n }\n if (\n oldObjectData.content.frontFaceResourceName !==\n newObjectData.content.frontFaceResourceName\n ) {\n this.setFaceResourceName(\n 'front',\n newObjectData.content.frontFaceResourceName\n );\n }\n if (\n oldObjectData.content.backFaceResourceName !==\n newObjectData.content.backFaceResourceName\n ) {\n this.setFaceResourceName(\n 'back',\n newObjectData.content.backFaceResourceName\n );\n }\n if (\n oldObjectData.content.leftFaceResourceName !==\n newObjectData.content.leftFaceResourceName\n ) {\n this.setFaceResourceName(\n 'left',\n newObjectData.content.leftFaceResourceName\n );\n }\n if (\n oldObjectData.content.rightFaceResourceName !==\n newObjectData.content.rightFaceResourceName\n ) {\n this.setFaceResourceName(\n 'right',\n newObjectData.content.rightFaceResourceName\n );\n }\n if (\n oldObjectData.content.topFaceResourceName !==\n newObjectData.content.topFaceResourceName\n ) {\n this.setFaceResourceName(\n 'top',\n newObjectData.content.topFaceResourceName\n );\n }\n if (\n oldObjectData.content.bottomFaceResourceName !==\n newObjectData.content.bottomFaceResourceName\n ) {\n this.setFaceResourceName(\n 'bottom',\n newObjectData.content.bottomFaceResourceName\n );\n }\n if (\n oldObjectData.content.frontFaceResourceRepeat !==\n newObjectData.content.frontFaceResourceRepeat\n ) {\n this.setRepeatTextureOnFace(\n 'front',\n newObjectData.content.frontFaceResourceRepeat\n );\n }\n if (\n oldObjectData.content.backFaceResourceRepeat !==\n newObjectData.content.backFaceResourceRepeat\n ) {\n this.setRepeatTextureOnFace(\n 'back',\n newObjectData.content.backFaceResourceRepeat\n );\n }\n if (\n oldObjectData.content.leftFaceResourceRepeat !==\n newObjectData.content.leftFaceResourceRepeat\n ) {\n this.setRepeatTextureOnFace(\n 'left',\n newObjectData.content.leftFaceResourceRepeat\n );\n }\n if (\n oldObjectData.content.rightFaceResourceRepeat !==\n newObjectData.content.rightFaceResourceRepeat\n ) {\n this.setRepeatTextureOnFace(\n 'right',\n newObjectData.content.rightFaceResourceRepeat\n );\n }\n if (\n oldObjectData.content.topFaceResourceRepeat !==\n newObjectData.content.topFaceResourceRepeat\n ) {\n this.setRepeatTextureOnFace(\n 'top',\n newObjectData.content.topFaceResourceRepeat\n );\n }\n if (\n oldObjectData.content.bottomFaceResourceRepeat !==\n newObjectData.content.bottomFaceResourceRepeat\n ) {\n this.setRepeatTextureOnFace(\n 'bottom',\n newObjectData.content.bottomFaceResourceRepeat\n );\n }\n if (\n oldObjectData.content.backFaceUpThroughWhichAxisRotation !==\n newObjectData.content.backFaceUpThroughWhichAxisRotation\n ) {\n this.setBackFaceUpThroughWhichAxisRotation(\n newObjectData.content.backFaceUpThroughWhichAxisRotation\n );\n }\n if (\n oldObjectData.content.facesOrientation !==\n newObjectData.content.facesOrientation\n ) {\n this.setFacesOrientation(newObjectData.content.facesOrientation);\n }\n if (\n oldObjectData.content.materialType !==\n newObjectData.content.materialType\n ) {\n this.setMaterialType(newObjectData.content.materialType);\n }\n\n return true;\n }\n\n getNetworkSyncData(): Cube3DObjectNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n mt: this._materialType,\n fo: this._facesOrientation,\n bfu: this._backFaceUpThroughWhichAxisRotation,\n vfb: this._visibleFacesBitmask,\n trfb: this._textureRepeatFacesBitmask,\n frn: this._faceResourceNames,\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: Cube3DObjectNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n if (networkSyncData.mt !== undefined) {\n this._materialType = networkSyncData.mt;\n }\n if (networkSyncData.fo !== undefined) {\n if (this._facesOrientation !== networkSyncData.fo) {\n this.setFacesOrientation(networkSyncData.fo);\n }\n }\n if (networkSyncData.bfu !== undefined) {\n if (this._backFaceUpThroughWhichAxisRotation !== networkSyncData.bfu) {\n this.setBackFaceUpThroughWhichAxisRotation(networkSyncData.bfu);\n }\n }\n if (networkSyncData.vfb !== undefined) {\n // If it is different, update all the faces.\n if (this._visibleFacesBitmask !== networkSyncData.vfb) {\n this._visibleFacesBitmask = networkSyncData.vfb;\n for (let i = 0; i < this._faceResourceNames.length; i++) {\n this._renderer.updateFace(i);\n }\n }\n }\n if (networkSyncData.trfb !== undefined) {\n // If it is different, update all the faces.\n if (this._textureRepeatFacesBitmask !== networkSyncData.trfb) {\n this._textureRepeatFacesBitmask = networkSyncData.trfb;\n for (let i = 0; i < this._faceResourceNames.length; i++) {\n this._renderer.updateFace(i);\n }\n }\n }\n if (networkSyncData.frn !== undefined) {\n // If one element is different, update all the faces.\n if (\n !this._faceResourceNames.every(\n (value, index) => value === networkSyncData.frn[index]\n )\n ) {\n this._faceResourceNames = networkSyncData.frn;\n // Update all faces. (Could optimize to only update the changed ones)\n for (let i = 0; i < this._faceResourceNames.length; i++) {\n this._renderer.updateFace(i);\n }\n }\n }\n }\n\n /**\n * Return true if the texture transparency should be enabled.\n */\n shouldUseTransparentTexture(): boolean {\n return this._shouldUseTransparentTexture;\n }\n\n _convertMaterialType(\n materialTypeString: string\n ): gdjs.Cube3DRuntimeObject.MaterialType {\n if (materialTypeString === 'StandardWithoutMetalness') {\n return gdjs.Cube3DRuntimeObject.MaterialType.StandardWithoutMetalness;\n } else {\n return gdjs.Cube3DRuntimeObject.MaterialType.Basic;\n }\n }\n\n setMaterialType(materialTypeString: string) {\n const newMaterialType = this._convertMaterialType(materialTypeString);\n if (this._materialType === newMaterialType) {\n return;\n }\n\n this._materialType = newMaterialType;\n this._renderer._updateMaterials();\n }\n }\n\n export namespace Cube3DRuntimeObject {\n export enum MaterialType {\n Basic,\n StandardWithoutMetalness,\n }\n }\n gdjs.registerObject('Scene3D::Cube3DObject', gdjs.Cube3DRuntimeObject);\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CA+BE,KAAM,GAAyB,CAC7B,MAAO,EACP,KAAM,EACN,KAAM,EACN,MAAO,EACP,IAAK,EACL,OAAQ,GAkBH,eAAkC,GAAK,eAAgB,CAmB5D,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAP3B,mBACE,E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ACE,EACuC,CACvC,MAAI,KAAuB,2BAClB,EAAK,oBAAoB,aAAa,yBAEtC,EAAK,oBAAoB,aAAa,MAIjD,gBAAgB,EAA4B,CAC1C,KAAM,GAAkB,KAAK,qBAAqB,GAClD,AAAI,KAAK,gBAAkB,GAI3B,MAAK,cAAgB,EACrB,KAAK,UAAU,qBAjcZ,EAAM,sBAqcN,SAAU,EAAV,CACE,GAAK,GAAL,UAAK,EAAL,CACL,qBACA,6DAFU,wCADG,qDAMjB,EAAK,eAAe,wBAAyB,EAAK,uBAlgB1C",
4
+ "sourcesContent": ["namespace gdjs {\n /** Base parameters for {@link gdjs.Cube3DRuntimeObject} */\n export interface Cube3DObjectData extends Object3DData {\n /** The base parameters of the Cube3D object */\n content: Object3DDataContent & {\n enableTextureTransparency: boolean | undefined;\n facesOrientation: 'Y' | 'Z' | undefined;\n frontFaceResourceName: string;\n backFaceResourceName: string;\n backFaceUpThroughWhichAxisRotation: 'X' | 'Y' | undefined;\n leftFaceResourceName: string;\n rightFaceResourceName: string;\n topFaceResourceName: string;\n bottomFaceResourceName: string;\n frontFaceResourceRepeat: boolean | undefined;\n backFaceResourceRepeat: boolean | undefined;\n leftFaceResourceRepeat: boolean | undefined;\n rightFaceResourceRepeat: boolean | undefined;\n topFaceResourceRepeat: boolean | undefined;\n bottomFaceResourceRepeat: boolean | undefined;\n frontFaceVisible: boolean;\n backFaceVisible: boolean;\n leftFaceVisible: boolean;\n rightFaceVisible: boolean;\n topFaceVisible: boolean;\n bottomFaceVisible: boolean;\n tint: string | undefined;\n materialType: 'Basic' | 'StandardWithoutMetalness';\n };\n }\n type FaceName = 'front' | 'back' | 'left' | 'right' | 'top' | 'bottom';\n const faceNameToBitmaskIndex = {\n front: 0,\n back: 1,\n left: 2,\n right: 3,\n top: 4,\n bottom: 5,\n };\n\n type Cube3DObjectNetworkSyncDataType = {\n fo: 'Y' | 'Z';\n bfu: 'X' | 'Y';\n vfb: integer;\n trfb: integer;\n frn: [string, string, string, string, string, string];\n mt: number;\n tint: string;\n };\n\n type Cube3DObjectNetworkSyncData = Object3DNetworkSyncData &\n Cube3DObjectNetworkSyncDataType;\n\n /**\n * Shows a 3D box object.\n */\n export class Cube3DRuntimeObject extends gdjs.RuntimeObject3D {\n private _renderer: Cube3DRuntimeObjectRenderer;\n private _facesOrientation: 'Y' | 'Z';\n private _backFaceUpThroughWhichAxisRotation: 'X' | 'Y';\n private _shouldUseTransparentTexture: boolean;\n // `_rotationZ` is `angle` from `gdjs.RuntimeObject`.\n private _visibleFacesBitmask: integer;\n private _textureRepeatFacesBitmask: integer;\n private _faceResourceNames: [\n string,\n string,\n string,\n string,\n string,\n string,\n ];\n _materialType: gdjs.Cube3DRuntimeObject.MaterialType =\n gdjs.Cube3DRuntimeObject.MaterialType.Basic;\n _tint: string;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n objectData: Cube3DObjectData\n ) {\n super(instanceContainer, objectData);\n this._shouldUseTransparentTexture =\n objectData.content.enableTextureTransparency || false;\n this._facesOrientation = objectData.content.facesOrientation || 'Y';\n this._visibleFacesBitmask = 0;\n if (objectData.content.frontFaceVisible)\n this._visibleFacesBitmask |= 1 << faceNameToBitmaskIndex['front'];\n if (objectData.content.backFaceVisible)\n this._visibleFacesBitmask |= 1 << faceNameToBitmaskIndex['back'];\n if (objectData.content.leftFaceVisible)\n this._visibleFacesBitmask |= 1 << faceNameToBitmaskIndex['left'];\n if (objectData.content.rightFaceVisible)\n this._visibleFacesBitmask |= 1 << faceNameToBitmaskIndex['right'];\n if (objectData.content.topFaceVisible)\n this._visibleFacesBitmask |= 1 << faceNameToBitmaskIndex['top'];\n if (objectData.content.bottomFaceVisible)\n this._visibleFacesBitmask |= 1 << faceNameToBitmaskIndex['bottom'];\n this._textureRepeatFacesBitmask = 0;\n if (objectData.content.frontFaceResourceRepeat)\n this._textureRepeatFacesBitmask |= 1 << faceNameToBitmaskIndex['front'];\n if (objectData.content.backFaceResourceRepeat)\n this._textureRepeatFacesBitmask |= 1 << faceNameToBitmaskIndex['back'];\n if (objectData.content.leftFaceResourceRepeat)\n this._textureRepeatFacesBitmask |= 1 << faceNameToBitmaskIndex['left'];\n if (objectData.content.rightFaceResourceRepeat)\n this._textureRepeatFacesBitmask |= 1 << faceNameToBitmaskIndex['right'];\n if (objectData.content.topFaceResourceRepeat)\n this._textureRepeatFacesBitmask |= 1 << faceNameToBitmaskIndex['top'];\n if (objectData.content.bottomFaceResourceRepeat)\n this._textureRepeatFacesBitmask |=\n 1 << faceNameToBitmaskIndex['bottom'];\n this._backFaceUpThroughWhichAxisRotation =\n objectData.content.backFaceUpThroughWhichAxisRotation || 'X';\n this._faceResourceNames = [\n objectData.content.frontFaceResourceName,\n objectData.content.backFaceResourceName,\n objectData.content.leftFaceResourceName,\n objectData.content.rightFaceResourceName,\n objectData.content.topFaceResourceName,\n objectData.content.bottomFaceResourceName,\n ];\n\n this._tint = objectData.content.tint || '255;255;255';\n\n this._materialType = this._convertMaterialType(\n objectData.content.materialType\n );\n\n this._renderer = new gdjs.Cube3DRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n /**\n * Sets the visibility of a face of the 3D box.\n *\n * @param faceName - The name of the face to set visibility for.\n * @param enable - The visibility value to set.\n */\n setFaceVisibility(faceName: FaceName, enable: boolean) {\n const faceIndex = faceNameToBitmaskIndex[faceName];\n if (faceIndex === undefined) {\n return;\n }\n if (enable === this.isFaceAtIndexVisible(faceIndex)) {\n return;\n }\n\n if (enable) {\n this._visibleFacesBitmask |= 1 << faceIndex;\n } else {\n this._visibleFacesBitmask &= ~(1 << faceIndex);\n }\n this._renderer.updateFace(faceIndex);\n }\n\n /**\n * Sets the texture repeat of a face of the 3D box.\n *\n * @param faceName - The name of the face to set visibility for.\n * @param enable - The visibility value to set.\n */\n setRepeatTextureOnFace(faceName: FaceName, enable: boolean) {\n const faceIndex = faceNameToBitmaskIndex[faceName];\n if (faceIndex === undefined) {\n return;\n }\n if (enable === this.shouldRepeatTextureOnFaceAtIndex(faceIndex)) {\n return;\n }\n\n if (enable) {\n this._textureRepeatFacesBitmask |= 1 << faceIndex;\n } else {\n this._textureRepeatFacesBitmask &= ~(1 << faceIndex);\n }\n this._renderer.updateFace(faceIndex);\n }\n\n isFaceVisible(faceName: FaceName): boolean {\n const faceIndex = faceNameToBitmaskIndex[faceName];\n if (faceIndex === undefined) {\n return false;\n }\n\n return this.isFaceAtIndexVisible(faceIndex);\n }\n\n /** @internal */\n isFaceAtIndexVisible(faceIndex): boolean {\n return (this._visibleFacesBitmask & (1 << faceIndex)) !== 0;\n }\n\n /** @internal */\n shouldRepeatTextureOnFaceAtIndex(faceIndex): boolean {\n return (this._textureRepeatFacesBitmask & (1 << faceIndex)) !== 0;\n }\n\n setFaceResourceName(faceName: FaceName, resourceName: string): void {\n const faceIndex = faceNameToBitmaskIndex[faceName];\n if (faceIndex === undefined) {\n return;\n }\n if (this._faceResourceNames[faceIndex] === resourceName) {\n return;\n }\n this._faceResourceNames[faceIndex] = resourceName;\n this._renderer.updateFace(faceIndex);\n }\n\n setColor(tint: string): void {\n if (this._tint === tint) {\n return;\n }\n this._tint = tint;\n this._renderer.updateTint();\n }\n\n getColor(): string {\n return this._tint;\n }\n\n /** @internal */\n getFaceAtIndexResourceName(faceIndex: integer): string {\n return this._faceResourceNames[faceIndex];\n }\n\n getRenderer(): gdjs.RuntimeObject3DRenderer {\n return this._renderer;\n }\n\n getBackFaceUpThroughWhichAxisRotation(): 'X' | 'Y' {\n return this._backFaceUpThroughWhichAxisRotation;\n }\n\n setBackFaceUpThroughWhichAxisRotation(axis: 'X' | 'Y'): void {\n this._backFaceUpThroughWhichAxisRotation = axis;\n this._renderer.updateFace(faceNameToBitmaskIndex['back']);\n }\n\n getFacesOrientation(): 'Y' | 'Z' {\n return this._facesOrientation;\n }\n\n setFacesOrientation(orientation: 'Y' | 'Z'): void {\n this._facesOrientation = orientation;\n this._renderer.updateFace(faceNameToBitmaskIndex['left']);\n this._renderer.updateFace(faceNameToBitmaskIndex['right']);\n this._renderer.updateFace(faceNameToBitmaskIndex['top']);\n // Bottom texture should not change based on that setting.\n }\n\n updateFromObjectData(\n oldObjectData: Cube3DObjectData,\n newObjectData: Cube3DObjectData\n ): boolean {\n super.updateFromObjectData(oldObjectData, newObjectData);\n if (\n oldObjectData.content.frontFaceVisible !==\n newObjectData.content.frontFaceVisible\n ) {\n this.setFaceVisibility('front', newObjectData.content.frontFaceVisible);\n }\n if (\n oldObjectData.content.backFaceVisible !==\n newObjectData.content.backFaceVisible\n ) {\n this.setFaceVisibility('back', newObjectData.content.backFaceVisible);\n }\n if (\n oldObjectData.content.leftFaceVisible !==\n newObjectData.content.leftFaceVisible\n ) {\n this.setFaceVisibility('left', newObjectData.content.leftFaceVisible);\n }\n if (\n oldObjectData.content.rightFaceVisible !==\n newObjectData.content.rightFaceVisible\n ) {\n this.setFaceVisibility('right', newObjectData.content.rightFaceVisible);\n }\n if (\n oldObjectData.content.topFaceVisible !==\n newObjectData.content.topFaceVisible\n ) {\n this.setFaceVisibility('top', newObjectData.content.topFaceVisible);\n }\n if (\n oldObjectData.content.bottomFaceVisible !==\n newObjectData.content.bottomFaceVisible\n ) {\n this.setFaceVisibility(\n 'bottom',\n newObjectData.content.bottomFaceVisible\n );\n }\n if (\n oldObjectData.content.frontFaceResourceName !==\n newObjectData.content.frontFaceResourceName\n ) {\n this.setFaceResourceName(\n 'front',\n newObjectData.content.frontFaceResourceName\n );\n }\n if (oldObjectData.content.tint !== newObjectData.content.tint) {\n this.setColor(newObjectData.content.tint || '255;255;255');\n }\n\n if (\n oldObjectData.content.backFaceResourceName !==\n newObjectData.content.backFaceResourceName\n ) {\n this.setFaceResourceName(\n 'back',\n newObjectData.content.backFaceResourceName\n );\n }\n if (\n oldObjectData.content.leftFaceResourceName !==\n newObjectData.content.leftFaceResourceName\n ) {\n this.setFaceResourceName(\n 'left',\n newObjectData.content.leftFaceResourceName\n );\n }\n if (\n oldObjectData.content.rightFaceResourceName !==\n newObjectData.content.rightFaceResourceName\n ) {\n this.setFaceResourceName(\n 'right',\n newObjectData.content.rightFaceResourceName\n );\n }\n if (\n oldObjectData.content.topFaceResourceName !==\n newObjectData.content.topFaceResourceName\n ) {\n this.setFaceResourceName(\n 'top',\n newObjectData.content.topFaceResourceName\n );\n }\n if (\n oldObjectData.content.bottomFaceResourceName !==\n newObjectData.content.bottomFaceResourceName\n ) {\n this.setFaceResourceName(\n 'bottom',\n newObjectData.content.bottomFaceResourceName\n );\n }\n if (\n oldObjectData.content.frontFaceResourceRepeat !==\n newObjectData.content.frontFaceResourceRepeat\n ) {\n this.setRepeatTextureOnFace(\n 'front',\n newObjectData.content.frontFaceResourceRepeat || false\n );\n }\n if (\n oldObjectData.content.backFaceResourceRepeat !==\n newObjectData.content.backFaceResourceRepeat\n ) {\n this.setRepeatTextureOnFace(\n 'back',\n newObjectData.content.backFaceResourceRepeat || false\n );\n }\n if (\n oldObjectData.content.leftFaceResourceRepeat !==\n newObjectData.content.leftFaceResourceRepeat\n ) {\n this.setRepeatTextureOnFace(\n 'left',\n newObjectData.content.leftFaceResourceRepeat || false\n );\n }\n if (\n oldObjectData.content.rightFaceResourceRepeat !==\n newObjectData.content.rightFaceResourceRepeat\n ) {\n this.setRepeatTextureOnFace(\n 'right',\n newObjectData.content.rightFaceResourceRepeat || false\n );\n }\n if (\n oldObjectData.content.topFaceResourceRepeat !==\n newObjectData.content.topFaceResourceRepeat\n ) {\n this.setRepeatTextureOnFace(\n 'top',\n newObjectData.content.topFaceResourceRepeat || false\n );\n }\n if (\n oldObjectData.content.bottomFaceResourceRepeat !==\n newObjectData.content.bottomFaceResourceRepeat\n ) {\n this.setRepeatTextureOnFace(\n 'bottom',\n newObjectData.content.bottomFaceResourceRepeat || false\n );\n }\n if (\n oldObjectData.content.backFaceUpThroughWhichAxisRotation !==\n newObjectData.content.backFaceUpThroughWhichAxisRotation\n ) {\n this.setBackFaceUpThroughWhichAxisRotation(\n newObjectData.content.backFaceUpThroughWhichAxisRotation || 'X'\n );\n }\n if (\n oldObjectData.content.facesOrientation !==\n newObjectData.content.facesOrientation\n ) {\n this.setFacesOrientation(newObjectData.content.facesOrientation || 'Y');\n }\n if (\n oldObjectData.content.materialType !==\n newObjectData.content.materialType\n ) {\n this.setMaterialType(newObjectData.content.materialType);\n }\n\n return true;\n }\n\n getNetworkSyncData(): Cube3DObjectNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n mt: this._materialType,\n fo: this._facesOrientation,\n bfu: this._backFaceUpThroughWhichAxisRotation,\n vfb: this._visibleFacesBitmask,\n trfb: this._textureRepeatFacesBitmask,\n frn: this._faceResourceNames,\n tint: this._tint,\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: Cube3DObjectNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n if (networkSyncData.mt !== undefined) {\n this._materialType = networkSyncData.mt;\n }\n if (networkSyncData.fo !== undefined) {\n if (this._facesOrientation !== networkSyncData.fo) {\n this.setFacesOrientation(networkSyncData.fo);\n }\n }\n if (networkSyncData.bfu !== undefined) {\n if (this._backFaceUpThroughWhichAxisRotation !== networkSyncData.bfu) {\n this.setBackFaceUpThroughWhichAxisRotation(networkSyncData.bfu);\n }\n }\n if (networkSyncData.vfb !== undefined) {\n // If it is different, update all the faces.\n if (this._visibleFacesBitmask !== networkSyncData.vfb) {\n this._visibleFacesBitmask = networkSyncData.vfb;\n for (let i = 0; i < this._faceResourceNames.length; i++) {\n this._renderer.updateFace(i);\n }\n }\n }\n if (networkSyncData.trfb !== undefined) {\n // If it is different, update all the faces.\n if (this._textureRepeatFacesBitmask !== networkSyncData.trfb) {\n this._textureRepeatFacesBitmask = networkSyncData.trfb;\n for (let i = 0; i < this._faceResourceNames.length; i++) {\n this._renderer.updateFace(i);\n }\n }\n }\n if (networkSyncData.frn !== undefined) {\n // If one element is different, update all the faces.\n if (\n !this._faceResourceNames.every(\n (value, index) => value === networkSyncData.frn[index]\n )\n ) {\n this._faceResourceNames = networkSyncData.frn;\n // Update all faces. (Could optimize to only update the changed ones)\n for (let i = 0; i < this._faceResourceNames.length; i++) {\n this._renderer.updateFace(i);\n }\n }\n }\n if (networkSyncData.tint !== undefined) {\n if (this._tint !== networkSyncData.tint) {\n this._tint = networkSyncData.tint;\n this._renderer.updateTint();\n }\n }\n }\n\n /**\n * Return true if the texture transparency should be enabled.\n */\n shouldUseTransparentTexture(): boolean {\n return this._shouldUseTransparentTexture;\n }\n\n _convertMaterialType(\n materialTypeString: string\n ): gdjs.Cube3DRuntimeObject.MaterialType {\n if (materialTypeString === 'StandardWithoutMetalness') {\n return gdjs.Cube3DRuntimeObject.MaterialType.StandardWithoutMetalness;\n } else {\n return gdjs.Cube3DRuntimeObject.MaterialType.Basic;\n }\n }\n\n setMaterialType(materialTypeString: string) {\n const newMaterialType = this._convertMaterialType(materialTypeString);\n if (this._materialType === newMaterialType) {\n return;\n }\n\n this._materialType = newMaterialType;\n this._renderer._updateMaterials();\n }\n }\n\n export namespace Cube3DRuntimeObject {\n export enum MaterialType {\n Basic,\n StandardWithoutMetalness,\n }\n }\n gdjs.registerObject('Scene3D::Cube3DObject', gdjs.Cube3DRuntimeObject);\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CA+BE,KAAM,GAAyB,CAC7B,MAAO,EACP,KAAM,EACN,KAAM,EACN,MAAO,EACP,IAAK,EACL,OAAQ,GAmBH,eAAkC,GAAK,eAAgB,CAoB5D,YACE,EACA,EACA,CACA,MAAM,EAAmB,GAR3B,mBACE,EAAK,oBAAoB,aAAa,MAQtC,KAAK,6BACH,EAAW,QAAQ,2BAA6B,GAClD,KAAK,kBAAoB,EAAW,QAAQ,kBAAoB,IAChE,KAAK,qBAAuB,EACxB,EAAW,QAAQ,kBACrB,MAAK,sBAAwB,GAAK,EAAuB,OACvD,EAAW,QAAQ,iBACrB,MAAK,sBAAwB,GAAK,EAAuB,MACvD,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,IAClD,KAAK,UAAU,WAAW,GAIhC,AAAI,EAAgB,OAAS,QACvB,KAAK,QAAU,EAAgB,MACjC,MAAK,MAAQ,EAAgB,KAC7B,KAAK,UAAU,cAQrB,6BAAuC,CACrC,MAAO,MAAK,6BAGd,qBACE,EACuC,CACvC,MAAI,KAAuB,2BAClB,EAAK,oBAAoB,aAAa,yBAEtC,EAAK,oBAAoB,aAAa,MAIjD,gBAAgB,EAA4B,CAC1C,KAAM,GAAkB,KAAK,qBAAqB,GAClD,AAAI,KAAK,gBAAkB,GAI3B,MAAK,cAAgB,EACrB,KAAK,UAAU,qBA3dZ,EAAM,sBA+dN,SAAU,EAAV,CACE,GAAK,GAAL,UAAK,EAAL,CACL,qBACA,6DAFU,wCADG,qDAMjB,EAAK,eAAe,wBAAyB,EAAK,uBA7hB1C",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- var gdjs;(function(M){const b={3:0,2:1,5:2,4:3,0:4,1:5},r={0:3,1:2,2:5,3:4,4:0,5:1},h={0:[0,0],1:[1,0],2:[0,1],3:[1,1]},_={0:[0,1],1:[0,0],2:[1,1],3:[1,0]};let g;const T=()=>(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={}));
1
+ var gdjs;(function(p){const x={3:0,2:1,5:2,4:3,0:4,1:5},M={0:3,1:2,2:5,3:4,4:0,5:1},n={0:[0,0],1:[1,0],2:[0,1],3:[1,1]},R={0:[0,1],1:[0,0],2:[1,1],3:[1,0]};let g;const _=()=>(g||(g=new THREE.MeshBasicMaterial({transparent:!0,opacity:0,alphaTest:1})),g),T=(h,i)=>h.isFaceAtIndexVisible(i)?h.getInstanceContainer().getGame().getImageManager().getThreeMaterial(h.getFaceAtIndexResourceName(i),{useTransparentTexture:h.shouldUseTransparentTexture(),forceBasicMaterial:h._materialType===p.Cube3DRuntimeObject.MaterialType.Basic,vertexColors:!0}):_();class f extends p.RuntimeObject3DRenderer{constructor(i,t){const o=new THREE.BoxGeometry(1,1,1),m=new Array(6).fill(0).map((e,d)=>T(i,M[d])),b=new THREE.Mesh(o,m);super(i,t,b);this._boxMesh=b,this._cube3DRuntimeObject=i,this.updateSize(),this.updatePosition(),this.updateRotation(),this.updateTint()}updateTint(){const i=[],t=p.rgbOrHexToRGBColor(this._cube3DRuntimeObject.getColor()).map(o=>o/255);for(let o=0;o<this._boxMesh.geometry.attributes.position.count;o++)i.push(...t);this._boxMesh.geometry.setAttribute("color",new THREE.BufferAttribute(new Float32Array(i),3))}updateFace(i){const t=x[i];t!==void 0&&(this._boxMesh.material[t]=T(this._cube3DRuntimeObject,i),this._cube3DRuntimeObject.isFaceAtIndexVisible(i)&&this.updateTextureUvMapping(i))}updateSize(){super.updateSize(),this.updateTextureUvMapping()}updateTextureUvMapping(i){const t=this._boxMesh.geometry.getAttribute("position"),o=this._boxMesh.geometry.getAttribute("uv"),m=i===void 0?0:x[i]*4,b=i===void 0?23:x[i]*4+3;for(let e=m;e<=b;e++){const d=Math.floor(e/4),r=this._boxMesh.material[d];if(!r||!r.map)continue;const c=this._cube3DRuntimeObject.shouldRepeatTextureOnFaceAtIndex(M[d]),u=this._cube3DRuntimeObject.getFacesOrientation()==="Y";let a,s;switch(d){case 0:c?u?(a=-(this._boxMesh.scale.z/r.map.source.data.width)*(t.getZ(e)-.5),s=-(this._boxMesh.scale.y/r.map.source.data.height)*(t.getY(e)+.5)):(a=-(this._boxMesh.scale.y/r.map.source.data.width)*(t.getY(e)-.5),s=this._boxMesh.scale.z/r.map.source.data.height*(t.getZ(e)-.5)):u?[a,s]=n[e%4]:[a,s]=R[e%4];break;case 1:c?u?(a=this._boxMesh.scale.z/r.map.source.data.width*(t.getZ(e)+.5),s=-(this._boxMesh.scale.y/r.map.source.data.height)*(t.getY(e)+.5)):(a=this._boxMesh.scale.y/r.map.source.data.width*(t.getY(e)+.5),s=this._boxMesh.scale.z/r.map.source.data.height*(t.getZ(e)-.5)):u?[a,s]=n[e%4]:([a,s]=R[e%4],a=-a,s=-s);break;case 2:c?(a=this._boxMesh.scale.x/r.map.source.data.width*(t.getX(e)+.5),s=this._boxMesh.scale.z/r.map.source.data.height*(t.getZ(e)-.5)):[a,s]=n[e%4];break;case 3:c?u?(a=this._boxMesh.scale.x/r.map.source.data.width*(t.getX(e)+.5),s=-(this._boxMesh.scale.z/r.map.source.data.height)*(t.getZ(e)+.5)):(a=-(this._boxMesh.scale.x/r.map.source.data.width)*(t.getX(e)-.5),s=this._boxMesh.scale.z/r.map.source.data.height*(t.getZ(e)-.5)):([a,s]=n[e%4],u||(a=-a,s=-s));break;case 4:c?(a=this._boxMesh.scale.x/r.map.source.data.width*(t.getX(e)+.5),s=-(this._boxMesh.scale.y/r.map.source.data.height)*(t.getY(e)+.5)):[a,s]=n[e%4];break;case 5:const l=this._cube3DRuntimeObject.getBackFaceUpThroughWhichAxisRotation()==="X";c?(a=(l?1:-1)*(this._boxMesh.scale.x/r.map.source.data.width)*(t.getX(e)+(l?1:-1)*.5),s=(l?1:-1)*(this._boxMesh.scale.y/r.map.source.data.height)*(t.getY(e)+(l?-1:1)*.5)):([a,s]=n[e%4],l&&(a=-a,s=-s));break;default:[a,s]=n[e%4]}o.setXY(e,a,s)}o.needsUpdate=!0}_updateMaterials(){for(let i=0;i<6;i++)this.updateFace(i)}}p.Cube3DRuntimeObjectRenderer=f})(gdjs||(gdjs={}));
2
2
  //# sourceMappingURL=Cube3DRuntimeObjectPixiRenderer.js.map