gdcore-tools 2.0.0-gd-v5.5.224-autobuild → 2.0.0-gd-v5.5.225-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 (200) 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.map +2 -2
  12. package/dist/Runtime/Extensions/3D/JsExtension.js +219 -108
  13. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js +1 -1
  14. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js.map +2 -2
  15. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js +1 -1
  16. package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js.map +2 -2
  17. package/dist/Runtime/Extensions/AdMob/JsExtension.js +63 -1
  18. package/dist/Runtime/Extensions/AdMob/admobtools.js +1 -1
  19. package/dist/Runtime/Extensions/AdMob/admobtools.js.map +2 -2
  20. package/dist/Runtime/Extensions/AdvancedWindow/electron-advancedwindowtools.js.map +2 -2
  21. package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js +1 -1
  22. package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js.map +2 -2
  23. package/dist/Runtime/Extensions/BBText/JsExtension.js +10 -9
  24. package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js.map +2 -2
  25. package/dist/Runtime/Extensions/BitmapText/JsExtension.js +4 -6
  26. package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject-pixi-renderer.js.map +2 -2
  27. package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js.map +2 -2
  28. package/dist/Runtime/Extensions/DialogueTree/dialoguetools.js.map +2 -2
  29. package/dist/Runtime/Extensions/DraggableBehavior/draggableruntimebehavior.js.map +2 -2
  30. package/dist/Runtime/Extensions/Effects/adjustment-pixi-filter.js.map +2 -2
  31. package/dist/Runtime/Extensions/Effects/advanced-bloom-pixi-filter.js.map +2 -2
  32. package/dist/Runtime/Extensions/Effects/ascii-pixi-filter.js.map +2 -2
  33. package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js.map +2 -2
  34. package/dist/Runtime/Extensions/Effects/black-and-white-pixi-filter.js.map +2 -2
  35. package/dist/Runtime/Extensions/Effects/blending-mode-pixi-filter.js.map +2 -2
  36. package/dist/Runtime/Extensions/Effects/brightness-pixi-filter.js.map +2 -2
  37. package/dist/Runtime/Extensions/Effects/bulge-pinch-pixi-filter.js.map +2 -2
  38. package/dist/Runtime/Extensions/Effects/color-map-pixi-filter.js.map +2 -2
  39. package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js.map +2 -2
  40. package/dist/Runtime/Extensions/Effects/crt-pixi-filter.js.map +2 -2
  41. package/dist/Runtime/Extensions/Effects/displacement-pixi-filter.js.map +2 -2
  42. package/dist/Runtime/Extensions/Effects/dot-pixi-filter.js.map +2 -2
  43. package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js.map +2 -2
  44. package/dist/Runtime/Extensions/Effects/glitch-pixi-filter.js.map +2 -2
  45. package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js.map +2 -2
  46. package/dist/Runtime/Extensions/Effects/godray-pixi-filter.js.map +2 -2
  47. package/dist/Runtime/Extensions/Effects/kawase-blur-pixi-filter.js.map +2 -2
  48. package/dist/Runtime/Extensions/Effects/noise-pixi-filter.js.map +2 -2
  49. package/dist/Runtime/Extensions/Effects/old-film-pixi-filter.js.map +2 -2
  50. package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js.map +2 -2
  51. package/dist/Runtime/Extensions/Effects/pixelate-pixi-filter.js.map +2 -2
  52. package/dist/Runtime/Extensions/Effects/pixi-filters/types/drop-shadow/types.d.ts +10 -4
  53. package/dist/Runtime/Extensions/Effects/radial-blur-pixi-filter.js.map +2 -2
  54. package/dist/Runtime/Extensions/Effects/reflection-pixi-filter.js.map +2 -2
  55. package/dist/Runtime/Extensions/Effects/rgb-split-pixi-filter.js.map +2 -2
  56. package/dist/Runtime/Extensions/Effects/sepia-pixi-filter.js.map +2 -2
  57. package/dist/Runtime/Extensions/Effects/shockwave-pixi-filter.js.map +2 -2
  58. package/dist/Runtime/Extensions/Effects/tilt-shift-pixi-filter.js.map +2 -2
  59. package/dist/Runtime/Extensions/Effects/twist-pixi-filter.js.map +2 -2
  60. package/dist/Runtime/Extensions/Effects/zoom-blur-pixi-filter.js.map +2 -2
  61. package/dist/Runtime/Extensions/ExampleJsExtension/dummyeffect.js.map +2 -2
  62. package/dist/Runtime/Extensions/FacebookInstantGames/facebookinstantgamestools.js.map +2 -2
  63. package/dist/Runtime/Extensions/Firebase/A_firebasejs/firebase.d.ts +5 -4
  64. package/dist/Runtime/Extensions/Firebase/B_firebasetools/D_cloudfirestoretools.js.map +2 -2
  65. package/dist/Runtime/Extensions/Firebase/B_firebasetools/D_remoteconfigtools.js.map +2 -2
  66. package/dist/Runtime/Extensions/Firebase/JsExtension.js +21 -21
  67. package/dist/Runtime/Extensions/JsExtensionTypes.d.ts +1 -0
  68. package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js.map +2 -2
  69. package/dist/Runtime/Extensions/Lighting/JsExtension.js +2 -2
  70. package/dist/Runtime/Extensions/Lighting/lightobstacleruntimebehavior.js.map +2 -2
  71. package/dist/Runtime/Extensions/Lighting/lightruntimeobject-pixi-renderer.js.map +2 -2
  72. package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js.map +2 -2
  73. package/dist/Runtime/Extensions/LinkedObjects/linkedobjects.js.map +2 -2
  74. package/dist/Runtime/Extensions/Multiplayer/JsExtension.js +122 -0
  75. package/dist/Runtime/Extensions/Multiplayer/messageManager.js.map +2 -2
  76. package/dist/Runtime/Extensions/Multiplayer/multiplayerVariablesManager.js.map +2 -2
  77. package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js +1 -1
  78. package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js.map +2 -2
  79. package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js.map +2 -2
  80. package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js +1 -1
  81. package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js.map +2 -2
  82. package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js +1 -1
  83. package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js.map +2 -2
  84. package/dist/Runtime/Extensions/Multiplayer/peerjs.d.ts +8 -10
  85. package/dist/Runtime/Extensions/P2P/peerjs.d.ts +8 -10
  86. package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject-pixi-renderer.js.map +2 -2
  87. package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js.map +2 -2
  88. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js.map +2 -2
  89. package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js.map +2 -2
  90. package/dist/Runtime/Extensions/ParticleSystem/pixi-particles-pixi-renderer.d.ts +2 -1
  91. package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingobstacleruntimebehavior.js.map +2 -2
  92. package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js.map +2 -2
  93. package/dist/Runtime/Extensions/Physics2Behavior/JsExtension.js +106 -106
  94. package/dist/Runtime/Extensions/Physics2Behavior/box2d.d.ts +13 -7
  95. package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
  96. package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js.map +2 -2
  97. package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js +1 -1
  98. package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js.map +2 -2
  99. package/dist/Runtime/Extensions/PhysicsBehavior/physicsruntimebehavior.js.map +2 -2
  100. package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js.map +2 -2
  101. package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js.map +2 -2
  102. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationcomponents.js.map +1 -1
  103. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js +1 -1
  104. package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js.map +2 -2
  105. package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject-pixi-renderer.js.map +2 -2
  106. package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js.map +2 -2
  107. package/dist/Runtime/Extensions/SpatialSound/spatialsoundtools.js +1 -1
  108. package/dist/Runtime/Extensions/SpatialSound/spatialsoundtools.js.map +2 -2
  109. package/dist/Runtime/Extensions/Spine/JsExtension.js +5 -4
  110. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-atlas-manager.js +1 -1
  111. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-atlas-manager.js.map +2 -2
  112. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-manager.js +1 -1
  113. package/dist/Runtime/Extensions/Spine/managers/pixi-spine-manager.js.map +2 -2
  114. package/dist/Runtime/Extensions/Spine/spineruntimeobject-pixi-renderer.js.map +2 -2
  115. package/dist/Runtime/Extensions/Spine/spineruntimeobject.js.map +2 -2
  116. package/dist/Runtime/Extensions/Steamworks/JsExtension.js +12 -12
  117. package/dist/Runtime/Extensions/Steamworks/Z_steamworksinputtools.js.map +2 -2
  118. package/dist/Runtime/Extensions/Steamworks/steamworkstools.js.map +2 -2
  119. package/dist/Runtime/Extensions/TextEntryObject/textentryruntimeobject-pixi-renderer.js.map +2 -2
  120. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js +1 -1
  121. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js.map +2 -2
  122. package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js.map +2 -2
  123. package/dist/Runtime/Extensions/TextObject/textruntimeobject-pixi-renderer.js.map +2 -2
  124. package/dist/Runtime/Extensions/TextObject/textruntimeobject.js.map +2 -2
  125. package/dist/Runtime/Extensions/TileMap/JsExtension.js +20 -18
  126. package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js.map +2 -2
  127. package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js.map +2 -2
  128. package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts +1 -3
  129. package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js.map +2 -2
  130. package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js.map +2 -2
  131. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js.map +1 -1
  132. package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js.map +2 -2
  133. package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject-pixi-renderer.js.map +2 -2
  134. package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js.map +2 -2
  135. package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js.map +2 -2
  136. package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js.map +1 -1
  137. package/dist/Runtime/Extensions/Video/JsExtension.js +2 -1
  138. package/dist/Runtime/Extensions/Video/videoruntimeobject-pixi-renderer.js.map +2 -2
  139. package/dist/Runtime/Extensions/Video/videoruntimeobject.js.map +2 -2
  140. package/dist/Runtime/InAppTutorialMessage.js +6 -0
  141. package/dist/Runtime/InAppTutorialMessage.js.map +7 -0
  142. package/dist/Runtime/Model3DManager.js.map +2 -2
  143. package/dist/Runtime/ResourceLoader.js.map +2 -2
  144. package/dist/Runtime/RuntimeCustomObjectLayer.js +1 -1
  145. package/dist/Runtime/RuntimeCustomObjectLayer.js.map +2 -2
  146. package/dist/Runtime/RuntimeInstanceContainer.js.map +1 -1
  147. package/dist/Runtime/RuntimeLayer.js.map +2 -2
  148. package/dist/Runtime/SpriteAnimator.js.map +2 -2
  149. package/dist/Runtime/affinetransformation.js.map +1 -1
  150. package/dist/Runtime/debugger-client/abstract-debugger-client.js.map +2 -2
  151. package/dist/Runtime/debugger-client/hot-reloader.js +2 -2
  152. package/dist/Runtime/debugger-client/hot-reloader.js.map +2 -2
  153. package/dist/Runtime/debugger-client/websocket-debugger-client.js +1 -1
  154. package/dist/Runtime/debugger-client/websocket-debugger-client.js.map +2 -2
  155. package/dist/Runtime/events-tools/networktools.js +1 -1
  156. package/dist/Runtime/events-tools/networktools.js.map +2 -2
  157. package/dist/Runtime/fontfaceobserver-font-manager/fontfaceobserver-font-manager.js.map +2 -2
  158. package/dist/Runtime/gd.js.map +2 -2
  159. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js +1 -1
  160. package/dist/Runtime/howler-sound-manager/howler-sound-manager.js.map +2 -2
  161. package/dist/Runtime/inputmanager.js.map +2 -2
  162. package/dist/Runtime/jsonmanager.js.map +2 -2
  163. package/dist/Runtime/layer.js.map +2 -2
  164. package/dist/Runtime/libs/nanomarkdown.js +5 -0
  165. package/dist/Runtime/libs/nanomarkdown.js.map +7 -0
  166. package/dist/Runtime/object-capabilities/AnimatableBehavior.js.map +2 -2
  167. package/dist/Runtime/object-capabilities/EffectBehavior.js.map +2 -2
  168. package/dist/Runtime/object-capabilities/FlippableBehavior.js.map +2 -2
  169. package/dist/Runtime/object-capabilities/OpacityBehavior.js.map +2 -2
  170. package/dist/Runtime/object-capabilities/ResizableBehavior.js.map +2 -2
  171. package/dist/Runtime/object-capabilities/ScalableBehavior.js.map +2 -2
  172. package/dist/Runtime/object-capabilities/TextContainerBehavior.js.map +2 -2
  173. package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js.map +2 -2
  174. package/dist/Runtime/pixi-renderers/DebuggerPixiRenderer.js.map +2 -2
  175. package/dist/Runtime/pixi-renderers/layer-pixi-renderer.js.map +2 -2
  176. package/dist/Runtime/pixi-renderers/loadingscreen-pixi-renderer.js.map +2 -2
  177. package/dist/Runtime/pixi-renderers/pixi-bitmapfont-manager.js.map +2 -2
  178. package/dist/Runtime/pixi-renderers/pixi-filters-tools.js.map +2 -2
  179. package/dist/Runtime/pixi-renderers/pixi-image-manager.js +1 -1
  180. package/dist/Runtime/pixi-renderers/pixi-image-manager.js.map +2 -2
  181. package/dist/Runtime/pixi-renderers/pixi.js +123 -177
  182. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js +1 -1
  183. package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js.map +2 -2
  184. package/dist/Runtime/pixi-renderers/runtimescene-pixi-renderer.js.map +2 -2
  185. package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js.map +2 -2
  186. package/dist/Runtime/profiler.js.map +2 -2
  187. package/dist/Runtime/runtimegame.js +1 -1
  188. package/dist/Runtime/runtimegame.js.map +2 -2
  189. package/dist/Runtime/runtimeobject.js +1 -1
  190. package/dist/Runtime/runtimeobject.js.map +2 -2
  191. package/dist/Runtime/runtimescene.js.map +2 -2
  192. package/dist/Runtime/runtimewatermark.js.map +2 -2
  193. package/dist/Runtime/scenestack.js.map +2 -2
  194. package/dist/Runtime/spriteruntimeobject.js.map +2 -2
  195. package/dist/Runtime/variable.js.map +2 -2
  196. package/dist/Runtime/variablescontainer.js.map +2 -2
  197. package/dist/lib/libGD.cjs +1 -1
  198. package/dist/lib/libGD.wasm +0 -0
  199. package/gd.d.ts +2 -0
  200. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/3D/Cube3DRuntimeObjectPixiRenderer.ts"],
4
- "sourcesContent": ["namespace gdjs {\n // Three.js materials for a cube and the order of faces in the object is different,\n // so we keep the mapping from one to the other.\n const faceIndexToMaterialIndex = {\n 3: 0, // right\n 2: 1, // left\n 5: 2, // bottom\n 4: 3, // top\n 0: 4, // front\n 1: 5, // back\n };\n const materialIndexToFaceIndex = {\n 0: 3,\n 1: 2,\n 2: 5,\n 3: 4,\n 4: 0,\n 5: 1,\n };\n\n const noRepeatTextureVertexIndexToUvMapping = {\n 0: [0, 0],\n 1: [1, 0],\n 2: [0, 1],\n 3: [1, 1],\n };\n\n const noRepeatTextureVertexIndexToUvMappingForLeftAndRightFacesTowardsZ = {\n 0: [0, 1],\n 1: [0, 0],\n 2: [1, 1],\n 3: [1, 0],\n };\n\n let transparentMaterial: THREE.MeshBasicMaterial;\n const getTransparentMaterial = () => {\n if (!transparentMaterial)\n transparentMaterial = new THREE.MeshBasicMaterial({\n transparent: true,\n opacity: 0,\n // Set the alpha test to to ensure the faces behind are rendered\n // (no \"back face culling\" that would still be done if alphaTest is not set).\n alphaTest: 1,\n });\n\n return transparentMaterial;\n };\n\n const getFaceMaterial = (\n runtimeObject: gdjs.Cube3DRuntimeObject,\n faceIndex: integer\n ) => {\n if (!runtimeObject.isFaceAtIndexVisible(faceIndex))\n return getTransparentMaterial();\n\n return runtimeObject\n .getInstanceContainer()\n .getGame()\n .getImageManager()\n .getThreeMaterial(runtimeObject.getFaceAtIndexResourceName(faceIndex), {\n useTransparentTexture: runtimeObject.shouldUseTransparentTexture(),\n forceBasicMaterial:\n runtimeObject._materialType ===\n gdjs.Cube3DRuntimeObject.MaterialType.Basic,\n });\n };\n\n class Cube3DRuntimeObjectPixiRenderer extends gdjs.RuntimeObject3DRenderer {\n private _cube3DRuntimeObject: gdjs.Cube3DRuntimeObject;\n private _boxMesh: THREE.Mesh;\n\n constructor(\n runtimeObject: gdjs.Cube3DRuntimeObject,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ) {\n const geometry = new THREE.BoxGeometry(1, 1, 1);\n // TODO (3D) - feature: support color instead of texture?\n const materials = [\n getFaceMaterial(runtimeObject, materialIndexToFaceIndex[0]),\n getFaceMaterial(runtimeObject, materialIndexToFaceIndex[1]),\n getFaceMaterial(runtimeObject, materialIndexToFaceIndex[2]),\n getFaceMaterial(runtimeObject, materialIndexToFaceIndex[3]),\n getFaceMaterial(runtimeObject, materialIndexToFaceIndex[4]),\n getFaceMaterial(runtimeObject, materialIndexToFaceIndex[5]),\n ];\n const boxMesh = new THREE.Mesh(geometry, materials);\n\n super(runtimeObject, instanceContainer, boxMesh);\n this._boxMesh = boxMesh;\n this._cube3DRuntimeObject = runtimeObject;\n\n this.updateSize();\n this.updatePosition();\n this.updateRotation();\n }\n\n updateFace(faceIndex: integer) {\n const materialIndex = faceIndexToMaterialIndex[faceIndex];\n if (materialIndex === undefined) return;\n\n this._boxMesh.material[materialIndex] = getFaceMaterial(\n this._cube3DRuntimeObject,\n faceIndex\n );\n if (this._cube3DRuntimeObject.isFaceAtIndexVisible(faceIndex)) {\n this.updateTextureUvMapping(faceIndex);\n }\n }\n\n updateSize(): void {\n super.updateSize();\n this.updateTextureUvMapping();\n }\n\n /**\n * Updates the UV mapping of the geometry in order to repeat a material\n * over the different faces of the cube.\n * The mesh must be configured with a list of materials in order\n * for the method to work.\n * @param faceIndex The face index to update. If undefined, updates all the faces.\n */\n updateTextureUvMapping(faceIndex?: number) {\n // @ts-ignore - position is stored as a Float32BufferAttribute\n const pos: THREE.BufferAttribute = this._boxMesh.geometry.getAttribute(\n 'position'\n );\n // @ts-ignore - uv is stored as a Float32BufferAttribute\n const uvMapping: THREE.BufferAttribute = this._boxMesh.geometry.getAttribute(\n 'uv'\n );\n const startIndex =\n faceIndex === undefined ? 0 : faceIndexToMaterialIndex[faceIndex] * 4;\n const endIndex =\n faceIndex === undefined\n ? 23\n : faceIndexToMaterialIndex[faceIndex] * 4 + 3;\n for (\n let vertexIndex = startIndex;\n vertexIndex <= endIndex;\n vertexIndex++\n ) {\n const materialIndex = Math.floor(\n vertexIndex /\n // Each face of the cube has 4 points\n 4\n );\n const material = this._boxMesh.material[materialIndex];\n if (!material || !material.map) {\n continue;\n }\n\n const shouldRepeatTexture = this._cube3DRuntimeObject.shouldRepeatTextureOnFaceAtIndex(\n materialIndexToFaceIndex[materialIndex]\n );\n\n const shouldOrientateFacesTowardsY =\n this._cube3DRuntimeObject.getFacesOrientation() === 'Y';\n\n let x: float, y: float;\n switch (materialIndex) {\n case 0:\n // Right face\n if (shouldRepeatTexture) {\n if (shouldOrientateFacesTowardsY) {\n x =\n -(this._boxMesh.scale.z / material.map.source.data.width) *\n (pos.getZ(vertexIndex) - 0.5);\n y =\n -(this._boxMesh.scale.y / material.map.source.data.height) *\n (pos.getY(vertexIndex) + 0.5);\n } else {\n x =\n -(this._boxMesh.scale.y / material.map.source.data.width) *\n (pos.getY(vertexIndex) - 0.5);\n y =\n (this._boxMesh.scale.z / material.map.source.data.height) *\n (pos.getZ(vertexIndex) - 0.5);\n }\n } else {\n if (shouldOrientateFacesTowardsY) {\n [x, y] = noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];\n } else {\n [\n x,\n y,\n ] = noRepeatTextureVertexIndexToUvMappingForLeftAndRightFacesTowardsZ[\n vertexIndex % 4\n ];\n }\n }\n break;\n case 1:\n // Left face\n if (shouldRepeatTexture) {\n if (shouldOrientateFacesTowardsY) {\n x =\n (this._boxMesh.scale.z / material.map.source.data.width) *\n (pos.getZ(vertexIndex) + 0.5);\n y =\n -(this._boxMesh.scale.y / material.map.source.data.height) *\n (pos.getY(vertexIndex) + 0.5);\n } else {\n x =\n (this._boxMesh.scale.y / material.map.source.data.width) *\n (pos.getY(vertexIndex) + 0.5);\n y =\n (this._boxMesh.scale.z / material.map.source.data.height) *\n (pos.getZ(vertexIndex) - 0.5);\n }\n } else {\n if (shouldOrientateFacesTowardsY) {\n [x, y] = noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];\n } else {\n [\n x,\n y,\n ] = noRepeatTextureVertexIndexToUvMappingForLeftAndRightFacesTowardsZ[\n vertexIndex % 4\n ];\n x = -x;\n y = -y;\n }\n }\n break;\n case 2:\n // Bottom face\n if (shouldRepeatTexture) {\n x =\n (this._boxMesh.scale.x / material.map.source.data.width) *\n (pos.getX(vertexIndex) + 0.5);\n y =\n (this._boxMesh.scale.z / material.map.source.data.height) *\n (pos.getZ(vertexIndex) - 0.5);\n } else {\n [x, y] = noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];\n }\n break;\n case 3:\n // Top face\n if (shouldRepeatTexture) {\n if (shouldOrientateFacesTowardsY) {\n x =\n (this._boxMesh.scale.x / material.map.source.data.width) *\n (pos.getX(vertexIndex) + 0.5);\n y =\n -(this._boxMesh.scale.z / material.map.source.data.height) *\n (pos.getZ(vertexIndex) + 0.5);\n } else {\n x =\n -(this._boxMesh.scale.x / material.map.source.data.width) *\n (pos.getX(vertexIndex) - 0.5);\n y =\n (this._boxMesh.scale.z / material.map.source.data.height) *\n (pos.getZ(vertexIndex) - 0.5);\n }\n } else {\n [x, y] = noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];\n if (!shouldOrientateFacesTowardsY) {\n x = -x;\n y = -y;\n }\n }\n break;\n case 4:\n // Front face\n if (shouldRepeatTexture) {\n x =\n (this._boxMesh.scale.x / material.map.source.data.width) *\n (pos.getX(vertexIndex) + 0.5);\n y =\n -(this._boxMesh.scale.y / material.map.source.data.height) *\n (pos.getY(vertexIndex) + 0.5);\n } else {\n [x, y] = noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];\n }\n break;\n case 5:\n // Back face\n const shouldBackFaceBeUpThroughXAxisRotation =\n this._cube3DRuntimeObject.getBackFaceUpThroughWhichAxisRotation() ===\n 'X';\n\n if (shouldRepeatTexture) {\n x =\n (shouldBackFaceBeUpThroughXAxisRotation ? 1 : -1) *\n (this._boxMesh.scale.x / material.map.source.data.width) *\n (pos.getX(vertexIndex) +\n (shouldBackFaceBeUpThroughXAxisRotation ? 1 : -1) * 0.5);\n y =\n (shouldBackFaceBeUpThroughXAxisRotation ? 1 : -1) *\n (this._boxMesh.scale.y / material.map.source.data.height) *\n (pos.getY(vertexIndex) +\n (shouldBackFaceBeUpThroughXAxisRotation ? -1 : 1) * 0.5);\n } else {\n [x, y] = noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];\n if (shouldBackFaceBeUpThroughXAxisRotation) {\n x = -x;\n y = -y;\n }\n }\n break;\n default:\n [x, y] = noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];\n }\n uvMapping.setXY(vertexIndex, x, y);\n }\n uvMapping.needsUpdate = true;\n }\n\n _updateMaterials() {\n for (let index = 0; index < 6; index++) {\n this.updateFace(index);\n }\n }\n }\n\n export const Cube3DRuntimeObjectRenderer = Cube3DRuntimeObjectPixiRenderer;\n export type Cube3DRuntimeObjectRenderer = Cube3DRuntimeObjectPixiRenderer;\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAGE,KAAM,GAA2B,CAC/B,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,GAEC,EAA2B,CAC/B,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,GAGC,EAAwC,CAC5C,EAAG,CAAC,EAAG,GACP,EAAG,CAAC,EAAG,GACP,EAAG,CAAC,EAAG,GACP,EAAG,CAAC,EAAG,IAGH,EAAoE,CACxE,EAAG,CAAC,EAAG,GACP,EAAG,CAAC,EAAG,GACP,EAAG,CAAC,EAAG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U,MAAM,EAAa,EAAG,GAElC,EAAU,YAAc,GAG1B,kBAAmB,CACjB,OAAS,GAAQ,EAAG,EAAQ,EAAG,IAC7B,KAAK,WAAW,IAKf,AAAM,8BAA8B,IA5TnC",
4
+ "sourcesContent": ["namespace gdjs {\n // Three.js materials for a cube and the order of faces in the object is different,\n // so we keep the mapping from one to the other.\n const faceIndexToMaterialIndex = {\n 3: 0, // right\n 2: 1, // left\n 5: 2, // bottom\n 4: 3, // top\n 0: 4, // front\n 1: 5, // back\n };\n const materialIndexToFaceIndex = {\n 0: 3,\n 1: 2,\n 2: 5,\n 3: 4,\n 4: 0,\n 5: 1,\n };\n\n const noRepeatTextureVertexIndexToUvMapping = {\n 0: [0, 0],\n 1: [1, 0],\n 2: [0, 1],\n 3: [1, 1],\n };\n\n const noRepeatTextureVertexIndexToUvMappingForLeftAndRightFacesTowardsZ = {\n 0: [0, 1],\n 1: [0, 0],\n 2: [1, 1],\n 3: [1, 0],\n };\n\n let transparentMaterial: THREE.MeshBasicMaterial;\n const getTransparentMaterial = () => {\n if (!transparentMaterial)\n transparentMaterial = new THREE.MeshBasicMaterial({\n transparent: true,\n opacity: 0,\n // Set the alpha test to to ensure the faces behind are rendered\n // (no \"back face culling\" that would still be done if alphaTest is not set).\n alphaTest: 1,\n });\n\n return transparentMaterial;\n };\n\n const getFaceMaterial = (\n runtimeObject: gdjs.Cube3DRuntimeObject,\n faceIndex: integer\n ) => {\n if (!runtimeObject.isFaceAtIndexVisible(faceIndex))\n return getTransparentMaterial();\n\n return runtimeObject\n .getInstanceContainer()\n .getGame()\n .getImageManager()\n .getThreeMaterial(runtimeObject.getFaceAtIndexResourceName(faceIndex), {\n useTransparentTexture: runtimeObject.shouldUseTransparentTexture(),\n forceBasicMaterial:\n runtimeObject._materialType ===\n gdjs.Cube3DRuntimeObject.MaterialType.Basic,\n });\n };\n\n class Cube3DRuntimeObjectPixiRenderer extends gdjs.RuntimeObject3DRenderer {\n private _cube3DRuntimeObject: gdjs.Cube3DRuntimeObject;\n private _boxMesh: THREE.Mesh;\n\n constructor(\n runtimeObject: gdjs.Cube3DRuntimeObject,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ) {\n const geometry = new THREE.BoxGeometry(1, 1, 1);\n\n const materials: THREE.Material[] = new Array(6)\n .fill(0)\n .map((_, index) =>\n getFaceMaterial(runtimeObject, materialIndexToFaceIndex[index])\n );\n\n const boxMesh = new THREE.Mesh(geometry, materials);\n\n super(runtimeObject, instanceContainer, boxMesh);\n this._boxMesh = boxMesh;\n this._cube3DRuntimeObject = runtimeObject;\n\n this.updateSize();\n this.updatePosition();\n this.updateRotation();\n this.updateTint();\n }\n\n updateTint() {\n const tints: number[] = [];\n\n const normalizedTint = gdjs\n .rgbOrHexToRGBColor(this._cube3DRuntimeObject.getColor())\n .map((component) => component / 255);\n\n for (\n let i = 0;\n i < this._boxMesh.geometry.attributes.position.count;\n i++\n ) {\n tints.push(...normalizedTint);\n }\n\n this._boxMesh.geometry.setAttribute(\n 'color',\n new THREE.BufferAttribute(new Float32Array(tints), 3)\n );\n }\n\n updateFace(faceIndex: integer) {\n const materialIndex = faceIndexToMaterialIndex[faceIndex];\n if (materialIndex === undefined) return;\n\n this._boxMesh.material[materialIndex] = getFaceMaterial(\n this._cube3DRuntimeObject,\n faceIndex\n );\n if (this._cube3DRuntimeObject.isFaceAtIndexVisible(faceIndex)) {\n this.updateTextureUvMapping(faceIndex);\n }\n }\n\n updateSize(): void {\n super.updateSize();\n this.updateTextureUvMapping();\n }\n\n /**\n * Updates the UV mapping of the geometry in order to repeat a material\n * over the different faces of the cube.\n * The mesh must be configured with a list of materials in order\n * for the method to work.\n * @param faceIndex The face index to update. If undefined, updates all the faces.\n */\n updateTextureUvMapping(faceIndex?: number) {\n // @ts-ignore - position is stored as a Float32BufferAttribute\n const pos: THREE.BufferAttribute =\n this._boxMesh.geometry.getAttribute('position');\n // @ts-ignore - uv is stored as a Float32BufferAttribute\n const uvMapping: THREE.BufferAttribute =\n this._boxMesh.geometry.getAttribute('uv');\n const startIndex =\n faceIndex === undefined ? 0 : faceIndexToMaterialIndex[faceIndex] * 4;\n const endIndex =\n faceIndex === undefined\n ? 23\n : faceIndexToMaterialIndex[faceIndex] * 4 + 3;\n for (\n let vertexIndex = startIndex;\n vertexIndex <= endIndex;\n vertexIndex++\n ) {\n const materialIndex = Math.floor(\n vertexIndex /\n // Each face of the cube has 4 points\n 4\n );\n const material = this._boxMesh.material[materialIndex];\n if (!material || !material.map) {\n continue;\n }\n\n const shouldRepeatTexture =\n this._cube3DRuntimeObject.shouldRepeatTextureOnFaceAtIndex(\n materialIndexToFaceIndex[materialIndex]\n );\n\n const shouldOrientateFacesTowardsY =\n this._cube3DRuntimeObject.getFacesOrientation() === 'Y';\n\n let x: float, y: float;\n switch (materialIndex) {\n case 0:\n // Right face\n if (shouldRepeatTexture) {\n if (shouldOrientateFacesTowardsY) {\n x =\n -(this._boxMesh.scale.z / material.map.source.data.width) *\n (pos.getZ(vertexIndex) - 0.5);\n y =\n -(this._boxMesh.scale.y / material.map.source.data.height) *\n (pos.getY(vertexIndex) + 0.5);\n } else {\n x =\n -(this._boxMesh.scale.y / material.map.source.data.width) *\n (pos.getY(vertexIndex) - 0.5);\n y =\n (this._boxMesh.scale.z / material.map.source.data.height) *\n (pos.getZ(vertexIndex) - 0.5);\n }\n } else {\n if (shouldOrientateFacesTowardsY) {\n [x, y] = noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];\n } else {\n [x, y] =\n noRepeatTextureVertexIndexToUvMappingForLeftAndRightFacesTowardsZ[\n vertexIndex % 4\n ];\n }\n }\n break;\n case 1:\n // Left face\n if (shouldRepeatTexture) {\n if (shouldOrientateFacesTowardsY) {\n x =\n (this._boxMesh.scale.z / material.map.source.data.width) *\n (pos.getZ(vertexIndex) + 0.5);\n y =\n -(this._boxMesh.scale.y / material.map.source.data.height) *\n (pos.getY(vertexIndex) + 0.5);\n } else {\n x =\n (this._boxMesh.scale.y / material.map.source.data.width) *\n (pos.getY(vertexIndex) + 0.5);\n y =\n (this._boxMesh.scale.z / material.map.source.data.height) *\n (pos.getZ(vertexIndex) - 0.5);\n }\n } else {\n if (shouldOrientateFacesTowardsY) {\n [x, y] = noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];\n } else {\n [x, y] =\n noRepeatTextureVertexIndexToUvMappingForLeftAndRightFacesTowardsZ[\n vertexIndex % 4\n ];\n x = -x;\n y = -y;\n }\n }\n break;\n case 2:\n // Bottom face\n if (shouldRepeatTexture) {\n x =\n (this._boxMesh.scale.x / material.map.source.data.width) *\n (pos.getX(vertexIndex) + 0.5);\n y =\n (this._boxMesh.scale.z / material.map.source.data.height) *\n (pos.getZ(vertexIndex) - 0.5);\n } else {\n [x, y] = noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];\n }\n break;\n case 3:\n // Top face\n if (shouldRepeatTexture) {\n if (shouldOrientateFacesTowardsY) {\n x =\n (this._boxMesh.scale.x / material.map.source.data.width) *\n (pos.getX(vertexIndex) + 0.5);\n y =\n -(this._boxMesh.scale.z / material.map.source.data.height) *\n (pos.getZ(vertexIndex) + 0.5);\n } else {\n x =\n -(this._boxMesh.scale.x / material.map.source.data.width) *\n (pos.getX(vertexIndex) - 0.5);\n y =\n (this._boxMesh.scale.z / material.map.source.data.height) *\n (pos.getZ(vertexIndex) - 0.5);\n }\n } else {\n [x, y] = noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];\n if (!shouldOrientateFacesTowardsY) {\n x = -x;\n y = -y;\n }\n }\n break;\n case 4:\n // Front face\n if (shouldRepeatTexture) {\n x =\n (this._boxMesh.scale.x / material.map.source.data.width) *\n (pos.getX(vertexIndex) + 0.5);\n y =\n -(this._boxMesh.scale.y / material.map.source.data.height) *\n (pos.getY(vertexIndex) + 0.5);\n } else {\n [x, y] = noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];\n }\n break;\n case 5:\n // Back face\n const shouldBackFaceBeUpThroughXAxisRotation =\n this._cube3DRuntimeObject.getBackFaceUpThroughWhichAxisRotation() ===\n 'X';\n\n if (shouldRepeatTexture) {\n x =\n (shouldBackFaceBeUpThroughXAxisRotation ? 1 : -1) *\n (this._boxMesh.scale.x / material.map.source.data.width) *\n (pos.getX(vertexIndex) +\n (shouldBackFaceBeUpThroughXAxisRotation ? 1 : -1) * 0.5);\n y =\n (shouldBackFaceBeUpThroughXAxisRotation ? 1 : -1) *\n (this._boxMesh.scale.y / material.map.source.data.height) *\n (pos.getY(vertexIndex) +\n (shouldBackFaceBeUpThroughXAxisRotation ? -1 : 1) * 0.5);\n } else {\n [x, y] = noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];\n if (shouldBackFaceBeUpThroughXAxisRotation) {\n x = -x;\n y = -y;\n }\n }\n break;\n default:\n [x, y] = noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];\n }\n uvMapping.setXY(vertexIndex, x, y);\n }\n uvMapping.needsUpdate = true;\n }\n\n _updateMaterials() {\n for (let index = 0; index < 6; index++) {\n this.updateFace(index);\n }\n }\n }\n\n export const Cube3DRuntimeObjectRenderer = Cube3DRuntimeObjectPixiRenderer;\n export type Cube3DRuntimeObjectRenderer = Cube3DRuntimeObjectPixiRenderer;\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAGE,KAAM,GAA2B,CAC/B,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,GAEC,EAA2B,CAC/B,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,GAGC,EAAwC,CAC5C,EAAG,CAAC,EAAG,GACP,EAAG,CAAC,EAAG,GACP,EAAG,CAAC,EAAG,GACP,EAAG,CAAC,EAAG,IAGH,EAAoE,CACxE,EAAG,CAAC,EAAG,GACP,EAAG,CAAC,EAAG,GACP,EAAG,CAAC,EAAG,GACP,EAAG,CAAC,EAAG,IAGT,GAAI,GACJ,KAAM,GAAyB,IACxB,IACH,GAAsB,GA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EAAG,GAAK,EAAsC,EAAc,GACzD,GACF,GAAI,CAAC,EACL,EAAI,CAAC,IAGT,cAEA,CAAC,EAAG,GAAK,EAAsC,EAAc,GAEjE,EAAU,MAAM,EAAa,EAAG,GAElC,EAAU,YAAc,GAG1B,kBAAmB,CACjB,OAAS,GAAQ,EAAG,EAAQ,EAAG,IAC7B,KAAK,WAAW,IAKf,AAAM,8BAA8B,IA3UnC",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/3D/CustomRuntimeObject3D.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 /**\n * Base class for 3D custom objects.\n */\n export class CustomRuntimeObject3D\n extends gdjs.CustomRuntimeObject\n implements gdjs.Base3DHandler {\n /**\n * Position on the Z axis.\n */\n private _z: float = 0;\n private _minZ: float = 0;\n private _maxZ: float = 0;\n private _scaleZ: float = 1;\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 _customCenterZ: float = 0;\n private static _temporaryVector = new THREE.Vector3();\n\n constructor(\n parent: gdjs.RuntimeInstanceContainer,\n objectData: Object3DData & CustomObjectConfiguration\n ) {\n super(parent, objectData);\n this._renderer.reinitialize(this, parent);\n }\n\n protected _createRender() {\n const parent = this._runtimeScene;\n return new gdjs.CustomRuntimeObject3DRenderer(\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.CustomRuntimeObject3DRenderer {\n return super.getRenderer() as gdjs.CustomRuntimeObject3DRenderer;\n }\n\n get3DRendererObject() {\n // It can't be null because Three.js is always loaded\n // when a custom 3D object is used.\n return this.getRenderer().get3DRendererObject()!;\n }\n\n extraInitializationFromInitialInstance(initialInstanceData: InstanceData) {\n super.extraInitializationFromInitialInstance(initialInstanceData);\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 /**\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 let minZ = 0;\n if (this._innerArea) {\n minZ = this._innerArea.min[2];\n } else {\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n minZ = this._minZ;\n }\n const absScaleZ = this.getScaleZ();\n if (!this._flippedZ) {\n return this._z + minZ * absScaleZ;\n } else {\n return (\n this._z +\n (-minZ - this.getUnscaledDepth() + 2 * this.getUnscaledCenterZ()) *\n absScaleZ\n );\n }\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 /**\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 * 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.CustomRuntimeObject3D._temporaryVector;\n axisX.set(1, 0, 0);\n\n const mesh = this.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.CustomRuntimeObject3D._temporaryVector;\n axisY.set(0, 1, 0);\n\n const mesh = this.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.CustomRuntimeObject3D._temporaryVector;\n axisZ.set(0, 0, 1);\n\n const mesh = this.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 /**\n * @return the internal top bound of the object according to its children.\n */\n getInnerAreaMinZ(): number {\n if (this._innerArea) {\n return this._innerArea.min[2];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._minZ;\n }\n\n /**\n * @return the internal bottom bound of the object according to its children.\n */\n getInnerAreaMaxZ(): number {\n if (this._innerArea) {\n return this._innerArea.max[2];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._maxZ;\n }\n\n /**\n * @return the internal width of the object according to its children.\n */\n getUnscaledDepth(): float {\n if (this._innerArea) {\n return this._innerArea.max[2] - this._innerArea.min[2];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._maxZ - this._minZ;\n }\n\n _updateUntransformedHitBoxes(): void {\n super._updateUntransformedHitBoxes();\n\n let minZ = Number.MAX_VALUE;\n let maxZ = -Number.MAX_VALUE;\n for (const childInstance of this._instanceContainer.getAdhocListOfAllInstances()) {\n if (!childInstance.isIncludedInParentCollisionMask()) {\n continue;\n }\n if (!gdjs.Base3DHandler.is3D(childInstance)) {\n continue;\n }\n minZ = Math.min(minZ, childInstance.getUnrotatedAABBMinZ());\n maxZ = Math.max(maxZ, childInstance.getUnrotatedAABBMaxZ());\n }\n if (minZ === Number.MAX_VALUE) {\n // The unscaled size can't be 0 because setWidth and setHeight wouldn't\n // have any effect.\n minZ = 0;\n maxZ = 1;\n }\n this._minZ = minZ;\n this._maxZ = maxZ;\n }\n\n /**\n * @returns the center Z from the local origin (0;0).\n */\n getUnscaledCenterZ(): float {\n if (this.hasCustomRotationCenter()) {\n return this._customCenterZ;\n }\n if (this._innerArea) {\n return (this._innerArea.min[2] + this._innerArea.max[2]) / 2;\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return (this._minZ + this._maxZ) / 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 setRotationCenter3D(x: float, y: float, z: float) {\n this._customCenterZ = z;\n this.setRotationCenter(x, y);\n }\n\n /**\n * Get the object size on the Z axis (called \"depth\").\n */\n getDepth(): float {\n return this.getUnscaledDepth() * this.getScaleZ();\n }\n\n /**\n * Set the object size on the Z axis (called \"depth\").\n */\n setDepth(depth: float): void {\n const unscaledDepth = this.getUnscaledDepth();\n if (unscaledDepth === 0) {\n return;\n }\n const scaleZ = depth / unscaledDepth;\n if (this._innerArea && this._isInnerAreaFollowingParentSize) {\n this._innerArea.min[2] *= scaleZ;\n this._innerArea.max[2] *= scaleZ;\n } else {\n this.setScaleZ(scaleZ);\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 super.setScale(newScale);\n this.setScaleZ(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 (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._scaleZ)) {\n return;\n }\n this._scaleZ = newScale * (this._flippedZ ? -1 : 1);\n this.getRenderer().updateSize();\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 Z axis.\n *\n * @return the scale of the object on Z axis\n */\n getScaleZ(): float {\n return Math.abs(this._scaleZ);\n }\n\n flipZ(enable: boolean) {\n if (enable === this._flippedZ) {\n return;\n }\n this._flippedZ = enable;\n this.getRenderer().updateSize();\n }\n\n isFlippedZ(): boolean {\n return this._flippedZ;\n }\n }\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAeS,eACG,GAAK,mBACiB,CAwB9B,YACE,EACA,EACA,CACA,MAAM,EAAQ,GAxBR,QAAY,EACZ,WAAe,EACf,WAAe,EACf,aAAiB,EACjB,eAAqB,GAMrB,gBAAoB,EAMpB,gBAAoB,EACpB,oBAAwB,EAQ9B,KAAK,UAAU,aAAa,KAAM,GAG1B,eAAgB,CACxB,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,qBAAsB,CAGpB,MAAO,MAAK,cAAc,sBAG5B,uCAAuC,EAAmC,CACxE,MAAM,uCAAuC,GACzC,EAAoB,QAAU,QAChC,KAAK,SAAS,EAAoB,OAEhC,EAAoB,UACtB,KAAK,MAAM,EAAoB,UAE7B,EAAoB,UACtB,KAAK,MAAM,EAAoB,UAE7B,EAAoB,UACtB,KAAK,MAAM,EAAoB,U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AU,EAAU,CAChD,KAAK,eAAiB,EACtB,KAAK,kBAAkB,EAAG,GAM5B,UAAkB,CAChB,MAAO,MAAK,mBAAqB,KAAK,YAMxC,SAAS,EAAoB,CAC3B,KAAM,GAAgB,KAAK,mBAC3B,GAAI,IAAkB,EACpB,OAEF,KAAM,GAAS,EAAQ,EACvB,AAAI,KAAK,YAAc,KAAK,gCAC1B,MAAK,WAAW,IAAI,IAAM,EAC1B,KAAK,WAAW,IAAI,IAAM,GAE1B,KAAK,UAAU,GASnB,SAAS,EAAwB,CAC/B,MAAM,SAAS,GACf,KAAK,UAAU,GAQjB,UAAU,EAAwB,CAChC,AAAI,KAAK,YAAc,KAAK,iCAIxB,GAAW,GACb,GAAW,GAET,IAAa,KAAK,IAAI,KAAK,UAG/B,MAAK,QAAU,EAAY,MAAK,UAAY,GAAK,GACjD,KAAK,cAAc,eAQrB,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,SAGvB,MAAM,EAAiB,CACrB,AAAI,IAAW,KAAK,WAGpB,MAAK,UAAY,EACjB,KAAK,cAAc,cAGrB,YAAsB,CACpB,MAAO,MAAK,WA9YC,AAxBV,EAwBU,iBAAmB,GAAI,OAAM,QAxBvC,EAAM,0BAfL",
4
+ "sourcesContent": ["namespace gdjs {\n /**\n * Base class for 3D custom objects.\n */\n export class CustomRuntimeObject3D\n extends gdjs.CustomRuntimeObject\n implements gdjs.Base3DHandler\n {\n /**\n * Position on the Z axis.\n */\n private _z: float = 0;\n private _minZ: float = 0;\n private _maxZ: float = 0;\n private _scaleZ: float = 1;\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 _customCenterZ: float = 0;\n private static _temporaryVector = new THREE.Vector3();\n\n constructor(\n parent: gdjs.RuntimeInstanceContainer,\n objectData: gdjs.Object3DData & gdjs.CustomObjectConfiguration\n ) {\n super(parent, objectData);\n this._renderer.reinitialize(this, parent);\n }\n\n protected override _createRender() {\n const parent = this._runtimeScene;\n return new gdjs.CustomRuntimeObject3DRenderer(\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.CustomRuntimeObject3DRenderer {\n return super.getRenderer() as gdjs.CustomRuntimeObject3DRenderer;\n }\n\n override get3DRendererObject() {\n // It can't be null because Three.js is always loaded\n // when a custom 3D object is used.\n return this.getRenderer().get3DRendererObject()!;\n }\n\n override extraInitializationFromInitialInstance(\n initialInstanceData: InstanceData\n ) {\n super.extraInitializationFromInitialInstance(initialInstanceData);\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 /**\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 let minZ = 0;\n if (this._innerArea) {\n minZ = this._innerArea.min[2];\n } else {\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n minZ = this._minZ;\n }\n const absScaleZ = this.getScaleZ();\n if (!this._flippedZ) {\n return this._z + minZ * absScaleZ;\n } else {\n return (\n this._z +\n (-minZ - this.getUnscaledDepth() + 2 * this.getUnscaledCenterZ()) *\n absScaleZ\n );\n }\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 /**\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 * 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.CustomRuntimeObject3D._temporaryVector;\n axisX.set(1, 0, 0);\n\n const mesh = this.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.CustomRuntimeObject3D._temporaryVector;\n axisY.set(0, 1, 0);\n\n const mesh = this.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.CustomRuntimeObject3D._temporaryVector;\n axisZ.set(0, 0, 1);\n\n const mesh = this.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 /**\n * @return the internal top bound of the object according to its children.\n */\n getInnerAreaMinZ(): number {\n if (this._innerArea) {\n return this._innerArea.min[2];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._minZ;\n }\n\n /**\n * @return the internal bottom bound of the object according to its children.\n */\n getInnerAreaMaxZ(): number {\n if (this._innerArea) {\n return this._innerArea.max[2];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._maxZ;\n }\n\n /**\n * @return the internal width of the object according to its children.\n */\n getUnscaledDepth(): float {\n if (this._innerArea) {\n return this._innerArea.max[2] - this._innerArea.min[2];\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return this._maxZ - this._minZ;\n }\n\n override _updateUntransformedHitBoxes(): void {\n super._updateUntransformedHitBoxes();\n\n let minZ = Number.MAX_VALUE;\n let maxZ = -Number.MAX_VALUE;\n for (const childInstance of this._instanceContainer.getAdhocListOfAllInstances()) {\n if (!childInstance.isIncludedInParentCollisionMask()) {\n continue;\n }\n if (!gdjs.Base3DHandler.is3D(childInstance)) {\n continue;\n }\n minZ = Math.min(minZ, childInstance.getUnrotatedAABBMinZ());\n maxZ = Math.max(maxZ, childInstance.getUnrotatedAABBMaxZ());\n }\n if (minZ === Number.MAX_VALUE) {\n // The unscaled size can't be 0 because setWidth and setHeight wouldn't\n // have any effect.\n minZ = 0;\n maxZ = 1;\n }\n this._minZ = minZ;\n this._maxZ = maxZ;\n }\n\n /**\n * @returns the center Z from the local origin (0;0).\n */\n getUnscaledCenterZ(): float {\n if (this.hasCustomRotationCenter()) {\n return this._customCenterZ;\n }\n if (this._innerArea) {\n return (this._innerArea.min[2] + this._innerArea.max[2]) / 2;\n }\n if (this._isUntransformedHitBoxesDirty) {\n this._updateUntransformedHitBoxes();\n }\n return (this._minZ + this._maxZ) / 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 setRotationCenter3D(x: float, y: float, z: float) {\n this._customCenterZ = z;\n this.setRotationCenter(x, y);\n }\n\n /**\n * Get the object size on the Z axis (called \"depth\").\n */\n getDepth(): float {\n return this.getUnscaledDepth() * this.getScaleZ();\n }\n\n /**\n * Set the object size on the Z axis (called \"depth\").\n */\n setDepth(depth: float): void {\n const unscaledDepth = this.getUnscaledDepth();\n if (unscaledDepth === 0) {\n return;\n }\n const scaleZ = depth / unscaledDepth;\n if (this._innerArea && this._isInnerAreaFollowingParentSize) {\n this._innerArea.min[2] *= scaleZ;\n this._innerArea.max[2] *= scaleZ;\n } else {\n this.setScaleZ(scaleZ);\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 super.setScale(newScale);\n this.setScaleZ(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 (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._scaleZ)) {\n return;\n }\n this._scaleZ = newScale * (this._flippedZ ? -1 : 1);\n this.getRenderer().updateSize();\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 Z axis.\n *\n * @return the scale of the object on Z axis\n */\n getScaleZ(): float {\n return Math.abs(this._scaleZ);\n }\n\n flipZ(enable: boolean) {\n if (enable === this._flippedZ) {\n return;\n }\n this._flippedZ = enable;\n this.getRenderer().updateSize();\n }\n\n isFlippedZ(): boolean {\n return this._flippedZ;\n }\n }\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAIS,eACG,GAAK,mBAEf,CAwBE,YACE,EACA,EACA,CACA,MAAM,EAAQ,GAxBR,QAAY,EACZ,WAAe,EACf,WAAe,EACf,aAAiB,EACjB,eAAqB,GAMrB,gBAAoB,EAMpB,gBAAoB,EACpB,oBAAwB,EAQ9B,KAAK,UAAU,aAAa,KAAM,GAGj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AAsB,CACpB,MAAO,MAAK,WAhZC,AAzBV,EAyBU,iBAAmB,GAAI,OAAM,QAzBvC,EAAM,0BAJL",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../GDevelop/Extensions/3D/CustomRuntimeObject3DRenderer.ts"],
4
- "sourcesContent": ["namespace gdjs {\n export interface PixiImageManager {\n _threeAnimationFrameTextureManager: ThreeAnimationFrameTextureManager;\n }\n /**\n * The renderer for a {@link gdjs.CustomRuntimeObject3D} using Three.js.\n */\n export class CustomRuntimeObject3DRenderer\n implements gdjs.RuntimeInstanceContainerRenderer {\n _object: gdjs.CustomRuntimeObject3D;\n _instanceContainer: gdjs.CustomRuntimeObjectInstanceContainer;\n _isContainerDirty: boolean = true;\n _threeGroup: THREE.Group;\n\n constructor(\n object: gdjs.CustomRuntimeObject3D,\n instanceContainer: gdjs.CustomRuntimeObjectInstanceContainer,\n parent: gdjs.RuntimeInstanceContainer\n ) {\n this._object = object;\n this._instanceContainer = instanceContainer;\n\n this._threeGroup = new THREE.Group();\n this._threeGroup.rotation.order = 'ZYX';\n\n const layer = parent.getLayer('');\n if (layer) {\n layer.getRenderer().add3DRendererObject(this._threeGroup);\n }\n }\n\n get3DRendererObject(): THREE.Object3D {\n return this._threeGroup;\n }\n\n getRendererObject() {\n return null;\n }\n\n reinitialize(\n object: gdjs.CustomRuntimeObject3D,\n parent: gdjs.RuntimeInstanceContainer\n ) {\n this._object = object;\n this._isContainerDirty = true;\n const layer = parent.getLayer('');\n if (layer) {\n layer.getRenderer().add3DRendererObject(this._threeGroup);\n }\n }\n\n _updateThreeGroup() {\n const threeObject3D = this.get3DRendererObject();\n\n const scaleX = this._object.getScaleX();\n const scaleY = this._object.getScaleY();\n const scaleZ = this._object.getScaleZ();\n const pivotX = this._object.getUnscaledCenterX() * scaleX;\n const pivotY = this._object.getUnscaledCenterY() * scaleY;\n const pivotZ = this._object.getUnscaledCenterZ() * scaleZ;\n\n threeObject3D.rotation.set(\n gdjs.toRad(this._object.getRotationX()),\n gdjs.toRad(this._object.getRotationY()),\n gdjs.toRad(this._object.angle)\n );\n\n threeObject3D.position.set(\n this._object.isFlippedX() ? pivotX : -pivotX,\n this._object.isFlippedY() ? pivotY : -pivotY,\n this._object.isFlippedZ() ? pivotZ : -pivotZ\n );\n threeObject3D.position.applyEuler(threeObject3D.rotation);\n threeObject3D.position.x += this._object.getX() + pivotX;\n threeObject3D.position.y += this._object.getY() + pivotY;\n threeObject3D.position.z += this._object.getZ() + pivotZ;\n\n threeObject3D.scale.set(\n this._object.isFlippedX() ? -scaleX : scaleX,\n this._object.isFlippedY() ? -scaleY : scaleY,\n this._object.isFlippedZ() ? -scaleZ : scaleZ\n );\n\n threeObject3D.visible = !this._object.hidden;\n\n this._isContainerDirty = false;\n }\n\n /**\n * Call this to make sure the object is ready to be rendered.\n */\n ensureUpToDate() {\n if (this._isContainerDirty) {\n this._updateThreeGroup();\n }\n }\n\n update(): void {\n this._isContainerDirty = true;\n }\n\n updateX(): void {\n this._isContainerDirty = true;\n }\n\n updateY(): void {\n this._isContainerDirty = true;\n }\n\n updateAngle(): void {\n this._isContainerDirty = true;\n }\n\n updatePosition() {\n this._isContainerDirty = true;\n }\n\n updateRotation() {\n this._isContainerDirty = true;\n }\n\n updateSize() {\n this._isContainerDirty = true;\n }\n\n updateVisibility(): void {\n this._threeGroup.visible = !this._object.hidden;\n }\n\n updateOpacity(): void {\n // Opacity is not handled by 3D custom objects.\n }\n\n setLayerIndex(layer: gdjs.RuntimeLayer, index: float): void {\n // Layers are not handled for 3D custom objects.\n }\n\n static getAnimationFrameTextureManager(\n imageManager: gdjs.PixiImageManager\n ): ThreeAnimationFrameTextureManager {\n if (!imageManager._threeAnimationFrameTextureManager) {\n imageManager._threeAnimationFrameTextureManager = new ThreeAnimationFrameTextureManager(\n imageManager\n );\n }\n return imageManager._threeAnimationFrameTextureManager;\n }\n }\n\n class ThreeAnimationFrameTextureManager\n implements gdjs.AnimationFrameTextureManager<THREE.Material> {\n private _imageManager: gdjs.PixiImageManager;\n\n constructor(imageManager: gdjs.PixiImageManager) {\n this._imageManager = imageManager;\n }\n\n getAnimationFrameTexture(imageName: string) {\n return this._imageManager.getThreeMaterial(imageName, {\n useTransparentTexture: true,\n forceBasicMaterial: true,\n });\n }\n\n getAnimationFrameWidth(material: THREE.Material) {\n const map = (material as\n | THREE.MeshBasicMaterial\n | THREE.MeshStandardMaterial).map;\n return map ? map.image.width : 0;\n }\n\n getAnimationFrameHeight(material: THREE.Material) {\n const map = (material as\n | THREE.MeshBasicMaterial\n | THREE.MeshStandardMaterial).map;\n return map ? map.image.height : 0;\n }\n }\n}\n"],
5
- "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAOS,OAC4C,CAMjD,YACE,EACA,EACA,EACA,CAPF,uBAA6B,GAQ3B,KAAK,QAAU,EACf,KAAK,mBAAqB,EAE1B,KAAK,YAAc,GAAI,OAAM,MAC7B,KAAK,YAAY,SAAS,MAAQ,MAElC,KAAM,GAAQ,EAAO,SAAS,IAC9B,AAAI,GACF,EAAM,cAAc,oBAAoB,KAAK,aAIjD,qBAAsC,CACpC,MAAO,MAAK,YAGd,mBAAoB,CAClB,MAAO,MAGT,aACE,EACA,EACA,CACA,KAAK,QAAU,EACf,KAAK,kBAAoB,GACzB,KAAM,GAAQ,EAAO,SAAS,IAC9B,AAAI,GACF,EAAM,cAAc,oBAAoB,KAAK,aAIjD,mBAAoB,CAClB,KAAM,GAAgB,KAAK,sBAErB,EAAS,KAAK,QAAQ,YACtB,EAAS,KAAK,QAAQ,YACtB,EAAS,KAAK,QAAQ,YACtB,EAAS,KAAK,QAAQ,qBAAuB,EAC7C,EAAS,KAAK,QAAQ,qBAAuB,EAC7C,EAAS,KAAK,QAAQ,qBAAuB,EAEnD,EAAc,SAAS,IACrB,EAAK,MAAM,KAAK,QAAQ,gBACxB,EAAK,MAAM,KAAK,QAAQ,gBACxB,EAAK,MAAM,KAAK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D,KAAM,GAAO,EAEmB,IAChC,MAAO,GAAM,EAAI,MAAM,OAAS,MA/K5B",
4
+ "sourcesContent": ["namespace gdjs {\n export interface PixiImageManager {\n _threeAnimationFrameTextureManager: ThreeAnimationFrameTextureManager;\n }\n /**\n * The renderer for a {@link gdjs.CustomRuntimeObject3D} using Three.js.\n */\n export class CustomRuntimeObject3DRenderer\n implements gdjs.RuntimeInstanceContainerRenderer\n {\n _object: gdjs.CustomRuntimeObject3D;\n _instanceContainer: gdjs.CustomRuntimeObjectInstanceContainer;\n _isContainerDirty: boolean = true;\n _threeGroup: THREE.Group;\n\n constructor(\n object: gdjs.CustomRuntimeObject3D,\n instanceContainer: gdjs.CustomRuntimeObjectInstanceContainer,\n parent: gdjs.RuntimeInstanceContainer\n ) {\n this._object = object;\n this._instanceContainer = instanceContainer;\n\n this._threeGroup = new THREE.Group();\n this._threeGroup.rotation.order = 'ZYX';\n\n const layer = parent.getLayer('');\n if (layer) {\n layer.getRenderer().add3DRendererObject(this._threeGroup);\n }\n }\n\n get3DRendererObject(): THREE.Object3D {\n return this._threeGroup;\n }\n\n getRendererObject() {\n return null;\n }\n\n reinitialize(\n object: gdjs.CustomRuntimeObject3D,\n parent: gdjs.RuntimeInstanceContainer\n ) {\n this._object = object;\n this._isContainerDirty = true;\n const layer = parent.getLayer('');\n if (layer) {\n layer.getRenderer().add3DRendererObject(this._threeGroup);\n }\n }\n\n _updateThreeGroup() {\n const threeObject3D = this.get3DRendererObject();\n\n const scaleX = this._object.getScaleX();\n const scaleY = this._object.getScaleY();\n const scaleZ = this._object.getScaleZ();\n const pivotX = this._object.getUnscaledCenterX() * scaleX;\n const pivotY = this._object.getUnscaledCenterY() * scaleY;\n const pivotZ = this._object.getUnscaledCenterZ() * scaleZ;\n\n threeObject3D.rotation.set(\n gdjs.toRad(this._object.getRotationX()),\n gdjs.toRad(this._object.getRotationY()),\n gdjs.toRad(this._object.angle)\n );\n\n threeObject3D.position.set(\n this._object.isFlippedX() ? pivotX : -pivotX,\n this._object.isFlippedY() ? pivotY : -pivotY,\n this._object.isFlippedZ() ? pivotZ : -pivotZ\n );\n threeObject3D.position.applyEuler(threeObject3D.rotation);\n threeObject3D.position.x += this._object.getX() + pivotX;\n threeObject3D.position.y += this._object.getY() + pivotY;\n threeObject3D.position.z += this._object.getZ() + pivotZ;\n\n threeObject3D.scale.set(\n this._object.isFlippedX() ? -scaleX : scaleX,\n this._object.isFlippedY() ? -scaleY : scaleY,\n this._object.isFlippedZ() ? -scaleZ : scaleZ\n );\n\n threeObject3D.visible = !this._object.hidden;\n\n this._isContainerDirty = false;\n }\n\n /**\n * Call this to make sure the object is ready to be rendered.\n */\n ensureUpToDate() {\n if (this._isContainerDirty) {\n this._updateThreeGroup();\n }\n }\n\n update(): void {\n this._isContainerDirty = true;\n }\n\n updateX(): void {\n this._isContainerDirty = true;\n }\n\n updateY(): void {\n this._isContainerDirty = true;\n }\n\n updateAngle(): void {\n this._isContainerDirty = true;\n }\n\n updatePosition() {\n this._isContainerDirty = true;\n }\n\n updateRotation() {\n this._isContainerDirty = true;\n }\n\n updateSize() {\n this._isContainerDirty = true;\n }\n\n updateVisibility(): void {\n this._threeGroup.visible = !this._object.hidden;\n }\n\n updateOpacity(): void {\n // Opacity is not handled by 3D custom objects.\n }\n\n setLayerIndex(layer: gdjs.RuntimeLayer, index: float): void {\n // Layers are not handled for 3D custom objects.\n }\n\n static getAnimationFrameTextureManager(\n imageManager: gdjs.PixiImageManager\n ): ThreeAnimationFrameTextureManager {\n if (!imageManager._threeAnimationFrameTextureManager) {\n imageManager._threeAnimationFrameTextureManager =\n new ThreeAnimationFrameTextureManager(imageManager);\n }\n return imageManager._threeAnimationFrameTextureManager;\n }\n }\n\n class ThreeAnimationFrameTextureManager\n implements gdjs.AnimationFrameTextureManager<THREE.Material>\n {\n private _imageManager: gdjs.PixiImageManager;\n\n constructor(imageManager: gdjs.PixiImageManager) {\n this._imageManager = imageManager;\n }\n\n getAnimationFrameTexture(imageName: string) {\n return this._imageManager.getThreeMaterial(imageName, {\n useTransparentTexture: true,\n forceBasicMaterial: true,\n });\n }\n\n getAnimationFrameWidth(material: THREE.Material) {\n const map = (\n material as THREE.MeshBasicMaterial | THREE.MeshStandardMaterial\n ).map;\n return map ? map.image.width : 0;\n }\n\n getAnimationFrameHeight(material: THREE.Material) {\n const map = (\n material as THREE.MeshBasicMaterial | THREE.MeshStandardMaterial\n ).map;\n return map ? map.image.height : 0;\n }\n }\n}\n"],
5
+ "mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAOS,OAEP,CAME,YACE,EACA,EACA,EACA,CAPF,uBAA6B,GAQ3B,KAAK,QAAU,EACf,KAAK,mBAAqB,EAE1B,KAAK,YAAc,GAAI,OAAM,MAC7B,KAAK,YAAY,SAAS,MAAQ,MAElC,KAAM,GAAQ,EAAO,SAAS,IAC9B,AAAI,GACF,EAAM,cAAc,oBAAoB,KAAK,aAIjD,qBAAsC,CACpC,MAAO,MAAK,YAGd,mBAAoB,CAClB,MAAO,MAGT,aACE,EACA,EACA,CACA,KAAK,QAAU,EACf,KAAK,kBAAoB,GACzB,KAAM,GAAQ,EAAO,SAAS,IAC9B,AAAI,GACF,EAAM,cAAc,oBAAoB,KAAK,aAIjD,mBAAoB,CAClB,KAAM,GAAgB,KAAK,sBAErB,EAAS,KAAK,QAAQ,YACtB,EAAS,KAAK,QAAQ,YACtB,EAAS,KAAK,QAAQ,YACtB,EAAS,KAAK,QAAQ,qBAAuB,EAC7C,EAAS,KAAK,QAAQ,qBAAuB,EAC7C,EAAS,KAAK,QAAQ,qBAAuB,EAEnD,EAAc,SAAS,IACrB,EAAK,MAAM,KAAK,QAAQ,gBACxB,EAAK,MAAM,KAAK,QAAQ,gBACxB,EAAK,MAAM,KAAK,QAAQ,QAG1B,EAAc,SAAS,IACrB,KAAK,QAAQ,aAAe,EAAS,CAAC,EACtC,KAAK,QAAQ,aAAe,EAAS,CAAC,EACtC,KAAK,QAAQ,aAAe,EAAS,CAAC,GAExC,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