gdcore-tools 2.0.0-beta3 → 2.0.0-beta4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Runtime/AsyncTasksManager.js +2 -2
- package/dist/Runtime/AsyncTasksManager.js.map +2 -2
- package/dist/Runtime/Cordova/config.xml +23 -1
- package/dist/Runtime/Cordova/www/LICENSE.GDevelop.txt +2 -0
- package/dist/Runtime/Cordova/www/index.html +1 -1
- package/dist/Runtime/CustomRuntimeObject.js +1 -1
- package/dist/Runtime/CustomRuntimeObject.js.map +2 -2
- package/dist/Runtime/CustomRuntimeObject2D.js +2 -0
- package/dist/Runtime/CustomRuntimeObject2D.js.map +7 -0
- package/dist/Runtime/CustomRuntimeObjectInstanceContainer.js +1 -1
- package/dist/Runtime/CustomRuntimeObjectInstanceContainer.js.map +2 -2
- package/dist/Runtime/Electron/LICENSE.GDevelop.txt +2 -0
- package/dist/Runtime/Electron/package.json +3 -0
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js +1 -1
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js.map +2 -2
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3DRenderer.js +1 -1
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3DRenderer.js.map +2 -2
- package/dist/Runtime/Extensions/3D/AmbientLight.js +1 -1
- package/dist/Runtime/Extensions/3D/AmbientLight.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Base3DBehavior.js +1 -1
- package/dist/Runtime/Extensions/3D/Base3DBehavior.js.map +2 -2
- package/dist/Runtime/Extensions/3D/BloomEffect.js +1 -1
- package/dist/Runtime/Extensions/3D/BloomEffect.js.map +2 -2
- package/dist/Runtime/Extensions/3D/BrightnessAndContrastEffect.js +1 -1
- package/dist/Runtime/Extensions/3D/BrightnessAndContrastEffect.js.map +2 -2
- package/dist/Runtime/Extensions/3D/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js +1 -1
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js.map +2 -2
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js +2 -0
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js.map +7 -0
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3DRenderer.js +2 -0
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3DRenderer.js.map +7 -0
- package/dist/Runtime/Extensions/3D/DirectionalLight.js +1 -1
- package/dist/Runtime/Extensions/3D/DirectionalLight.js.map +2 -2
- package/dist/Runtime/Extensions/3D/ExponentialFog.js +1 -1
- package/dist/Runtime/Extensions/3D/ExponentialFog.js.map +2 -2
- package/dist/Runtime/Extensions/3D/ExposureEffect.js +1 -1
- package/dist/Runtime/Extensions/3D/ExposureEffect.js.map +2 -2
- package/dist/Runtime/Extensions/3D/HemisphereLight.js +1 -1
- package/dist/Runtime/Extensions/3D/HemisphereLight.js.map +2 -2
- package/dist/Runtime/Extensions/3D/HueAndSaturationEffect.js +1 -1
- package/dist/Runtime/Extensions/3D/HueAndSaturationEffect.js.map +2 -2
- package/dist/Runtime/Extensions/3D/JsExtension.js +56 -24
- package/dist/Runtime/Extensions/3D/LinearFog.js +1 -1
- package/dist/Runtime/Extensions/3D/LinearFog.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js +1 -1
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js +1 -1
- package/dist/Runtime/Extensions/3D/Model3DRuntimeObject3DRenderer.js.map +2 -2
- package/dist/Runtime/Extensions/AdMob/JsExtension.js +11 -10
- package/dist/Runtime/Extensions/AdMob/admobtools.js +1 -1
- package/dist/Runtime/Extensions/AdMob/admobtools.js.map +2 -2
- package/dist/Runtime/Extensions/AnchorBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/BBText/JsExtension.js +20 -11
- package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/BitmapText/JsExtension.js +2 -8
- package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/CMakeLists.txt +35 -0
- package/dist/Runtime/Extensions/CMakeUtils.txt +81 -0
- package/dist/Runtime/Extensions/DestroyOutsideBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/DestroyOutsideBehavior/destroyoutsideruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/DialogueTree/bondage.js/version.txt +5 -0
- package/dist/Runtime/Extensions/DraggableBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/Effects/adjustment-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/adjustment-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/advanced-bloom-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/advanced-bloom-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/ascii-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/ascii-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/black-and-white-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/black-and-white-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/blending-mode-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/blending-mode-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/brightness-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/brightness-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/bulge-pinch-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/bulge-pinch-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/color-map-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/color-map-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/crt-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/crt-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/displacement-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/displacement-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/dot-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/dot-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/glitch-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/glitch-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/godray-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/godray-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/hsl-adjustment-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/hsl-adjustment-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/kawase-blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/kawase-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/light-night-pixi-filter.js +2 -2
- package/dist/Runtime/Extensions/Effects/light-night-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/motion-blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/motion-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/night-pixi-filter.js +2 -2
- package/dist/Runtime/Extensions/Effects/night-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/noise-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/noise-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/old-film-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/old-film-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/pixelate-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/pixelate-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/radial-blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/radial-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/reflection-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/reflection-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/rgb-split-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/rgb-split-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/sepia-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/sepia-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/shockwave-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/shockwave-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/tilt-shift-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/tilt-shift-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/twist-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/twist-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/zoom-blur-pixi-filter.js +1 -1
- package/dist/Runtime/Extensions/Effects/zoom-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/ExampleJsExtension/JsExtension.js +2 -11
- package/dist/Runtime/Extensions/ExampleJsExtension/dummyeffect.js +1 -1
- package/dist/Runtime/Extensions/ExampleJsExtension/dummyeffect.js.map +2 -2
- package/dist/Runtime/Extensions/FileSystem/JsExtension.js +22 -0
- package/dist/Runtime/Extensions/FileSystem/filesystemtools.js +1 -1
- package/dist/Runtime/Extensions/FileSystem/filesystemtools.js.map +2 -2
- package/dist/Runtime/Extensions/Firebase/A_firebasejs/NOTICE.txt +6 -0
- package/dist/Runtime/Extensions/Inventory/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/JsExtensionTypes.d.ts +13 -4
- package/dist/Runtime/Extensions/Leaderboards/JsExtension.js +42 -1
- package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js +1 -1
- package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js.map +2 -2
- package/dist/Runtime/Extensions/Lighting/JsExtension.js +2 -11
- package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/LinkedObjects/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/LinkedObjects/linkedobjects.js +1 -1
- package/dist/Runtime/Extensions/LinkedObjects/linkedobjects.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/JsExtension.js +1130 -0
- package/dist/Runtime/Extensions/Multiplayer/messageManager.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/messageManager.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayerVariablesManager.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayerVariablesManager.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/peer.js +10 -0
- package/dist/Runtime/Extensions/Multiplayer/peer.js.map +1 -0
- package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js +2 -0
- package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js.map +7 -0
- package/dist/Runtime/Extensions/Multiplayer/peerjs.d.ts +509 -0
- package/dist/Runtime/Extensions/P2P/A_peer.js +8 -2
- package/dist/Runtime/Extensions/P2P/A_peer.js.map +1 -1
- package/dist/Runtime/Extensions/P2P/B_p2ptools.js +1 -1
- package/dist/Runtime/Extensions/P2P/B_p2ptools.js.map +2 -2
- package/dist/Runtime/Extensions/P2P/JsExtension.js +27 -0
- package/dist/Runtime/Extensions/PanelSpriteObject/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/ParticleSystem/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js +1 -1
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js.map +2 -2
- package/dist/Runtime/Extensions/PathfindingBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics2Behavior/JsExtension.js +47 -4
- package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js +1 -1
- package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PhysicsBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PlatformBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PlayerAuthentication/JsExtension.js +6 -3
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationcomponents.js +4 -4
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationcomponents.js.map +2 -2
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js +1 -1
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js.map +2 -2
- package/dist/Runtime/Extensions/PrimitiveDrawing/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/Shopify/CMakeLists.txt +26 -0
- package/dist/Runtime/Extensions/Spine/CMakeLists.txt +20 -0
- package/dist/Runtime/Extensions/Spine/JsExtension.js +11 -2
- package/dist/Runtime/Extensions/Spine/managers/pixi-spine-atlas-manager.js +1 -1
- package/dist/Runtime/Extensions/Spine/managers/pixi-spine-atlas-manager.js.map +2 -2
- package/dist/Runtime/Extensions/Spine/managers/pixi-spine-manager.js +1 -1
- package/dist/Runtime/Extensions/Spine/managers/pixi-spine-manager.js.map +2 -2
- package/dist/Runtime/Extensions/Spine/pixi-spine/Spine-Runtimes-License-Agreement.txt +11 -0
- package/dist/Runtime/Extensions/Spine/pixi-spine/pixi-spine.js +5 -3
- package/dist/Runtime/Extensions/Spine/spineruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/Spine/spineruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/SystemInfo/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TextEntryObject/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TextInput/JsExtension.js +3 -10
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TextInput/textinputruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TextObject/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TextObject/textruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TextObject/textruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/JsExtension.js +834 -23
- package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js +1 -1
- package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js +1 -1
- package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.d.ts +2 -0
- package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.js +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/TileMapHelper.js.map +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/CommonTypes.d.ts +12 -0
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/CommonTypes.d.ts.map +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts +119 -5
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts.map +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapManager.d.ts +25 -0
- package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapManager.d.ts.map +1 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapPixiHelper.d.ts +16 -1
- package/dist/Runtime/Extensions/TileMap/helper/dts/render/TileMapPixiHelper.d.ts.map +1 -1
- package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js +2 -0
- package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js.map +7 -0
- package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TiledSpriteObject/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TopDownMovementBehavior/CMakeLists.txt +23 -0
- package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/TweenBehavior/JsExtension.js +2 -2
- package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Video/JsExtension.js +2 -11
- package/dist/Runtime/Extensions/Video/videoruntimeobject.js +1 -1
- package/dist/Runtime/Extensions/Video/videoruntimeobject.js.map +2 -2
- package/dist/Runtime/RuntimeInstanceContainer.js +1 -1
- package/dist/Runtime/RuntimeInstanceContainer.js.map +2 -2
- package/dist/Runtime/SpriteAnimator.js +2 -0
- package/dist/Runtime/SpriteAnimator.js.map +7 -0
- package/dist/Runtime/debugger-client/hot-reloader.js +1 -1
- package/dist/Runtime/debugger-client/hot-reloader.js.map +2 -2
- package/dist/Runtime/events-tools/objecttools.js +1 -1
- package/dist/Runtime/events-tools/objecttools.js.map +2 -2
- package/dist/Runtime/events-tools/runtimescenetools.js +1 -1
- package/dist/Runtime/events-tools/runtimescenetools.js.map +2 -2
- package/dist/Runtime/force.js +1 -1
- package/dist/Runtime/force.js.map +2 -2
- package/dist/Runtime/object-capabilities/TextContainerBehavior.js.map +1 -1
- package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js +2 -0
- package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js.map +7 -0
- package/dist/Runtime/pixi-renderers/DebuggerPixiRenderer.js +1 -1
- package/dist/Runtime/pixi-renderers/DebuggerPixiRenderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/layer-pixi-renderer.js +2 -2
- package/dist/Runtime/pixi-renderers/layer-pixi-renderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/pixi-filters-tools.js +1 -1
- package/dist/Runtime/pixi-renderers/pixi-filters-tools.js.map +2 -2
- package/dist/Runtime/pixi-renderers/pixi-image-manager.js.map +2 -2
- package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js +1 -1
- package/dist/Runtime/pixi-renderers/runtimegame-pixi-renderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/polygon.js +1 -1
- package/dist/Runtime/polygon.js.map +2 -2
- package/dist/Runtime/runtimebehavior.js +1 -1
- package/dist/Runtime/runtimebehavior.js.map +2 -2
- package/dist/Runtime/runtimegame.js +1 -1
- package/dist/Runtime/runtimegame.js.map +2 -2
- package/dist/Runtime/runtimeobject.js +1 -1
- package/dist/Runtime/runtimeobject.js.map +2 -2
- package/dist/Runtime/runtimescene.js +1 -1
- package/dist/Runtime/runtimescene.js.map +2 -2
- package/dist/Runtime/scenestack.js +1 -1
- package/dist/Runtime/scenestack.js.map +2 -2
- package/dist/Runtime/spriteruntimeobject.js +1 -1
- package/dist/Runtime/spriteruntimeobject.js.map +2 -2
- package/dist/Runtime/timer.js +1 -1
- package/dist/Runtime/timer.js.map +2 -2
- package/dist/Runtime/types/project-data.d.ts +115 -0
- package/dist/Runtime/variable.js +1 -1
- package/dist/Runtime/variable.js.map +2 -2
- package/dist/Runtime/variablescontainer.js +1 -1
- package/dist/Runtime/variablescontainer.js.map +2 -2
- package/dist/lib/libGD.cjs +2 -1
- package/dist/lib/libGD.d.cts +5 -0
- package/dist/lib/libGD.wasm +0 -0
- package/dist/loaders.cjs +2 -1
- package/dist/loaders.d.cts +2 -0
- package/gd.d.ts +217 -223
- package/package.json +8 -6
- package/src/index.js +2 -0
- package/types/index.d.ts +2 -2
- package/types/open_project.d.ts +4 -4
- package/dist/Runtime/Extensions/Spine/pixi-spine/pixi-spine.js.map +0 -7
- package/dist/Runtime/pixi-renderers/CustomObjectPixiRenderer.js +0 -2
- package/dist/Runtime/pixi-renderers/CustomObjectPixiRenderer.js.map +0 -7
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var gdjs;(function(i){i.PixiFiltersTools.registerFilterCreator("Scene3D::HemisphereLight",new class{makeFilter(o,r){return typeof THREE=="undefined"?new i.PixiFiltersTools.EmptyFilter:new class{constructor(){this._isEnabled=!1;this.top="Y-";this.elevation=45;this.rotation=0;this.light=new THREE.HemisphereLight,this.light.position.set(1,0,0),this.rotationObject=new THREE.Group,this.rotationObject.add(this.light),this.updateRotation()}isEnabled(t){return this._isEnabled}setEnabled(t,e){return this._isEnabled===e?!0:e?this.applyEffect(t):this.removeEffect(t)}applyEffect(t){const e=t.get3DRendererObject();return e?(e.add(this.rotationObject),this._isEnabled=!0,!0):!1}removeEffect(t){const e=t.get3DRendererObject();return e?(e.remove(this.rotationObject),this._isEnabled=!1,!0):!1}updatePreRender(t){}updateDoubleParameter(t,e){t==="intensity"?this.light.intensity=e:t==="elevation"?(this.elevation=e,this.updateRotation()):t==="rotation"&&(this.rotation=e,this.updateRotation())}getDoubleParameter(t){return t==="intensity"?this.light.intensity:t==="elevation"?this.elevation:t==="rotation"?this.rotation:0}updateStringParameter(t,e){t==="skyColor"&&(this.light.color=new THREE.Color(i.PixiFiltersTools.rgbOrHexToHexNumber(e))),t==="groundColor"&&(this.light.groundColor=new THREE.Color(i.PixiFiltersTools.rgbOrHexToHexNumber(e))),t==="top"&&(this.top=e,this.updateRotation())}updateColorParameter(t,e){t==="skyColor"&&this.light.color.setHex(e),t==="groundColor"&&this.light.groundColor.setHex(e)}getColorParameter(t){return t==="skyColor"?this.light.color.getHex():t==="groundColor"?this.light.groundColor.getHex():0}updateBooleanParameter(t,e){}updateRotation(){this.top==="Z+"?(this.rotationObject.rotation.z=i.toRad(this.rotation),this.rotationObject.rotation.y=-i.toRad(this.elevation)):(this.rotationObject.rotation.y=i.toRad(this.rotation-90),this.rotationObject.rotation.z=-i.toRad(this.elevation))}}}})})(gdjs||(gdjs={}));
|
|
1
|
+
var gdjs;(function(i){i.PixiFiltersTools.registerFilterCreator("Scene3D::HemisphereLight",new class{makeFilter(o,r){return typeof THREE=="undefined"?new i.PixiFiltersTools.EmptyFilter:new class{constructor(){this._isEnabled=!1;this.top="Y-";this.elevation=45;this.rotation=0;this.light=new THREE.HemisphereLight,this.light.position.set(1,0,0),this.rotationObject=new THREE.Group,this.rotationObject.add(this.light),this.updateRotation()}isEnabled(t){return this._isEnabled}setEnabled(t,e){return this._isEnabled===e?!0:e?this.applyEffect(t):this.removeEffect(t)}applyEffect(t){const e=t.get3DRendererObject();return e?(e.add(this.rotationObject),this._isEnabled=!0,!0):!1}removeEffect(t){const e=t.get3DRendererObject();return e?(e.remove(this.rotationObject),this._isEnabled=!1,!0):!1}updatePreRender(t){}updateDoubleParameter(t,e){t==="intensity"?this.light.intensity=e:t==="elevation"?(this.elevation=e,this.updateRotation()):t==="rotation"&&(this.rotation=e,this.updateRotation())}getDoubleParameter(t){return t==="intensity"?this.light.intensity:t==="elevation"?this.elevation:t==="rotation"?this.rotation:0}updateStringParameter(t,e){t==="skyColor"&&(this.light.color=new THREE.Color(i.PixiFiltersTools.rgbOrHexToHexNumber(e))),t==="groundColor"&&(this.light.groundColor=new THREE.Color(i.PixiFiltersTools.rgbOrHexToHexNumber(e))),t==="top"&&(this.top=e,this.updateRotation())}updateColorParameter(t,e){t==="skyColor"&&this.light.color.setHex(e),t==="groundColor"&&this.light.groundColor.setHex(e)}getColorParameter(t){return t==="skyColor"?this.light.color.getHex():t==="groundColor"?this.light.groundColor.getHex():0}updateBooleanParameter(t,e){}updateRotation(){this.top==="Z+"?(this.rotationObject.rotation.z=i.toRad(this.rotation),this.rotationObject.rotation.y=-i.toRad(this.elevation)):(this.rotationObject.rotation.y=i.toRad(this.rotation-90),this.rotationObject.rotation.z=-i.toRad(this.elevation))}getNetworkSyncData(){return{i:this.light.intensity,sc:this.light.color.getHex(),gc:this.light.groundColor.getHex(),e:this.elevation,r:this.rotation,t:this.top}}updateFromNetworkSyncData(t){this.light.intensity=t.i,this.light.color.setHex(t.sc),this.light.groundColor.setHex(t.gc),this.elevation=t.e,this.rotation=t.r,this.top=t.t,this.updateRotation()}}}})})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=HemisphereLight.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../GDevelop/Extensions/3D/HemisphereLight.ts"],
|
|
4
|
-
"sourcesContent": ["namespace gdjs {\n gdjs.PixiFiltersTools.registerFilterCreator(\n 'Scene3D::HemisphereLight',\n new (class implements gdjs.PixiFiltersTools.FilterCreator {\n makeFilter(\n target: EffectsTarget,\n effectData: EffectData\n ): gdjs.PixiFiltersTools.Filter {\n if (typeof THREE === 'undefined') {\n return new gdjs.PixiFiltersTools.EmptyFilter();\n }\n return new (class implements gdjs.PixiFiltersTools.Filter {\n light: THREE.HemisphereLight;\n rotationObject: THREE.Group;\n _isEnabled: boolean = false;\n top: string = 'Y-';\n elevation: float = 45;\n rotation: float = 0;\n\n constructor() {\n this.light = new THREE.HemisphereLight();\n this.light.position.set(1, 0, 0);\n this.rotationObject = new THREE.Group();\n this.rotationObject.add(this.light);\n this.updateRotation();\n }\n\n isEnabled(target: EffectsTarget): boolean {\n return this._isEnabled;\n }\n setEnabled(target: EffectsTarget, enabled: boolean): boolean {\n if (this._isEnabled === enabled) {\n return true;\n }\n if (enabled) {\n return this.applyEffect(target);\n } else {\n return this.removeEffect(target);\n }\n }\n applyEffect(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n if (!scene) {\n return false;\n }\n scene.add(this.rotationObject);\n this._isEnabled = true;\n return true;\n }\n removeEffect(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n if (!scene) {\n return false;\n }\n scene.remove(this.rotationObject);\n this._isEnabled = false;\n return true;\n }\n updatePreRender(target: gdjs.EffectsTarget): any {}\n updateDoubleParameter(parameterName: string, value: number): void {\n if (parameterName === 'intensity') {\n this.light.intensity = value;\n } else if (parameterName === 'elevation') {\n this.elevation = value;\n this.updateRotation();\n } else if (parameterName === 'rotation') {\n this.rotation = value;\n this.updateRotation();\n }\n }\n getDoubleParameter(parameterName: string): number {\n if (parameterName === 'intensity') {\n return this.light.intensity;\n } else if (parameterName === 'elevation') {\n return this.elevation;\n } else if (parameterName === 'rotation') {\n return this.rotation;\n }\n return 0;\n }\n updateStringParameter(parameterName: string, value: string): void {\n if (parameterName === 'skyColor') {\n this.light.color = new THREE.Color(\n gdjs.PixiFiltersTools.rgbOrHexToHexNumber(value)\n );\n }\n if (parameterName === 'groundColor') {\n this.light.groundColor = new THREE.Color(\n gdjs.PixiFiltersTools.rgbOrHexToHexNumber(value)\n );\n }\n if (parameterName === 'top') {\n this.top = value;\n this.updateRotation();\n }\n }\n updateColorParameter(parameterName: string, value: number): void {\n if (parameterName === 'skyColor') {\n this.light.color.setHex(value);\n }\n if (parameterName === 'groundColor') {\n this.light.groundColor.setHex(value);\n }\n }\n getColorParameter(parameterName: string): number {\n if (parameterName === 'skyColor') {\n return this.light.color.getHex();\n }\n if (parameterName === 'groundColor') {\n return this.light.groundColor.getHex();\n }\n return 0;\n }\n updateBooleanParameter(parameterName: string, value: boolean): void {}\n updateRotation() {\n if (this.top === 'Z+') {\n // 0\u00B0 is a light from the right of the screen.\n this.rotationObject.rotation.z = gdjs.toRad(this.rotation);\n this.rotationObject.rotation.y = -gdjs.toRad(this.elevation);\n } else {\n // 0\u00B0 becomes a light from Z+.\n this.rotationObject.rotation.y = gdjs.toRad(this.rotation - 90);\n this.rotationObject.rotation.z = -gdjs.toRad(this.elevation);\n }\n }\n })();\n }\n })()\n );\n}\n"],
|
|
5
|
-
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,
|
|
4
|
+
"sourcesContent": ["namespace gdjs {\n interface HemisphereLightFilterNetworkSyncData {\n i: number;\n sc: number;\n gc: number;\n e: number;\n r: number;\n t: string;\n }\n gdjs.PixiFiltersTools.registerFilterCreator(\n 'Scene3D::HemisphereLight',\n new (class implements gdjs.PixiFiltersTools.FilterCreator {\n makeFilter(\n target: EffectsTarget,\n effectData: EffectData\n ): gdjs.PixiFiltersTools.Filter {\n if (typeof THREE === 'undefined') {\n return new gdjs.PixiFiltersTools.EmptyFilter();\n }\n return new (class implements gdjs.PixiFiltersTools.Filter {\n light: THREE.HemisphereLight;\n rotationObject: THREE.Group;\n _isEnabled: boolean = false;\n top: string = 'Y-';\n elevation: float = 45;\n rotation: float = 0;\n\n constructor() {\n this.light = new THREE.HemisphereLight();\n this.light.position.set(1, 0, 0);\n this.rotationObject = new THREE.Group();\n this.rotationObject.add(this.light);\n this.updateRotation();\n }\n\n isEnabled(target: EffectsTarget): boolean {\n return this._isEnabled;\n }\n setEnabled(target: EffectsTarget, enabled: boolean): boolean {\n if (this._isEnabled === enabled) {\n return true;\n }\n if (enabled) {\n return this.applyEffect(target);\n } else {\n return this.removeEffect(target);\n }\n }\n applyEffect(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n if (!scene) {\n return false;\n }\n scene.add(this.rotationObject);\n this._isEnabled = true;\n return true;\n }\n removeEffect(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n if (!scene) {\n return false;\n }\n scene.remove(this.rotationObject);\n this._isEnabled = false;\n return true;\n }\n updatePreRender(target: gdjs.EffectsTarget): any {}\n updateDoubleParameter(parameterName: string, value: number): void {\n if (parameterName === 'intensity') {\n this.light.intensity = value;\n } else if (parameterName === 'elevation') {\n this.elevation = value;\n this.updateRotation();\n } else if (parameterName === 'rotation') {\n this.rotation = value;\n this.updateRotation();\n }\n }\n getDoubleParameter(parameterName: string): number {\n if (parameterName === 'intensity') {\n return this.light.intensity;\n } else if (parameterName === 'elevation') {\n return this.elevation;\n } else if (parameterName === 'rotation') {\n return this.rotation;\n }\n return 0;\n }\n updateStringParameter(parameterName: string, value: string): void {\n if (parameterName === 'skyColor') {\n this.light.color = new THREE.Color(\n gdjs.PixiFiltersTools.rgbOrHexToHexNumber(value)\n );\n }\n if (parameterName === 'groundColor') {\n this.light.groundColor = new THREE.Color(\n gdjs.PixiFiltersTools.rgbOrHexToHexNumber(value)\n );\n }\n if (parameterName === 'top') {\n this.top = value;\n this.updateRotation();\n }\n }\n updateColorParameter(parameterName: string, value: number): void {\n if (parameterName === 'skyColor') {\n this.light.color.setHex(value);\n }\n if (parameterName === 'groundColor') {\n this.light.groundColor.setHex(value);\n }\n }\n getColorParameter(parameterName: string): number {\n if (parameterName === 'skyColor') {\n return this.light.color.getHex();\n }\n if (parameterName === 'groundColor') {\n return this.light.groundColor.getHex();\n }\n return 0;\n }\n updateBooleanParameter(parameterName: string, value: boolean): void {}\n updateRotation() {\n if (this.top === 'Z+') {\n // 0\u00B0 is a light from the right of the screen.\n this.rotationObject.rotation.z = gdjs.toRad(this.rotation);\n this.rotationObject.rotation.y = -gdjs.toRad(this.elevation);\n } else {\n // 0\u00B0 becomes a light from Z+.\n this.rotationObject.rotation.y = gdjs.toRad(this.rotation - 90);\n this.rotationObject.rotation.z = -gdjs.toRad(this.elevation);\n }\n }\n getNetworkSyncData(): HemisphereLightFilterNetworkSyncData {\n return {\n i: this.light.intensity,\n sc: this.light.color.getHex(),\n gc: this.light.groundColor.getHex(),\n e: this.elevation,\n r: this.rotation,\n t: this.top,\n };\n }\n updateFromNetworkSyncData(\n syncData: HemisphereLightFilterNetworkSyncData\n ): void {\n this.light.intensity = syncData.i;\n this.light.color.setHex(syncData.sc);\n this.light.groundColor.setHex(syncData.gc);\n this.elevation = syncData.e;\n this.rotation = syncData.r;\n this.top = syncData.t;\n this.updateRotation();\n }\n })();\n }\n })()\n );\n}\n"],
|
|
5
|
+
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CASE,EAAK,iBAAiB,sBACpB,2BACA,GAAK,MAAqD,CACxD,WACE,EACA,EAC8B,CAC9B,MAAI,OAAO,QAAU,YACZ,GAAI,GAAK,iBAAiB,YAE5B,GAAK,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K,MAAM,YAAY,OAAO,GAGlC,kBAAkB,EAA+B,CAC/C,MAAI,KAAkB,WACb,KAAK,MAAM,MAAM,SAEtB,IAAkB,cACb,KAAK,MAAM,YAAY,SAEzB,EAET,uBAAuB,EAAuB,EAAsB,EACpE,gBAAiB,CACf,AAAI,KAAK,MAAQ,KAEf,MAAK,eAAe,SAAS,EAAI,EAAK,MAAM,KAAK,UACjD,KAAK,eAAe,SAAS,EAAI,CAAC,EAAK,MAAM,KAAK,YAGlD,MAAK,eAAe,SAAS,EAAI,EAAK,MAAM,KAAK,SAAW,IAC5D,KAAK,eAAe,SAAS,EAAI,CAAC,EAAK,MAAM,KAAK,YAGtD,oBAA2D,CACzD,MAAO,CACL,EAAG,KAAK,MAAM,UACd,GAAI,KAAK,MAAM,MAAM,SACrB,GAAI,KAAK,MAAM,YAAY,SAC3B,EAAG,KAAK,UACR,EAAG,KAAK,SACR,EAAG,KAAK,KAGZ,0BACE,EACM,CACN,KAAK,MAAM,UAAY,EAAS,EAChC,KAAK,MAAM,MAAM,OAAO,EAAS,IACjC,KAAK,MAAM,YAAY,OAAO,EAAS,IACvC,KAAK,UAAY,EAAS,EAC1B,KAAK,SAAW,EAAS,EACzB,KAAK,IAAM,EAAS,EACpB,KAAK,wBA9JP",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var gdjs;(function(
|
|
1
|
+
var gdjs;(function(t){t.PixiFiltersTools.registerFilterCreator("Scene3D::HueAndSaturation",new class{makeFilter(s,a){return typeof THREE=="undefined"?new t.PixiFiltersTools.EmptyFilter:new class{constructor(){this.shaderPass=new THREE_ADDONS.ShaderPass(THREE_ADDONS.HueSaturationShader),this._isEnabled=!1}isEnabled(e){return this._isEnabled}setEnabled(e,r){return this._isEnabled===r?!0:r?this.applyEffect(e):this.removeEffect(e)}applyEffect(e){return e instanceof t.Layer?(e.getRenderer().addPostProcessingPass(this.shaderPass),this._isEnabled=!0,!0):!1}removeEffect(e){return e instanceof t.Layer?(e.getRenderer().removePostProcessingPass(this.shaderPass),this._isEnabled=!1,!0):!1}updatePreRender(e){}updateDoubleParameter(e,r){e==="hue"&&(this.shaderPass.uniforms[e].value=r/180),e==="saturation"&&(this.shaderPass.uniforms[e].value=r)}getDoubleParameter(e){return e==="hue"?this.shaderPass.uniforms[e].value*180:e==="saturation"?this.shaderPass.uniforms[e].value:0}updateStringParameter(e,r){}updateColorParameter(e,r){}getColorParameter(e){return 0}updateBooleanParameter(e,r){}getNetworkSyncData(){return{h:this.shaderPass.uniforms.hue.value,s:this.shaderPass.uniforms.saturation.value}}updateFromNetworkSyncData(e){this.shaderPass.uniforms.hue.value=e.h,this.shaderPass.uniforms.saturation.value=e.s}}}})})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=HueAndSaturationEffect.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../GDevelop/Extensions/3D/HueAndSaturationEffect.ts"],
|
|
4
|
-
"sourcesContent": ["namespace gdjs {\n gdjs.PixiFiltersTools.registerFilterCreator(\n 'Scene3D::HueAndSaturation',\n new (class implements gdjs.PixiFiltersTools.FilterCreator {\n makeFilter(\n target: EffectsTarget,\n effectData: EffectData\n ): gdjs.PixiFiltersTools.Filter {\n if (typeof THREE === 'undefined') {\n return new gdjs.PixiFiltersTools.EmptyFilter();\n }\n return new (class implements gdjs.PixiFiltersTools.Filter {\n shaderPass: THREE_ADDONS.ShaderPass;\n _isEnabled: boolean;\n\n constructor() {\n this.shaderPass = new THREE_ADDONS.ShaderPass(\n THREE_ADDONS.HueSaturationShader\n );\n this._isEnabled = false;\n }\n\n isEnabled(target: EffectsTarget): boolean {\n return this._isEnabled;\n }\n setEnabled(target: EffectsTarget, enabled: boolean): boolean {\n if (this._isEnabled === enabled) {\n return true;\n }\n if (enabled) {\n return this.applyEffect(target);\n } else {\n return this.removeEffect(target);\n }\n }\n applyEffect(target: EffectsTarget): boolean {\n if (!(target instanceof gdjs.Layer)) {\n return false;\n }\n target.getRenderer().addPostProcessingPass(this.shaderPass);\n this._isEnabled = true;\n return true;\n }\n removeEffect(target: EffectsTarget): boolean {\n if (!(target instanceof gdjs.Layer)) {\n return false;\n }\n target.getRenderer().removePostProcessingPass(this.shaderPass);\n this._isEnabled = false;\n return true;\n }\n updatePreRender(target: gdjs.EffectsTarget): any {}\n updateDoubleParameter(parameterName: string, value: number): void {\n if (parameterName === 'hue') {\n this.shaderPass.uniforms[parameterName].value = value / 180;\n }\n if (parameterName === 'saturation') {\n this.shaderPass.uniforms[parameterName].value = value;\n }\n }\n getDoubleParameter(parameterName: string): number {\n if (parameterName === 'hue') {\n return this.shaderPass.uniforms[parameterName].value * 180;\n }\n if (parameterName === 'saturation') {\n return this.shaderPass.uniforms[parameterName].value;\n }\n return 0;\n }\n updateStringParameter(parameterName: string, value: string): void {}\n updateColorParameter(parameterName: string, value: number): void {}\n getColorParameter(parameterName: string): number {\n return 0;\n }\n updateBooleanParameter(parameterName: string, value: boolean): void {}\n })();\n }\n })()\n );\n}\n"],
|
|
5
|
-
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,
|
|
4
|
+
"sourcesContent": ["namespace gdjs {\n interface HueAndSaturationFilterExtra {\n h: number;\n s: number;\n }\n gdjs.PixiFiltersTools.registerFilterCreator(\n 'Scene3D::HueAndSaturation',\n new (class implements gdjs.PixiFiltersTools.FilterCreator {\n makeFilter(\n target: EffectsTarget,\n effectData: EffectData\n ): gdjs.PixiFiltersTools.Filter {\n if (typeof THREE === 'undefined') {\n return new gdjs.PixiFiltersTools.EmptyFilter();\n }\n return new (class implements gdjs.PixiFiltersTools.Filter {\n shaderPass: THREE_ADDONS.ShaderPass;\n _isEnabled: boolean;\n\n constructor() {\n this.shaderPass = new THREE_ADDONS.ShaderPass(\n THREE_ADDONS.HueSaturationShader\n );\n this._isEnabled = false;\n }\n\n isEnabled(target: EffectsTarget): boolean {\n return this._isEnabled;\n }\n setEnabled(target: EffectsTarget, enabled: boolean): boolean {\n if (this._isEnabled === enabled) {\n return true;\n }\n if (enabled) {\n return this.applyEffect(target);\n } else {\n return this.removeEffect(target);\n }\n }\n applyEffect(target: EffectsTarget): boolean {\n if (!(target instanceof gdjs.Layer)) {\n return false;\n }\n target.getRenderer().addPostProcessingPass(this.shaderPass);\n this._isEnabled = true;\n return true;\n }\n removeEffect(target: EffectsTarget): boolean {\n if (!(target instanceof gdjs.Layer)) {\n return false;\n }\n target.getRenderer().removePostProcessingPass(this.shaderPass);\n this._isEnabled = false;\n return true;\n }\n updatePreRender(target: gdjs.EffectsTarget): any {}\n updateDoubleParameter(parameterName: string, value: number): void {\n if (parameterName === 'hue') {\n this.shaderPass.uniforms[parameterName].value = value / 180;\n }\n if (parameterName === 'saturation') {\n this.shaderPass.uniforms[parameterName].value = value;\n }\n }\n getDoubleParameter(parameterName: string): number {\n if (parameterName === 'hue') {\n return this.shaderPass.uniforms[parameterName].value * 180;\n }\n if (parameterName === 'saturation') {\n return this.shaderPass.uniforms[parameterName].value;\n }\n return 0;\n }\n updateStringParameter(parameterName: string, value: string): void {}\n updateColorParameter(parameterName: string, value: number): void {}\n getColorParameter(parameterName: string): number {\n return 0;\n }\n updateBooleanParameter(parameterName: string, value: boolean): void {}\n getNetworkSyncData(): HueAndSaturationFilterExtra {\n return {\n h: this.shaderPass.uniforms.hue.value,\n s: this.shaderPass.uniforms.saturation.value,\n };\n }\n updateFromNetworkSyncData(\n syncData: HueAndSaturationFilterExtra\n ): void {\n this.shaderPass.uniforms.hue.value = syncData.h;\n this.shaderPass.uniforms.saturation.value = syncData.s;\n }\n })();\n }\n })()\n );\n}\n"],
|
|
5
|
+
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAKE,EAAK,iBAAiB,sBACpB,4BACA,GAAK,MAAqD,CACxD,WACE,EACA,EAC8B,CAC9B,MAAI,OAAO,QAAU,YACZ,GAAI,GAAK,iBAAiB,YAE5B,G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
|
|
1099
|
-
layout
|
|
1097
|
+
newValue
|
|
1100
1098
|
) {
|
|
1101
1099
|
return false;
|
|
1102
1100
|
};
|
|
1103
1101
|
|
|
1104
|
-
Cube3DObject.getInitialInstanceProperties = function (
|
|
1105
|
-
content,
|
|
1106
|
-
instance,
|
|
1107
|
-
project,
|
|
1108
|
-
layout
|
|
1109
|
-
) {
|
|
1102
|
+
Cube3DObject.getInitialInstanceProperties = function (content, instance) {
|
|
1110
1103
|
const instanceProperties = new gd.MapStringPropertyDescriptor();
|
|
1111
1104
|
return instanceProperties;
|
|
1112
1105
|
};
|
|
@@ -2115,7 +2108,6 @@ module.exports = {
|
|
|
2115
2108
|
|
|
2116
2109
|
constructor(
|
|
2117
2110
|
project,
|
|
2118
|
-
layout,
|
|
2119
2111
|
instance,
|
|
2120
2112
|
associatedObjectConfiguration,
|
|
2121
2113
|
pixiContainer,
|
|
@@ -2123,7 +2115,6 @@ module.exports = {
|
|
|
2123
2115
|
) {
|
|
2124
2116
|
super(
|
|
2125
2117
|
project,
|
|
2126
|
-
layout,
|
|
2127
2118
|
instance,
|
|
2128
2119
|
associatedObjectConfiguration,
|
|
2129
2120
|
pixiContainer,
|
|
@@ -2300,7 +2291,6 @@ module.exports = {
|
|
|
2300
2291
|
class RenderedCube3DObject3DInstance extends Rendered3DInstance {
|
|
2301
2292
|
constructor(
|
|
2302
2293
|
project,
|
|
2303
|
-
layout,
|
|
2304
2294
|
instance,
|
|
2305
2295
|
associatedObjectConfiguration,
|
|
2306
2296
|
pixiContainer,
|
|
@@ -2309,7 +2299,6 @@ module.exports = {
|
|
|
2309
2299
|
) {
|
|
2310
2300
|
super(
|
|
2311
2301
|
project,
|
|
2312
|
-
layout,
|
|
2313
2302
|
instance,
|
|
2314
2303
|
associatedObjectConfiguration,
|
|
2315
2304
|
pixiContainer,
|
|
@@ -2682,7 +2671,6 @@ module.exports = {
|
|
|
2682
2671
|
|
|
2683
2672
|
constructor(
|
|
2684
2673
|
project,
|
|
2685
|
-
layout,
|
|
2686
2674
|
instance,
|
|
2687
2675
|
associatedObjectConfiguration,
|
|
2688
2676
|
pixiContainer,
|
|
@@ -2690,7 +2678,6 @@ module.exports = {
|
|
|
2690
2678
|
) {
|
|
2691
2679
|
super(
|
|
2692
2680
|
project,
|
|
2693
|
-
layout,
|
|
2694
2681
|
instance,
|
|
2695
2682
|
associatedObjectConfiguration,
|
|
2696
2683
|
pixiContainer,
|
|
@@ -2945,7 +2932,6 @@ module.exports = {
|
|
|
2945
2932
|
|
|
2946
2933
|
constructor(
|
|
2947
2934
|
project,
|
|
2948
|
-
layout,
|
|
2949
2935
|
instance,
|
|
2950
2936
|
associatedObjectConfiguration,
|
|
2951
2937
|
pixiContainer,
|
|
@@ -2954,7 +2940,6 @@ module.exports = {
|
|
|
2954
2940
|
) {
|
|
2955
2941
|
super(
|
|
2956
2942
|
project,
|
|
2957
|
-
layout,
|
|
2958
2943
|
instance,
|
|
2959
2944
|
associatedObjectConfiguration,
|
|
2960
2945
|
pixiContainer,
|
|
@@ -3021,6 +3006,11 @@ module.exports = {
|
|
|
3021
3006
|
return this.getHeight() * originPoint[1];
|
|
3022
3007
|
}
|
|
3023
3008
|
|
|
3009
|
+
getOriginZ() {
|
|
3010
|
+
const originPoint = this.getOriginPoint();
|
|
3011
|
+
return this.getDepth() * originPoint[2];
|
|
3012
|
+
}
|
|
3013
|
+
|
|
3024
3014
|
getCenterX() {
|
|
3025
3015
|
const centerPoint = this.getCenterPoint();
|
|
3026
3016
|
return this.getWidth() * centerPoint[0];
|
|
@@ -3031,6 +3021,11 @@ module.exports = {
|
|
|
3031
3021
|
return this.getHeight() * centerPoint[1];
|
|
3032
3022
|
}
|
|
3033
3023
|
|
|
3024
|
+
getCenterZ() {
|
|
3025
|
+
const centerPoint = this.getCenterPoint();
|
|
3026
|
+
return this.getDepth() * centerPoint[2];
|
|
3027
|
+
}
|
|
3028
|
+
|
|
3034
3029
|
getOriginPoint() {
|
|
3035
3030
|
return this._originPoint || this._modelOriginPoint;
|
|
3036
3031
|
}
|
|
@@ -3124,14 +3119,51 @@ module.exports = {
|
|
|
3124
3119
|
modelDepth < epsilon
|
|
3125
3120
|
? Number.POSITIVE_INFINITY
|
|
3126
3121
|
: originalDepth / modelDepth;
|
|
3127
|
-
|
|
3128
|
-
if (!Number.isFinite(
|
|
3129
|
-
|
|
3122
|
+
const minScaleRatio = Math.min(widthRatio, heightRatio, depthRatio);
|
|
3123
|
+
if (!Number.isFinite(minScaleRatio)) {
|
|
3124
|
+
this._defaultWidth = modelWidth;
|
|
3125
|
+
this._defaultHeight = modelHeight;
|
|
3126
|
+
this._defaultDepth = modelDepth;
|
|
3127
|
+
} else {
|
|
3128
|
+
if (widthRatio === minScaleRatio) {
|
|
3129
|
+
this._defaultWidth = originalWidth;
|
|
3130
|
+
this._defaultHeight = Rendered3DInstance.applyRatio({
|
|
3131
|
+
oldReferenceValue: modelWidth,
|
|
3132
|
+
newReferenceValue: originalWidth,
|
|
3133
|
+
valueToApplyTo: modelHeight,
|
|
3134
|
+
});
|
|
3135
|
+
this._defaultDepth = Rendered3DInstance.applyRatio({
|
|
3136
|
+
oldReferenceValue: modelWidth,
|
|
3137
|
+
newReferenceValue: originalWidth,
|
|
3138
|
+
valueToApplyTo: modelDepth,
|
|
3139
|
+
});
|
|
3140
|
+
} else if (heightRatio === minScaleRatio) {
|
|
3141
|
+
this._defaultWidth = Rendered3DInstance.applyRatio({
|
|
3142
|
+
oldReferenceValue: modelHeight,
|
|
3143
|
+
newReferenceValue: originalHeight,
|
|
3144
|
+
valueToApplyTo: modelWidth,
|
|
3145
|
+
});
|
|
3146
|
+
|
|
3147
|
+
this._defaultHeight = originalHeight;
|
|
3148
|
+
this._defaultDepth = Rendered3DInstance.applyRatio({
|
|
3149
|
+
oldReferenceValue: modelHeight,
|
|
3150
|
+
newReferenceValue: originalHeight,
|
|
3151
|
+
valueToApplyTo: modelDepth,
|
|
3152
|
+
});
|
|
3153
|
+
} else {
|
|
3154
|
+
this._defaultWidth = Rendered3DInstance.applyRatio({
|
|
3155
|
+
oldReferenceValue: modelDepth,
|
|
3156
|
+
newReferenceValue: originalDepth,
|
|
3157
|
+
valueToApplyTo: modelWidth,
|
|
3158
|
+
});
|
|
3159
|
+
this._defaultHeight = Rendered3DInstance.applyRatio({
|
|
3160
|
+
oldReferenceValue: modelDepth,
|
|
3161
|
+
newReferenceValue: originalDepth,
|
|
3162
|
+
valueToApplyTo: modelHeight,
|
|
3163
|
+
});
|
|
3164
|
+
this._defaultDepth = originalDepth;
|
|
3165
|
+
}
|
|
3130
3166
|
}
|
|
3131
|
-
|
|
3132
|
-
this._defaultWidth = scaleRatio * modelWidth;
|
|
3133
|
-
this._defaultHeight = scaleRatio * modelHeight;
|
|
3134
|
-
this._defaultDepth = scaleRatio * modelDepth;
|
|
3135
3167
|
}
|
|
3136
3168
|
}
|
|
3137
3169
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var gdjs;(function(t){t.PixiFiltersTools.registerFilterCreator("Scene3D::LinearFog",new class{makeFilter(n
|
|
1
|
+
var gdjs;(function(t){t.PixiFiltersTools.registerFilterCreator("Scene3D::LinearFog",new class{makeFilter(o,n){return typeof THREE=="undefined"?new t.PixiFiltersTools.EmptyFilter:new class{constructor(){this.fog=new THREE.Fog(16777215)}isEnabled(e){const r=e.get3DRendererObject();return r?r.fog===this.fog:!1}setEnabled(e,r){return r?this.applyEffect(e):this.removeEffect(e)}applyEffect(e){const r=e.get3DRendererObject();return!r||r.fog===void 0?!1:(r.fog=this.fog,!0)}removeEffect(e){const r=e.get3DRendererObject();return!r||r.fog===void 0?!1:(r.fog=null,!0)}updatePreRender(e){}updateDoubleParameter(e,r){e==="near"?this.fog.near=r:e==="far"&&(this.fog.far=r)}getDoubleParameter(e){return e==="near"?this.fog.near:e==="far"?this.fog.far:0}updateStringParameter(e,r){e==="color"&&(this.fog.color=new THREE.Color(t.PixiFiltersTools.rgbOrHexToHexNumber(r)))}updateColorParameter(e,r){e==="color"&&this.fog.color.setHex(r)}getColorParameter(e){return e==="color"?this.fog.color.getHex():0}updateBooleanParameter(e,r){}getNetworkSyncData(){return{n:this.fog.near,f:this.fog.far,c:this.fog.color.getHex()}}updateFromNetworkSyncData(e){this.fog.near=e.n,this.fog.far=e.f,this.fog.color.setHex(e.c)}}}})})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=LinearFog.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../GDevelop/Extensions/3D/LinearFog.ts"],
|
|
4
|
-
"sourcesContent": ["namespace gdjs {\n gdjs.PixiFiltersTools.registerFilterCreator(\n 'Scene3D::LinearFog',\n new (class implements gdjs.PixiFiltersTools.FilterCreator {\n makeFilter(\n target: EffectsTarget,\n effectData: EffectData\n ): gdjs.PixiFiltersTools.Filter {\n if (typeof THREE === 'undefined') {\n return new gdjs.PixiFiltersTools.EmptyFilter();\n }\n return new (class implements gdjs.PixiFiltersTools.Filter {\n fog: THREE.Fog;\n\n constructor() {\n this.fog = new THREE.Fog(0xffffff);\n }\n\n isEnabled(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n return scene ? scene.fog === this.fog : false;\n }\n setEnabled(target: EffectsTarget, enabled: boolean): boolean {\n if (enabled) {\n return this.applyEffect(target);\n } else {\n return this.removeEffect(target);\n }\n }\n applyEffect(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n if (!scene || scene.fog === undefined) {\n return false;\n }\n scene.fog = this.fog;\n return true;\n }\n removeEffect(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n if (!scene || scene.fog === undefined) {\n return false;\n }\n scene.fog = null;\n return true;\n }\n updatePreRender(target: gdjs.EffectsTarget): any {}\n updateDoubleParameter(parameterName: string, value: number): void {\n if (parameterName === 'near') {\n this.fog.near = value;\n } else if (parameterName === 'far') {\n this.fog.far = value;\n }\n }\n getDoubleParameter(parameterName: string): number {\n if (parameterName === 'near') {\n return this.fog.near;\n } else if (parameterName === 'far') {\n return this.fog.far;\n }\n return 0;\n }\n updateStringParameter(parameterName: string, value: string): void {\n if (parameterName === 'color') {\n this.fog.color = new THREE.Color(\n gdjs.PixiFiltersTools.rgbOrHexToHexNumber(value)\n );\n }\n }\n updateColorParameter(parameterName: string, value: number): void {\n if (parameterName === 'color') {\n this.fog.color.setHex(value);\n }\n }\n getColorParameter(parameterName: string): number {\n if (parameterName === 'color') {\n return this.fog.color.getHex();\n }\n return 0;\n }\n updateBooleanParameter(parameterName: string, value: boolean): void {}\n })();\n }\n })()\n );\n}\n"],
|
|
5
|
-
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,
|
|
4
|
+
"sourcesContent": ["namespace gdjs {\n interface LinearFogFilterNetworkSyncData {\n n: number;\n f: number;\n c: number;\n }\n gdjs.PixiFiltersTools.registerFilterCreator(\n 'Scene3D::LinearFog',\n new (class implements gdjs.PixiFiltersTools.FilterCreator {\n makeFilter(\n target: EffectsTarget,\n effectData: EffectData\n ): gdjs.PixiFiltersTools.Filter {\n if (typeof THREE === 'undefined') {\n return new gdjs.PixiFiltersTools.EmptyFilter();\n }\n return new (class implements gdjs.PixiFiltersTools.Filter {\n fog: THREE.Fog;\n\n constructor() {\n this.fog = new THREE.Fog(0xffffff);\n }\n\n isEnabled(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n return scene ? scene.fog === this.fog : false;\n }\n setEnabled(target: EffectsTarget, enabled: boolean): boolean {\n if (enabled) {\n return this.applyEffect(target);\n } else {\n return this.removeEffect(target);\n }\n }\n applyEffect(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n if (!scene || scene.fog === undefined) {\n return false;\n }\n scene.fog = this.fog;\n return true;\n }\n removeEffect(target: EffectsTarget): boolean {\n const scene = target.get3DRendererObject() as\n | THREE.Scene\n | null\n | undefined;\n if (!scene || scene.fog === undefined) {\n return false;\n }\n scene.fog = null;\n return true;\n }\n updatePreRender(target: gdjs.EffectsTarget): any {}\n updateDoubleParameter(parameterName: string, value: number): void {\n if (parameterName === 'near') {\n this.fog.near = value;\n } else if (parameterName === 'far') {\n this.fog.far = value;\n }\n }\n getDoubleParameter(parameterName: string): number {\n if (parameterName === 'near') {\n return this.fog.near;\n } else if (parameterName === 'far') {\n return this.fog.far;\n }\n return 0;\n }\n updateStringParameter(parameterName: string, value: string): void {\n if (parameterName === 'color') {\n this.fog.color = new THREE.Color(\n gdjs.PixiFiltersTools.rgbOrHexToHexNumber(value)\n );\n }\n }\n updateColorParameter(parameterName: string, value: number): void {\n if (parameterName === 'color') {\n this.fog.color.setHex(value);\n }\n }\n getColorParameter(parameterName: string): number {\n if (parameterName === 'color') {\n return this.fog.color.getHex();\n }\n return 0;\n }\n updateBooleanParameter(parameterName: string, value: boolean): void {}\n getNetworkSyncData(): LinearFogFilterNetworkSyncData {\n return {\n n: this.fog.near,\n f: this.fog.far,\n c: this.fog.color.getHex(),\n };\n }\n updateFromNetworkSyncData(\n data: LinearFogFilterNetworkSyncData\n ): void {\n this.fog.near = data.n;\n this.fog.far = data.f;\n this.fog.color.setHex(data.c);\n }\n })();\n }\n })()\n );\n}\n"],
|
|
5
|
+
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAME,EAAK,iBAAiB,sBACpB,qBACA,GAAK,MAAqD,CACxD,WACE,EACA,EAC8B,CAC9B,MAAI,OAAO,QAAU,YACZ,GAAI,GAAK,iBAAiB,YAE5B,GAAK,MAA8C,CAGxD,aAAc,CACZ,KAAK,IAAM,GAAI,OAAM,IAAI,UAG3B,UAAU,EAAgC,CACxC,KAAM,GAAQ,EAAO,sBAIrB,MAAO,GAAQ,EAAM,MAAQ,KAAK,IAAM,GAE1C,WAAW,EAAuB,EAA2B,CAC3D,MAAI,GACK,KAAK,YAAY,GAEjB,KAAK,aAAa,GAG7B,YAAY,EAAgC,CAC1C,KAAM,GAAQ,EAAO,sBAIrB,MAAI,CAAC,GAAS,EAAM,MAAQ,OACnB,GAET,GAAM,IAAM,KAAK,IACV,IAET,aAAa,EAAgC,CAC3C,KAAM,GAAQ,EAAO,sBAIrB,MAAI,CAAC,GAAS,EAAM,MAAQ,OACnB,GAET,GAAM,IAAM,KACL,IAET,gBAAgB,EAAiC,EACjD,sBAAsB,EAAuB,EAAqB,CAChE,AAAI,IAAkB,OACpB,KAAK,IAAI,KAAO,EACP,IAAkB,OAC3B,MAAK,IAAI,IAAM,GAGnB,mBAAmB,EAA+B,CAChD,MAAI,KAAkB,OACb,KAAK,IAAI,KACP,IAAkB,MACpB,KAAK,IAAI,IAEX,EAET,sBAAsB,EAAuB,EAAqB,CAChE,AAAI,IAAkB,SACpB,MAAK,IAAI,MAAQ,GAAI,OAAM,MACzB,EAAK,iBAAiB,oBAAoB,KAIhD,qBAAqB,EAAuB,EAAqB,CAC/D,AAAI,IAAkB,SACpB,KAAK,IAAI,MAAM,OAAO,GAG1B,kBAAkB,EAA+B,CAC/C,MAAI,KAAkB,QACb,KAAK,IAAI,MAAM,SAEjB,EAET,uBAAuB,EAAuB,EAAsB,EACpE,oBAAqD,CACnD,MAAO,CACL,EAAG,KAAK,IAAI,KACZ,EAAG,KAAK,IAAI,IACZ,EAAG,KAAK,IAAI,MAAM,UAGtB,0BACE,EACM,CACN,KAAK,IAAI,KAAO,EAAK,EACrB,KAAK,IAAI,IAAM,EAAK,EACpB,KAAK,IAAI,MAAM,OAAO,EAAK,UA1G7B",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var gdjs;(function(n){const o=r=>{switch(r){case"ModelOrigin":return null;case"ObjectCenter":return[.5,.5,.5];case"BottomCenterZ":return[.5,.5,0];case"BottomCenterY":return[.5,1,.5];case"TopLeft":return[0,0,0];default:return null}};class s extends n.RuntimeObject3D{constructor(t
|
|
1
|
+
var gdjs;(function(n){const o=r=>{switch(r){case"ModelOrigin":return null;case"ObjectCenter":return[.5,.5,.5];case"BottomCenterZ":return[.5,.5,0];case"BottomCenterY":return[.5,1,.5];case"TopLeft":return[0,0,0];default:return null}};class s extends n.RuntimeObject3D{constructor(e,t){super(e,t);this._materialType=n.Model3DRuntimeObject.MaterialType.Basic;this._currentAnimationIndex=0;this._animationSpeedScale=1;this._animationPaused=!1;this._modelResourceName=t.content.modelResourceName,this._animations=t.content.animations,this._originPoint=o(t.content.originLocation),this._centerPoint=o(t.content.centerLocation),this._renderer=new n.Model3DRuntimeObjectRenderer(this,e),this._materialType=this._convertMaterialType(t.content.materialType),this.onModelChanged(t),this.onCreated()}onModelChanged(e){this._updateModel(e),this._animations.length>0&&this._renderer.playAnimation(this._animations[0].source,this._animations[0].loop)}updateFromObjectData(e,t){return super.updateFromObjectData(e,t),e.content.materialType!==t.content.materialType&&(this._materialType=this._convertMaterialType(t.content.materialType)),e.content.modelResourceName!==t.content.modelResourceName?this._reloadModel(t):(e.content.width!==t.content.width||e.content.height!==t.content.height||e.content.depth!==t.content.depth||e.content.rotationX!==t.content.rotationX||e.content.rotationY!==t.content.rotationY||e.content.rotationZ!==t.content.rotationZ||e.content.keepAspectRatio!==t.content.keepAspectRatio||e.content.materialType!==t.content.materialType)&&this._updateModel(t),e.content.originLocation!==t.content.originLocation&&(this._originPoint=o(t.content.originLocation)),e.content.centerLocation!==t.content.centerLocation&&(this._centerPoint=o(t.content.centerLocation)),!0}getNetworkSyncData(){return{...super.getNetworkSyncData(),mt:this._materialType,op:this._originPoint,cp:this._centerPoint,anis:this._animations,ai:this._currentAnimationIndex,ass:this._animationSpeedScale,ap:this._animationPaused}}updateFromNetworkSyncData(e){super.updateFromNetworkSyncData(e),e.mt!==void 0&&(this._materialType=e.mt),e.op!==void 0&&(this._originPoint=e.op),e.cp!==void 0&&(this._centerPoint=e.cp),e.anis!==void 0&&(this._animations=e.anis),e.ai!==void 0&&this.setAnimationIndex(e.ai),e.ass!==void 0&&this.setAnimationSpeedScale(e.ass),e.ap!==void 0&&e.ap!==this.isAnimationPaused()&&(e.ap?this.pauseAnimation():this.resumeAnimation())}_reloadModel(e){this._modelResourceName=e.content.modelResourceName,this._renderer._reloadModel(this,this._runtimeScene),this.onModelChanged(e)}_updateModel(e){const t=e.content.rotationX||0,a=e.content.rotationY||0,d=e.content.rotationZ||0,i=e.content.keepAspectRatio;this._renderer._updateModel(t,a,d,this._getOriginalWidth(),this._getOriginalHeight(),this._getOriginalDepth(),i)}getRenderer(){return this._renderer}_convertMaterialType(e){return e==="KeepOriginal"?n.Model3DRuntimeObject.MaterialType.KeepOriginal:e==="StandardWithoutMetalness"?n.Model3DRuntimeObject.MaterialType.StandardWithoutMetalness:n.Model3DRuntimeObject.MaterialType.Basic}update(e){const t=this.getElapsedTime()/1e3;this._renderer.updateAnimation(t*this._animationSpeedScale)}getAnimationIndex(){return this._currentAnimationIndex}setAnimationIndex(e){if(e=e|0,e<this._animations.length&&this._currentAnimationIndex!==e&&e>=0){const t=this._animations[e];this._currentAnimationIndex=e,this._renderer.playAnimation(t.source,t.loop),this._animationPaused&&this._renderer.pauseAnimation()}}getAnimationName(){return this._currentAnimationIndex>=this._animations.length?"":this._animations[this._currentAnimationIndex].name}setAnimationName(e){if(!e)return;const t=this._animations.findIndex(a=>a.name===e);t>=0&&this.setAnimationIndex(t)}isCurrentAnimationName(e){return this.getAnimationName()===e}hasAnimationEnded(){return this._renderer.hasAnimationEnded()}isAnimationPaused(){return this._animationPaused}pauseAnimation(){this._animationPaused=!0,this._renderer.pauseAnimation()}resumeAnimation(){this._animationPaused=!1,this._renderer.resumeAnimation()}getAnimationSpeedScale(){return this._animationSpeedScale}setAnimationSpeedScale(e){this._animationSpeedScale=e}getAnimationElapsedTime(){return this._renderer.getAnimationElapsedTime()}setAnimationElapsedTime(e){this._renderer.setAnimationElapsedTime(e)}getAnimationDuration(){return this._renderer.getAnimationDuration(this._animations[this._currentAnimationIndex].source)}getCenterX(){const e=this._renderer.getCenterPoint();return this.getWidth()*e[0]}getCenterY(){const e=this._renderer.getCenterPoint();return this.getHeight()*e[1]}getCenterZ(){const e=this._renderer.getCenterPoint();return this.getDepth()*e[2]}getDrawableX(){const e=this._renderer.getOriginPoint();return this.getX()-this.getWidth()*e[0]}getDrawableY(){const e=this._renderer.getOriginPoint();return this.getY()-this.getHeight()*e[1]}getDrawableZ(){const e=this._renderer.getOriginPoint();return this.getZ()-this.getDepth()*e[2]}}n.Model3DRuntimeObject=s,function(e){let r;(function(i){i[i.Basic=0]="Basic",i[i.StandardWithoutMetalness=1]="StandardWithoutMetalness",i[i.KeepOriginal=2]="KeepOriginal"})(r=e.MaterialType||(e.MaterialType={}))}(s=n.Model3DRuntimeObject||(n.Model3DRuntimeObject={})),n.registerObject("Scene3D::Model3DObject",n.Model3DRuntimeObject)})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=Model3DRuntimeObject.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../GDevelop/Extensions/3D/Model3DRuntimeObject.ts"],
|
|
4
|
-
"sourcesContent": ["namespace gdjs {\n type Model3DAnimation = { name: string; source: string; loop: boolean };\n\n /** Base parameters for {@link gdjs.Cube3DRuntimeObject} */\n export interface Model3DObjectData extends Object3DData {\n /** The base parameters of the Model3D object */\n content: Object3DDataContent & {\n modelResourceName: string;\n rotationX: number;\n rotationY: number;\n rotationZ: number;\n keepAspectRatio: boolean;\n materialType: 'Basic' | 'StandardWithoutMetalness' | 'KeepOriginal';\n originLocation:\n | 'ModelOrigin'\n | 'ObjectCenter'\n | 'BottomCenterZ'\n | 'BottomCenterY'\n | 'TopLeft';\n centerLocation:\n | 'ModelOrigin'\n | 'ObjectCenter'\n | 'BottomCenterZ'\n | 'BottomCenterY';\n animations: Model3DAnimation[];\n };\n }\n\n type FloatPoint3D = [float, float, float];\n\n const getPointForLocation = (location: string): FloatPoint3D | null => {\n switch (location) {\n case 'ModelOrigin':\n return null;\n case 'ObjectCenter':\n return [0.5, 0.5, 0.5];\n case 'BottomCenterZ':\n return [0.5, 0.5, 0];\n case 'BottomCenterY':\n return [0.5, 1, 0.5];\n case 'TopLeft':\n return [0, 0, 0];\n default:\n return null;\n }\n };\n\n /**\n * A 3D object which displays a 3D model.\n */\n export class Model3DRuntimeObject\n extends gdjs.RuntimeObject3D\n implements gdjs.Animatable {\n _renderer: gdjs.Model3DRuntimeObjectRenderer;\n\n _modelResourceName: string;\n _materialType: gdjs.Model3DRuntimeObject.MaterialType =\n gdjs.Model3DRuntimeObject.MaterialType.Basic;\n\n /**\n * The local point of the model that will be at the object position.\n *\n * Coordinates are between 0 and 1.\n *\n * Its value is `null` when the point is configured to `\"ModelOrigin\"`\n * because the model origin needs to be evaluated according to the object\n * configuration.\n * @see gdjs.Model3DRuntimeObject3DRenderer.getOriginPoint\n */\n _originPoint: FloatPoint3D | null;\n /**\n * The local point of the model that is used as rotation center.\n *\n * Coordinates are between 0 and 1.\n *\n * Its value is `null` when the point is configured to `\"ModelOrigin\"`\n * because the model origin needs to be evaluated according to the object\n * configuration.\n * @see gdjs.Model3DRuntimeObject3DRenderer.getCenterPoint\n */\n _centerPoint: FloatPoint3D | null;\n\n _animations: Model3DAnimation[];\n _currentAnimationIndex: integer = 0;\n _animationSpeedScale: float = 1;\n _animationPaused: boolean = false;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n objectData: Model3DObjectData\n ) {\n super(instanceContainer, objectData);\n this._modelResourceName = objectData.content.modelResourceName;\n this._animations = objectData.content.animations;\n this._originPoint = getPointForLocation(\n objectData.content.originLocation\n );\n this._centerPoint = getPointForLocation(\n objectData.content.centerLocation\n );\n this._renderer = new gdjs.Model3DRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n this._materialType = this._convertMaterialType(\n objectData.content.materialType\n );\n this._updateModel(objectData);\n if (this._animations.length > 0) {\n this._renderer.playAnimation(\n this._animations[0].source,\n this._animations[0].loop\n );\n }\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n updateFromObjectData(\n oldObjectData: Model3DObjectData,\n newObjectData: Model3DObjectData\n ): boolean {\n super.updateFromObjectData(oldObjectData, newObjectData);\n if (\n oldObjectData.content.width !== newObjectData.content.width ||\n oldObjectData.content.height !== newObjectData.content.height ||\n oldObjectData.content.depth !== newObjectData.content.depth ||\n oldObjectData.content.rotationX !== newObjectData.content.rotationX ||\n oldObjectData.content.rotationY !== newObjectData.content.rotationY ||\n oldObjectData.content.rotationZ !== newObjectData.content.rotationZ ||\n oldObjectData.content.keepAspectRatio !==\n newObjectData.content.keepAspectRatio\n ) {\n this._updateModel(newObjectData);\n }\n if (\n oldObjectData.content.materialType !==\n newObjectData.content.materialType\n ) {\n this._materialType = this._convertMaterialType(\n newObjectData.content.materialType\n );\n this._updateModel(newObjectData);\n }\n if (\n oldObjectData.content.originLocation !==\n newObjectData.content.originLocation\n ) {\n this._originPoint = getPointForLocation(\n newObjectData.content.originLocation\n );\n }\n if (\n oldObjectData.content.centerLocation !==\n newObjectData.content.centerLocation\n ) {\n this._centerPoint = getPointForLocation(\n newObjectData.content.centerLocation\n );\n }\n return true;\n }\n\n _updateModel(objectData: Model3DObjectData) {\n const rotationX = objectData.content.rotationX || 0;\n const rotationY = objectData.content.rotationY || 0;\n const rotationZ = objectData.content.rotationZ || 0;\n const keepAspectRatio = objectData.content.keepAspectRatio;\n this._renderer._updateModel(\n rotationX,\n rotationY,\n rotationZ,\n this._getOriginalWidth(),\n this._getOriginalHeight(),\n this._getOriginalDepth(),\n keepAspectRatio\n );\n }\n\n getRenderer(): RuntimeObject3DRenderer {\n return this._renderer;\n }\n\n _convertMaterialType(\n materialTypeString: string\n ): gdjs.Model3DRuntimeObject.MaterialType {\n if (materialTypeString === 'KeepOriginal') {\n return gdjs.Model3DRuntimeObject.MaterialType.KeepOriginal;\n } else if (materialTypeString === 'StandardWithoutMetalness') {\n return gdjs.Model3DRuntimeObject.MaterialType.StandardWithoutMetalness;\n } else {\n return gdjs.Model3DRuntimeObject.MaterialType.Basic;\n }\n }\n\n update(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n const elapsedTime = this.getElapsedTime() / 1000;\n this._renderer.updateAnimation(elapsedTime * this._animationSpeedScale);\n }\n\n /**\n * Get the index of the animation being played.\n * @return The index of the new animation being played\n */\n getAnimationIndex(): number {\n return this._currentAnimationIndex;\n }\n\n /**\n * Change the animation being played.\n * @param animationIndex The index of the new animation to be played\n */\n setAnimationIndex(animationIndex: number): void {\n animationIndex = animationIndex | 0;\n if (\n animationIndex < this._animations.length &&\n this._currentAnimationIndex !== animationIndex &&\n animationIndex >= 0\n ) {\n const animation = this._animations[animationIndex];\n this._currentAnimationIndex = animationIndex;\n this._renderer.playAnimation(animation.source, animation.loop);\n if (this._animationPaused) {\n this._renderer.pauseAnimation();\n }\n }\n }\n\n /**\n * Get the name of the animation being played.\n * @return The name of the new animation being played\n */\n getAnimationName(): string {\n if (this._currentAnimationIndex >= this._animations.length) {\n return '';\n }\n return this._animations[this._currentAnimationIndex].name;\n }\n\n /**\n * Change the animation being played.\n * @param newAnimationName The name of the new animation to be played\n */\n setAnimationName(newAnimationName: string): void {\n if (!newAnimationName) {\n return;\n }\n const animationIndex = this._animations.findIndex(\n (animation) => animation.name === newAnimationName\n );\n if (animationIndex >= 0) {\n this.setAnimationIndex(animationIndex);\n }\n }\n\n isCurrentAnimationName(name: string): boolean {\n return this.getAnimationName() === name;\n }\n\n /**\n * Return true if animation has ended.\n * The animation had ended if:\n * - it's not configured as a loop;\n * - the current frame is the last frame;\n * - the last frame has been displayed long enough.\n */\n hasAnimationEnded(): boolean {\n return this._renderer.hasAnimationEnded();\n }\n\n isAnimationPaused() {\n return this._animationPaused;\n }\n\n pauseAnimation() {\n this._animationPaused = true;\n this._renderer.pauseAnimation();\n }\n\n resumeAnimation() {\n this._animationPaused = false;\n this._renderer.resumeAnimation();\n }\n\n getAnimationSpeedScale() {\n return this._animationSpeedScale;\n }\n\n setAnimationSpeedScale(ratio: float): void {\n this._animationSpeedScale = ratio;\n }\n\n getAnimationElapsedTime(): float {\n return this._renderer.getAnimationElapsedTime();\n }\n\n setAnimationElapsedTime(time: float): void {\n this._renderer.setAnimationElapsedTime(time);\n }\n\n getAnimationDuration(): float {\n return this._renderer.getAnimationDuration(\n this._animations[this._currentAnimationIndex].source\n );\n }\n\n getCenterX(): float {\n const centerPoint = this._renderer.getCenterPoint();\n return this.getWidth() * centerPoint[0];\n }\n\n getCenterY(): float {\n const centerPoint = this._renderer.getCenterPoint();\n return this.getHeight() * centerPoint[1];\n }\n\n getCenterZ(): float {\n const centerPoint = this._renderer.getCenterPoint();\n return this.getDepth() * centerPoint[2];\n }\n\n getDrawableX(): float {\n const originPoint = this._renderer.getOriginPoint();\n return this.getX() - this.getWidth() * originPoint[0];\n }\n\n getDrawableY(): float {\n const originPoint = this._renderer.getOriginPoint();\n return this.getY() - this.getHeight() * originPoint[1];\n }\n\n getDrawableZ(): float {\n const originPoint = this._renderer.getOriginPoint();\n return this.getZ() - this.getDepth() * originPoint[2];\n }\n }\n\n export namespace Model3DRuntimeObject {\n export enum MaterialType {\n Basic,\n StandardWithoutMetalness,\n KeepOriginal,\n }\n }\n gdjs.registerObject('Scene3D::Model3DObject', gdjs.Model3DRuntimeObject);\n}\n"],
|
|
5
|
-
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,
|
|
4
|
+
"sourcesContent": ["namespace gdjs {\n type Model3DAnimation = { name: string; source: string; loop: boolean };\n\n type Model3DObjectNetworkSyncDataType = {\n mt: number;\n op: FloatPoint3D | null;\n cp: FloatPoint3D | null;\n anis: Model3DAnimation[];\n ai: integer;\n ass: float;\n ap: boolean;\n };\n\n type Model3DObjectNetworkSyncData = Object3DNetworkSyncData &\n Model3DObjectNetworkSyncDataType;\n\n /** Base parameters for {@link gdjs.Cube3DRuntimeObject} */\n export interface Model3DObjectData extends Object3DData {\n /** The base parameters of the Model3D object */\n content: Object3DDataContent & {\n modelResourceName: string;\n rotationX: number;\n rotationY: number;\n rotationZ: number;\n keepAspectRatio: boolean;\n materialType: 'Basic' | 'StandardWithoutMetalness' | 'KeepOriginal';\n originLocation:\n | 'ModelOrigin'\n | 'ObjectCenter'\n | 'BottomCenterZ'\n | 'BottomCenterY'\n | 'TopLeft';\n centerLocation:\n | 'ModelOrigin'\n | 'ObjectCenter'\n | 'BottomCenterZ'\n | 'BottomCenterY';\n animations: Model3DAnimation[];\n };\n }\n\n type FloatPoint3D = [float, float, float];\n\n const getPointForLocation = (location: string): FloatPoint3D | null => {\n switch (location) {\n case 'ModelOrigin':\n return null;\n case 'ObjectCenter':\n return [0.5, 0.5, 0.5];\n case 'BottomCenterZ':\n return [0.5, 0.5, 0];\n case 'BottomCenterY':\n return [0.5, 1, 0.5];\n case 'TopLeft':\n return [0, 0, 0];\n default:\n return null;\n }\n };\n\n /**\n * A 3D object which displays a 3D model.\n */\n export class Model3DRuntimeObject\n extends gdjs.RuntimeObject3D\n implements gdjs.Animatable {\n _renderer: gdjs.Model3DRuntimeObjectRenderer;\n\n _modelResourceName: string;\n _materialType: gdjs.Model3DRuntimeObject.MaterialType =\n gdjs.Model3DRuntimeObject.MaterialType.Basic;\n\n /**\n * The local point of the model that will be at the object position.\n *\n * Coordinates are between 0 and 1.\n *\n * Its value is `null` when the point is configured to `\"ModelOrigin\"`\n * because the model origin needs to be evaluated according to the object\n * configuration.\n * @see gdjs.Model3DRuntimeObject3DRenderer.getOriginPoint\n */\n _originPoint: FloatPoint3D | null;\n /**\n * The local point of the model that is used as rotation center.\n *\n * Coordinates are between 0 and 1.\n *\n * Its value is `null` when the point is configured to `\"ModelOrigin\"`\n * because the model origin needs to be evaluated according to the object\n * configuration.\n * @see gdjs.Model3DRuntimeObject3DRenderer.getCenterPoint\n */\n _centerPoint: FloatPoint3D | null;\n\n _animations: Model3DAnimation[];\n _currentAnimationIndex: integer = 0;\n _animationSpeedScale: float = 1;\n _animationPaused: boolean = false;\n\n constructor(\n instanceContainer: gdjs.RuntimeInstanceContainer,\n objectData: Model3DObjectData\n ) {\n super(instanceContainer, objectData);\n this._modelResourceName = objectData.content.modelResourceName;\n this._animations = objectData.content.animations;\n this._originPoint = getPointForLocation(\n objectData.content.originLocation\n );\n this._centerPoint = getPointForLocation(\n objectData.content.centerLocation\n );\n this._renderer = new gdjs.Model3DRuntimeObjectRenderer(\n this,\n instanceContainer\n );\n this._materialType = this._convertMaterialType(\n objectData.content.materialType\n );\n\n this.onModelChanged(objectData);\n\n // *ALWAYS* call `this.onCreated()` at the very end of your object constructor.\n this.onCreated();\n }\n\n /**\n * To be called after the renderer loaded a Model resource:\n * - After the renderer was instantiated\n * - After reloading the model\n */\n private onModelChanged(objectData) {\n this._updateModel(objectData);\n if (this._animations.length > 0) {\n this._renderer.playAnimation(\n this._animations[0].source,\n this._animations[0].loop\n );\n }\n }\n\n updateFromObjectData(\n oldObjectData: Model3DObjectData,\n newObjectData: Model3DObjectData\n ): boolean {\n super.updateFromObjectData(oldObjectData, newObjectData);\n\n if (\n oldObjectData.content.materialType !==\n newObjectData.content.materialType\n ) {\n this._materialType = this._convertMaterialType(\n newObjectData.content.materialType\n );\n }\n if (\n oldObjectData.content.modelResourceName !==\n newObjectData.content.modelResourceName\n ) {\n this._reloadModel(newObjectData);\n } else if (\n oldObjectData.content.width !== newObjectData.content.width ||\n oldObjectData.content.height !== newObjectData.content.height ||\n oldObjectData.content.depth !== newObjectData.content.depth ||\n oldObjectData.content.rotationX !== newObjectData.content.rotationX ||\n oldObjectData.content.rotationY !== newObjectData.content.rotationY ||\n oldObjectData.content.rotationZ !== newObjectData.content.rotationZ ||\n oldObjectData.content.keepAspectRatio !==\n newObjectData.content.keepAspectRatio ||\n oldObjectData.content.materialType !==\n newObjectData.content.materialType\n ) {\n this._updateModel(newObjectData);\n }\n if (\n oldObjectData.content.originLocation !==\n newObjectData.content.originLocation\n ) {\n this._originPoint = getPointForLocation(\n newObjectData.content.originLocation\n );\n }\n if (\n oldObjectData.content.centerLocation !==\n newObjectData.content.centerLocation\n ) {\n this._centerPoint = getPointForLocation(\n newObjectData.content.centerLocation\n );\n }\n return true;\n }\n\n getNetworkSyncData(): Model3DObjectNetworkSyncData {\n return {\n ...super.getNetworkSyncData(),\n mt: this._materialType,\n op: this._originPoint,\n cp: this._centerPoint,\n anis: this._animations,\n ai: this._currentAnimationIndex,\n ass: this._animationSpeedScale,\n ap: this._animationPaused,\n };\n }\n\n updateFromNetworkSyncData(\n networkSyncData: Model3DObjectNetworkSyncData\n ): void {\n super.updateFromNetworkSyncData(networkSyncData);\n\n if (networkSyncData.mt !== undefined) {\n this._materialType = networkSyncData.mt;\n }\n if (networkSyncData.op !== undefined) {\n this._originPoint = networkSyncData.op;\n }\n if (networkSyncData.cp !== undefined) {\n this._centerPoint = networkSyncData.cp;\n }\n if (networkSyncData.anis !== undefined) {\n this._animations = networkSyncData.anis;\n }\n if (networkSyncData.ai !== undefined) {\n this.setAnimationIndex(networkSyncData.ai);\n }\n if (networkSyncData.ass !== undefined) {\n this.setAnimationSpeedScale(networkSyncData.ass);\n }\n if (networkSyncData.ap !== undefined) {\n if (networkSyncData.ap !== this.isAnimationPaused()) {\n networkSyncData.ap ? this.pauseAnimation() : this.resumeAnimation();\n }\n }\n }\n\n _reloadModel(objectData: Model3DObjectData) {\n this._modelResourceName = objectData.content.modelResourceName;\n this._renderer._reloadModel(this, this._runtimeScene);\n this.onModelChanged(objectData);\n }\n\n _updateModel(objectData: Model3DObjectData) {\n const rotationX = objectData.content.rotationX || 0;\n const rotationY = objectData.content.rotationY || 0;\n const rotationZ = objectData.content.rotationZ || 0;\n const keepAspectRatio = objectData.content.keepAspectRatio;\n this._renderer._updateModel(\n rotationX,\n rotationY,\n rotationZ,\n this._getOriginalWidth(),\n this._getOriginalHeight(),\n this._getOriginalDepth(),\n keepAspectRatio\n );\n }\n\n getRenderer(): RuntimeObject3DRenderer {\n return this._renderer;\n }\n\n _convertMaterialType(\n materialTypeString: string\n ): gdjs.Model3DRuntimeObject.MaterialType {\n if (materialTypeString === 'KeepOriginal') {\n return gdjs.Model3DRuntimeObject.MaterialType.KeepOriginal;\n } else if (materialTypeString === 'StandardWithoutMetalness') {\n return gdjs.Model3DRuntimeObject.MaterialType.StandardWithoutMetalness;\n } else {\n return gdjs.Model3DRuntimeObject.MaterialType.Basic;\n }\n }\n\n update(instanceContainer: gdjs.RuntimeInstanceContainer): void {\n const elapsedTime = this.getElapsedTime() / 1000;\n this._renderer.updateAnimation(elapsedTime * this._animationSpeedScale);\n }\n\n /**\n * Get the index of the animation being played.\n * @return The index of the new animation being played\n */\n getAnimationIndex(): number {\n return this._currentAnimationIndex;\n }\n\n /**\n * Change the animation being played.\n * @param animationIndex The index of the new animation to be played\n */\n setAnimationIndex(animationIndex: number): void {\n animationIndex = animationIndex | 0;\n if (\n animationIndex < this._animations.length &&\n this._currentAnimationIndex !== animationIndex &&\n animationIndex >= 0\n ) {\n const animation = this._animations[animationIndex];\n this._currentAnimationIndex = animationIndex;\n this._renderer.playAnimation(animation.source, animation.loop);\n if (this._animationPaused) {\n this._renderer.pauseAnimation();\n }\n }\n }\n\n /**\n * Get the name of the animation being played.\n * @return The name of the new animation being played\n */\n getAnimationName(): string {\n if (this._currentAnimationIndex >= this._animations.length) {\n return '';\n }\n return this._animations[this._currentAnimationIndex].name;\n }\n\n /**\n * Change the animation being played.\n * @param newAnimationName The name of the new animation to be played\n */\n setAnimationName(newAnimationName: string): void {\n if (!newAnimationName) {\n return;\n }\n const animationIndex = this._animations.findIndex(\n (animation) => animation.name === newAnimationName\n );\n if (animationIndex >= 0) {\n this.setAnimationIndex(animationIndex);\n }\n }\n\n isCurrentAnimationName(name: string): boolean {\n return this.getAnimationName() === name;\n }\n\n /**\n * Return true if animation has ended.\n * The animation had ended if:\n * - it's not configured as a loop;\n * - the current frame is the last frame;\n * - the last frame has been displayed long enough.\n */\n hasAnimationEnded(): boolean {\n return this._renderer.hasAnimationEnded();\n }\n\n isAnimationPaused() {\n return this._animationPaused;\n }\n\n pauseAnimation() {\n this._animationPaused = true;\n this._renderer.pauseAnimation();\n }\n\n resumeAnimation() {\n this._animationPaused = false;\n this._renderer.resumeAnimation();\n }\n\n getAnimationSpeedScale() {\n return this._animationSpeedScale;\n }\n\n setAnimationSpeedScale(ratio: float): void {\n this._animationSpeedScale = ratio;\n }\n\n getAnimationElapsedTime(): float {\n return this._renderer.getAnimationElapsedTime();\n }\n\n setAnimationElapsedTime(time: float): void {\n this._renderer.setAnimationElapsedTime(time);\n }\n\n getAnimationDuration(): float {\n return this._renderer.getAnimationDuration(\n this._animations[this._currentAnimationIndex].source\n );\n }\n\n getCenterX(): float {\n const centerPoint = this._renderer.getCenterPoint();\n return this.getWidth() * centerPoint[0];\n }\n\n getCenterY(): float {\n const centerPoint = this._renderer.getCenterPoint();\n return this.getHeight() * centerPoint[1];\n }\n\n getCenterZ(): float {\n const centerPoint = this._renderer.getCenterPoint();\n return this.getDepth() * centerPoint[2];\n }\n\n getDrawableX(): float {\n const originPoint = this._renderer.getOriginPoint();\n return this.getX() - this.getWidth() * originPoint[0];\n }\n\n getDrawableY(): float {\n const originPoint = this._renderer.getOriginPoint();\n return this.getY() - this.getHeight() * originPoint[1];\n }\n\n getDrawableZ(): float {\n const originPoint = this._renderer.getOriginPoint();\n return this.getZ() - this.getDepth() * originPoint[2];\n }\n }\n\n export namespace Model3DRuntimeObject {\n export enum MaterialType {\n Basic,\n StandardWithoutMetalness,\n KeepOriginal,\n }\n }\n gdjs.registerObject('Scene3D::Model3DObject', gdjs.Model3DRuntimeObject);\n}\n"],
|
|
5
|
+
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CA2CE,KAAM,GAAsB,AAAC,GAA0C,CACrE,OAAQ,OACD,cACH,MAAO,UACJ,eACH,MAAO,CAAC,GAAK,GAAK,QACf,gBACH,MAAO,CAAC,GAAK,GA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AK,WAAa,EAAY,GAGvC,cAAsB,CACpB,KAAM,GAAc,KAAK,UAAU,iBACnC,MAAO,MAAK,OAAS,KAAK,WAAa,EAAY,GAGrD,cAAsB,CACpB,KAAM,GAAc,KAAK,UAAU,iBACnC,MAAO,MAAK,OAAS,KAAK,YAAc,EAAY,GAGtD,cAAsB,CACpB,KAAM,GAAc,KAAK,UAAU,iBACnC,MAAO,MAAK,OAAS,KAAK,WAAa,EAAY,IA9VhD,EAAM,uBAkWN,SAAU,EAAV,CACE,GAAK,GAAL,UAAK,EAAL,CACL,qBACA,2DACA,qCAHU,wCADG,uDAOjB,EAAK,eAAe,yBAA0B,EAAK,wBAxa3C",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var gdjs;(function(o){const a=1/(1<<16),
|
|
1
|
+
var gdjs;(function(o){const a=1/(1<<16),g=i=>{i.metalness&&(i.metalness=0)},T=i=>{const t=i;if(!!t.material)if(Array.isArray(t.material))for(let e=0;e<t.material.length;e++)g(t.material[e]);else g(t.material)},f=i=>i.traverse(T),M=i=>{const t=new THREE.MeshBasicMaterial;return i.color&&(t.color=i.color),i.map&&(t.map=i.map),t},b=i=>{const t=i;if(!!t.material)if(Array.isArray(t.material))for(let e=0;e<t.material.length;e++)t.material[e]=M(t.material[e]);else t.material=M(t.material)},D=i=>i.traverse(b);class j extends o.RuntimeObject3DRenderer{constructor(t,e){const s=e.getGame().getModel3DManager().getModel(t._modelResourceName),r=new THREE.Group,h=new THREE.Group;h.rotation.order="ZYX",h.add(r);super(t,e,h);this._model3DRuntimeObject=t,this._threeObject=r,this._originalModel=s,this._modelOriginPoint=[0,0,0],this.updateSize(),this.updatePosition(),this.updateRotation(),this._animationMixer=new THREE.AnimationMixer(r),this._action=null}updateAnimation(t){this._animationMixer.update(t)}updatePosition(){const t=this.getOriginPoint(),e=this.getCenterPoint();this.get3DRendererObject().position.set(this._object.getX()-this._object.getWidth()*(t[0]-e[0]),this._object.getY()-this._object.getHeight()*(t[1]-e[1]),this._object.getZ()-this._object.getDepth()*(t[2]-e[2]))}getOriginPoint(){return this._model3DRuntimeObject._originPoint||this._modelOriginPoint}getCenterPoint(){return this._model3DRuntimeObject._centerPoint||this._modelOriginPoint}_updateDefaultTransformation(t,e,s,r,h,R,p,l){t.rotation.set(o.toRad(e),o.toRad(s),o.toRad(r)),t.updateMatrixWorld(!0);const n=new THREE.Box3().setFromObject(t);!this._model3DRuntimeObject._originPoint&&n.expandByPoint(new THREE.Vector3(0,0,0));const m=n.max.x-n.min.x,c=n.max.y-n.min.y,d=n.max.z-n.min.z;this._modelOriginPoint[0]=m<a?0:-n.min.x/m,this._modelOriginPoint[1]=c<a?0:-n.min.y/c,this._modelOriginPoint[2]=d<a?0:-n.min.z/d,this._modelOriginPoint[1]=1-this._modelOriginPoint[1];const u=this._model3DRuntimeObject._centerPoint;u&&t.position.set(-(n.min.x+m*u[0]),-(n.min.y+c*(1-u[1])),-(n.min.z+d*u[2])),t.scale.set(1,1,1),t.rotation.set(o.toRad(e),o.toRad(s),o.toRad(r));const x=m<a?1:1/m,H=c<a?1:1/c,P=d<a?1:1/d,O=new THREE.Matrix4;if(O.makeScale(x,-H,P),t.updateMatrix(),t.applyMatrix4(O),l){const A=m<a?Number.POSITIVE_INFINITY:h/m,I=c<a?Number.POSITIVE_INFINITY:R/c,v=d<a?Number.POSITIVE_INFINITY:p/d;let _=Math.min(A,I,v);Number.isFinite(_)||(_=1),this._object._setOriginalWidth(_*m),this._object._setOriginalHeight(_*c),this._object._setOriginalDepth(_*d)}}_reloadModel(t,e){this._originalModel=e.getGame().getModel3DManager().getModel(t._modelResourceName)}_updateModel(t,e,s,r,h,R,p){const l=new THREE.Group;l.rotation.order="ZYX";const n=THREE_ADDONS.SkeletonUtils.clone(this._originalModel.scene);l.add(n),this._replaceMaterials(l),this._updateDefaultTransformation(l,t,e,s,r,h,R,p),this.get3DRendererObject().remove(this._threeObject),this.get3DRendererObject().add(l),this._threeObject=l,this._animationMixer=new THREE.AnimationMixer(n);const E=this._model3DRuntimeObject.isAnimationPaused();this._model3DRuntimeObject.setAnimationIndex(this._model3DRuntimeObject.getAnimationIndex()),E&&this.pauseAnimation()}_replaceMaterials(t){this._model3DRuntimeObject._materialType===o.Model3DRuntimeObject.MaterialType.StandardWithoutMetalness?f(t):this._model3DRuntimeObject._materialType===o.Model3DRuntimeObject.MaterialType.Basic&&D(t)}getAnimationCount(){return this._originalModel.animations.length}getAnimationName(t){return this._originalModel.animations[t].name}hasAnimationEnded(){return this._action?!this._action.isRunning():!0}animationPaused(){if(!!this._action)return this._action.paused}pauseAnimation(){!this._action||(this._action.paused=!0)}resumeAnimation(){!this._action||(this._action.paused=!1)}playAnimation(t,e){this._animationMixer.stopAllAction();const s=THREE.AnimationClip.findByName(this._originalModel.animations,t);if(!s){console.error(`The GLB file: ${this._model3DRuntimeObject._modelResourceName} doesn't have any animation named: ${t}`);return}this._action=this._animationMixer.clipAction(s),this._action.setLoop(e?THREE.LoopRepeat:THREE.LoopOnce,Number.POSITIVE_INFINITY),this._action.clampWhenFinished=!0,this._action.play(),this._animationMixer.update(0)}getAnimationElapsedTime(){return this._action?this._action.time:0}setAnimationElapsedTime(t){this._action&&(this._action.time=t)}getAnimationDuration(t){const e=THREE.AnimationClip.findByName(this._originalModel.animations,t);return e?e.duration:0}}o.Model3DRuntimeObjectRenderer=j})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=Model3DRuntimeObject3DRenderer.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../GDevelop/Extensions/3D/Model3DRuntimeObject3DRenderer.ts"],
|
|
4
|
-
"sourcesContent": ["namespace gdjs {\n type FloatPoint3D = [float, float, float];\n\n const epsilon = 1 / (1 << 16);\n\n const removeMetalness = (material: THREE.Material): void => {\n //@ts-ignore\n if (material.metalness) {\n //@ts-ignore\n material.metalness = 0;\n }\n };\n\n const removeMetalnessFromMesh = (node: THREE.Object3D) => {\n const mesh = node as THREE.Mesh;\n if (!mesh.material) {\n return;\n }\n if (Array.isArray(mesh.material)) {\n for (let index = 0; index < mesh.material.length; index++) {\n removeMetalness(mesh.material[index]);\n }\n } else {\n removeMetalness(mesh.material);\n }\n };\n\n const traverseToRemoveMetalnessFromMeshes = (node: THREE.Object3D) =>\n node.traverse(removeMetalnessFromMesh);\n\n const convertToBasicMaterial = (\n material: THREE.Material\n ): THREE.MeshBasicMaterial => {\n const basicMaterial = new THREE.MeshBasicMaterial();\n //@ts-ignore\n if (material.color) {\n //@ts-ignore\n basicMaterial.color = material.color;\n }\n //@ts-ignore\n if (material.map) {\n //@ts-ignore\n basicMaterial.map = material.map;\n }\n return basicMaterial;\n };\n\n const setBasicMaterialTo = (node: THREE.Object3D): void => {\n const mesh = node as THREE.Mesh;\n if (!mesh.material) {\n return;\n }\n\n if (Array.isArray(mesh.material)) {\n for (let index = 0; index < mesh.material.length; index++) {\n mesh.material[index] = convertToBasicMaterial(mesh.material[index]);\n }\n } else {\n mesh.material = convertToBasicMaterial(mesh.material);\n }\n };\n\n const traverseToSetBasicMaterialFromMeshes = (node: THREE.Object3D) =>\n node.traverse(setBasicMaterialTo);\n\n class Model3DRuntimeObject3DRenderer extends gdjs.RuntimeObject3DRenderer {\n private _model3DRuntimeObject: gdjs.Model3DRuntimeObject;\n /**\n * The 3D model stretched in a 1x1x1 cube.\n */\n private _threeObject: THREE.Object3D;\n private _originalModel: THREE_ADDONS.GLTF;\n private _animationMixer: THREE.AnimationMixer;\n private _action: THREE.AnimationAction | null;\n\n /**\n * The model origin evaluated according to the object configuration.\n *\n * Coordinates are between 0 and 1.\n */\n private _modelOriginPoint: FloatPoint3D;\n\n constructor(\n runtimeObject: gdjs.Model3DRuntimeObject,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ) {\n // GLB files with skeleton must not have any transformation to work properly.\n const originalModel = instanceContainer\n .getGame()\n .getModel3DManager()\n .getModel(runtimeObject._modelResourceName);\n // _updateModel will actually add a clone of the model.\n const model = new THREE.Group();\n\n // Create a group to transform the object according to\n // position, angle and dimensions.\n const group = new THREE.Group();\n group.rotation.order = 'ZYX';\n group.add(model);\n super(runtimeObject, instanceContainer, group);\n\n this._model3DRuntimeObject = runtimeObject;\n this._threeObject = model;\n this._originalModel = originalModel;\n this._modelOriginPoint = [0, 0, 0];\n\n this.updateSize();\n this.updatePosition();\n this.updateRotation();\n\n this._animationMixer = new THREE.AnimationMixer(model);\n this._action = null;\n }\n\n updateAnimation(timeDelta: float) {\n this._animationMixer.update(timeDelta);\n }\n\n updatePosition() {\n const originPoint = this.getOriginPoint();\n const centerPoint = this.getCenterPoint();\n this.get3DRendererObject().position.set(\n this._object.getX() -\n this._object.getWidth() * (originPoint[0] - centerPoint[0]),\n this._object.getY() -\n this._object.getHeight() * (originPoint[1] - centerPoint[1]),\n this._object.getZ() -\n this._object.getDepth() * (originPoint[2] - centerPoint[2])\n );\n }\n\n getOriginPoint() {\n return this._model3DRuntimeObject._originPoint || this._modelOriginPoint;\n }\n\n getCenterPoint() {\n return this._model3DRuntimeObject._centerPoint || this._modelOriginPoint;\n }\n\n private _updateDefaultTransformation(\n threeObject: THREE.Object3D,\n rotationX: float,\n rotationY: float,\n rotationZ: float,\n originalWidth: float,\n originalHeight: float,\n originalDepth: float,\n keepAspectRatio: boolean\n ) {\n // These formulas are also used in:\n // - Model3DEditor.modelSize\n // - Model3DRendered2DInstance\n threeObject.rotation.set(\n gdjs.toRad(rotationX),\n gdjs.toRad(rotationY),\n gdjs.toRad(rotationZ)\n );\n threeObject.updateMatrixWorld(true);\n const boundingBox = new THREE.Box3().setFromObject(threeObject);\n\n const shouldKeepModelOrigin = !this._model3DRuntimeObject._originPoint;\n if (shouldKeepModelOrigin) {\n // Keep the origin as part of the model.\n // For instance, a model can be 1 face of a cube and we want to keep the\n // inside as part of the object even if it's just void.\n // It also avoids to have the origin outside of the object box.\n boundingBox.expandByPoint(new THREE.Vector3(0, 0, 0));\n }\n\n const modelWidth = boundingBox.max.x - boundingBox.min.x;\n const modelHeight = boundingBox.max.y - boundingBox.min.y;\n const modelDepth = boundingBox.max.z - boundingBox.min.z;\n this._modelOriginPoint[0] =\n modelWidth < epsilon ? 0 : -boundingBox.min.x / modelWidth;\n this._modelOriginPoint[1] =\n modelHeight < epsilon ? 0 : -boundingBox.min.y / modelHeight;\n this._modelOriginPoint[2] =\n modelDepth < epsilon ? 0 : -boundingBox.min.z / modelDepth;\n\n // The model is flipped on Y axis.\n this._modelOriginPoint[1] = 1 - this._modelOriginPoint[1];\n\n // Center the model.\n const centerPoint = this._model3DRuntimeObject._centerPoint;\n if (centerPoint) {\n threeObject.position.set(\n -(boundingBox.min.x + modelWidth * centerPoint[0]),\n // The model is flipped on Y axis.\n -(boundingBox.min.y + modelHeight * (1 - centerPoint[1])),\n -(boundingBox.min.z + modelDepth * centerPoint[2])\n );\n }\n\n // Rotate the model.\n threeObject.scale.set(1, 1, 1);\n threeObject.rotation.set(\n gdjs.toRad(rotationX),\n gdjs.toRad(rotationY),\n gdjs.toRad(rotationZ)\n );\n\n // Stretch the model in a 1x1x1 cube.\n const scaleX = modelWidth < epsilon ? 1 : 1 / modelWidth;\n const scaleY = modelHeight < epsilon ? 1 : 1 / modelHeight;\n const scaleZ = modelDepth < epsilon ? 1 : 1 / modelDepth;\n\n const scaleMatrix = new THREE.Matrix4();\n // Flip on Y because the Y axis is on the opposite side of direct basis.\n // It avoids models to be like a mirror refection.\n scaleMatrix.makeScale(scaleX, -scaleY, scaleZ);\n threeObject.updateMatrix();\n threeObject.applyMatrix4(scaleMatrix);\n\n if (keepAspectRatio) {\n // Reduce the object dimensions to keep aspect ratio.\n const widthRatio =\n modelWidth < epsilon\n ? Number.POSITIVE_INFINITY\n : originalWidth / modelWidth;\n const heightRatio =\n modelHeight < epsilon\n ? Number.POSITIVE_INFINITY\n : originalHeight / modelHeight;\n const depthRatio =\n modelDepth < epsilon\n ? Number.POSITIVE_INFINITY\n : originalDepth / modelDepth;\n let scaleRatio = Math.min(widthRatio, heightRatio, depthRatio);\n if (!Number.isFinite(scaleRatio)) {\n scaleRatio = 1;\n }\n\n this._object._setOriginalWidth(scaleRatio * modelWidth);\n this._object._setOriginalHeight(scaleRatio * modelHeight);\n this._object._setOriginalDepth(scaleRatio * modelDepth);\n }\n }\n\n _updateModel(\n rotationX: float,\n rotationY: float,\n rotationZ: float,\n originalWidth: float,\n originalHeight: float,\n originalDepth: float,\n keepAspectRatio: boolean\n ) {\n // Start from the original model because:\n // - _replaceMaterials is destructive\n // - _updateDefaultTransformation may need to work with meshes in local space\n\n // This group hold the rotation defined by properties.\n const threeObject = new THREE.Group();\n threeObject.rotation.order = 'ZYX';\n const root = THREE_ADDONS.SkeletonUtils.clone(this._originalModel.scene);\n threeObject.add(root);\n\n this._replaceMaterials(threeObject);\n\n this._updateDefaultTransformation(\n threeObject,\n rotationX,\n rotationY,\n rotationZ,\n originalWidth,\n originalHeight,\n originalDepth,\n keepAspectRatio\n );\n\n // Replace the 3D object.\n this.get3DRendererObject().remove(this._threeObject);\n this.get3DRendererObject().add(threeObject);\n this._threeObject = threeObject;\n\n // Start the current animation on the new 3D object.\n this._animationMixer = new THREE.AnimationMixer(root);\n const isAnimationPaused = this._model3DRuntimeObject.isAnimationPaused();\n this._model3DRuntimeObject.setAnimationIndex(\n this._model3DRuntimeObject.getAnimationIndex()\n );\n if (isAnimationPaused) {\n this.pauseAnimation();\n }\n }\n\n /**\n * Replace materials to better work with lights (or no light).\n */\n private _replaceMaterials(threeObject: THREE.Object3D) {\n if (\n this._model3DRuntimeObject._materialType ===\n gdjs.Model3DRuntimeObject.MaterialType.StandardWithoutMetalness\n ) {\n traverseToRemoveMetalnessFromMeshes(threeObject);\n } else if (\n this._model3DRuntimeObject._materialType ===\n gdjs.Model3DRuntimeObject.MaterialType.Basic\n ) {\n traverseToSetBasicMaterialFromMeshes(threeObject);\n }\n }\n\n getAnimationCount() {\n return this._originalModel.animations.length;\n }\n\n getAnimationName(animationIndex: integer) {\n return this._originalModel.animations[animationIndex].name;\n }\n\n /**\n * Return true if animation has ended.\n * The animation had ended if:\n * - it's not configured as a loop;\n * - the current frame is the last frame;\n * - the last frame has been displayed long enough.\n */\n hasAnimationEnded(): boolean {\n if (!this._action) {\n return true;\n }\n return !this._action.isRunning();\n }\n\n animationPaused() {\n if (!this._action) {\n return;\n }\n return this._action.paused;\n }\n\n pauseAnimation() {\n if (!this._action) {\n return;\n }\n this._action.paused = true;\n }\n\n resumeAnimation() {\n if (!this._action) {\n return;\n }\n this._action.paused = false;\n }\n\n playAnimation(animationName: string, shouldLoop: boolean) {\n this._animationMixer.stopAllAction();\n const clip = THREE.AnimationClip.findByName(\n this._originalModel.animations,\n animationName\n );\n if (!clip) {\n console.error(\n `The GLB file: ${this._model3DRuntimeObject._modelResourceName} doesn't have any animation named: ${animationName}`\n );\n return;\n }\n this._action = this._animationMixer.clipAction(clip);\n this._action.setLoop(\n shouldLoop ? THREE.LoopRepeat : THREE.LoopOnce,\n Number.POSITIVE_INFINITY\n );\n this._action.clampWhenFinished = true;\n this._action.play();\n // Make sure the first frame is displayed.\n this._animationMixer.update(0);\n }\n\n getAnimationElapsedTime(): float {\n return this._action ? this._action.time : 0;\n }\n\n setAnimationElapsedTime(time: float): void {\n if (this._action) {\n this._action.time = time;\n }\n }\n\n getAnimationDuration(animationName: string): float {\n const clip = THREE.AnimationClip.findByName(\n this._originalModel.animations,\n animationName\n );\n return clip ? clip.duration : 0;\n }\n }\n\n export const Model3DRuntimeObjectRenderer = Model3DRuntimeObject3DRenderer;\n export type Model3DRuntimeObjectRenderer = Model3DRuntimeObject3DRenderer;\n}\n"],
|
|
5
|
-
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAGE,KAAM,GAAU,EAAK,IAAK,IAEpB,EAAkB,AAAC,GAAmC,CAE1D,AAAI,EAAS,WAEX,GAAS,UAAY,IAInB,EAA0B,AAAC,GAAyB,CACxD,KAAM,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AI,EACxC,EAAS,EAAc,EAAU,EAAI,EAAI,EACzC,EAAS,EAAa,EAAU,EAAI,EAAI,EAExC,EAAc,GAAI,OAAM,QAO9B,GAJA,EAAY,UAAU,EAAQ,CAAC,EAAQ,GACvC,EAAY,eACZ,EAAY,aAAa,GAErB,EAAiB,CAEnB,KAAM,GACJ,EAAa,EACT,OAAO,kBACP,EAAgB,EAChB,EACJ,EAAc,EACV,OAAO,kBACP,EAAiB,EACjB,EACJ,EAAa,EACT,OAAO,kBACP,EAAgB,EACtB,GAAI,GAAa,KAAK,IAAI,EAAY,EAAa,GACnD,AAAK,OAAO,SAAS,IACnB,GAAa,GAGf,KAAK,QAAQ,kBAAkB,EAAa,GAC5C,KAAK,QAAQ,mBAAmB,EAAa,GAC7C,KAAK,QAAQ,kBAAkB,EAAa,
|
|
4
|
+
"sourcesContent": ["namespace gdjs {\n type FloatPoint3D = [float, float, float];\n\n const epsilon = 1 / (1 << 16);\n\n const removeMetalness = (material: THREE.Material): void => {\n //@ts-ignore\n if (material.metalness) {\n //@ts-ignore\n material.metalness = 0;\n }\n };\n\n const removeMetalnessFromMesh = (node: THREE.Object3D) => {\n const mesh = node as THREE.Mesh;\n if (!mesh.material) {\n return;\n }\n if (Array.isArray(mesh.material)) {\n for (let index = 0; index < mesh.material.length; index++) {\n removeMetalness(mesh.material[index]);\n }\n } else {\n removeMetalness(mesh.material);\n }\n };\n\n const traverseToRemoveMetalnessFromMeshes = (node: THREE.Object3D) =>\n node.traverse(removeMetalnessFromMesh);\n\n const convertToBasicMaterial = (\n material: THREE.Material\n ): THREE.MeshBasicMaterial => {\n const basicMaterial = new THREE.MeshBasicMaterial();\n //@ts-ignore\n if (material.color) {\n //@ts-ignore\n basicMaterial.color = material.color;\n }\n //@ts-ignore\n if (material.map) {\n //@ts-ignore\n basicMaterial.map = material.map;\n }\n return basicMaterial;\n };\n\n const setBasicMaterialTo = (node: THREE.Object3D): void => {\n const mesh = node as THREE.Mesh;\n if (!mesh.material) {\n return;\n }\n\n if (Array.isArray(mesh.material)) {\n for (let index = 0; index < mesh.material.length; index++) {\n mesh.material[index] = convertToBasicMaterial(mesh.material[index]);\n }\n } else {\n mesh.material = convertToBasicMaterial(mesh.material);\n }\n };\n\n const traverseToSetBasicMaterialFromMeshes = (node: THREE.Object3D) =>\n node.traverse(setBasicMaterialTo);\n\n class Model3DRuntimeObject3DRenderer extends gdjs.RuntimeObject3DRenderer {\n private _model3DRuntimeObject: gdjs.Model3DRuntimeObject;\n /**\n * The 3D model stretched in a 1x1x1 cube.\n */\n private _threeObject: THREE.Object3D;\n private _originalModel: THREE_ADDONS.GLTF;\n private _animationMixer: THREE.AnimationMixer;\n private _action: THREE.AnimationAction | null;\n\n /**\n * The model origin evaluated according to the object configuration.\n *\n * Coordinates are between 0 and 1.\n */\n private _modelOriginPoint: FloatPoint3D;\n\n constructor(\n runtimeObject: gdjs.Model3DRuntimeObject,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ) {\n // GLB files with skeleton must not have any transformation to work properly.\n const originalModel = instanceContainer\n .getGame()\n .getModel3DManager()\n .getModel(runtimeObject._modelResourceName);\n // _updateModel will actually add a clone of the model.\n const model = new THREE.Group();\n\n // Create a group to transform the object according to\n // position, angle and dimensions.\n const group = new THREE.Group();\n group.rotation.order = 'ZYX';\n group.add(model);\n super(runtimeObject, instanceContainer, group);\n\n this._model3DRuntimeObject = runtimeObject;\n this._threeObject = model;\n this._originalModel = originalModel;\n this._modelOriginPoint = [0, 0, 0];\n\n this.updateSize();\n this.updatePosition();\n this.updateRotation();\n\n this._animationMixer = new THREE.AnimationMixer(model);\n this._action = null;\n }\n\n updateAnimation(timeDelta: float) {\n this._animationMixer.update(timeDelta);\n }\n\n updatePosition() {\n const originPoint = this.getOriginPoint();\n const centerPoint = this.getCenterPoint();\n this.get3DRendererObject().position.set(\n this._object.getX() -\n this._object.getWidth() * (originPoint[0] - centerPoint[0]),\n this._object.getY() -\n this._object.getHeight() * (originPoint[1] - centerPoint[1]),\n this._object.getZ() -\n this._object.getDepth() * (originPoint[2] - centerPoint[2])\n );\n }\n\n getOriginPoint() {\n return this._model3DRuntimeObject._originPoint || this._modelOriginPoint;\n }\n\n getCenterPoint() {\n return this._model3DRuntimeObject._centerPoint || this._modelOriginPoint;\n }\n\n private _updateDefaultTransformation(\n threeObject: THREE.Object3D,\n rotationX: float,\n rotationY: float,\n rotationZ: float,\n originalWidth: float,\n originalHeight: float,\n originalDepth: float,\n keepAspectRatio: boolean\n ) {\n // These formulas are also used in:\n // - Model3DEditor.modelSize\n // - Model3DRendered2DInstance\n threeObject.rotation.set(\n gdjs.toRad(rotationX),\n gdjs.toRad(rotationY),\n gdjs.toRad(rotationZ)\n );\n threeObject.updateMatrixWorld(true);\n const boundingBox = new THREE.Box3().setFromObject(threeObject);\n\n const shouldKeepModelOrigin = !this._model3DRuntimeObject._originPoint;\n if (shouldKeepModelOrigin) {\n // Keep the origin as part of the model.\n // For instance, a model can be 1 face of a cube and we want to keep the\n // inside as part of the object even if it's just void.\n // It also avoids to have the origin outside of the object box.\n boundingBox.expandByPoint(new THREE.Vector3(0, 0, 0));\n }\n\n const modelWidth = boundingBox.max.x - boundingBox.min.x;\n const modelHeight = boundingBox.max.y - boundingBox.min.y;\n const modelDepth = boundingBox.max.z - boundingBox.min.z;\n this._modelOriginPoint[0] =\n modelWidth < epsilon ? 0 : -boundingBox.min.x / modelWidth;\n this._modelOriginPoint[1] =\n modelHeight < epsilon ? 0 : -boundingBox.min.y / modelHeight;\n this._modelOriginPoint[2] =\n modelDepth < epsilon ? 0 : -boundingBox.min.z / modelDepth;\n\n // The model is flipped on Y axis.\n this._modelOriginPoint[1] = 1 - this._modelOriginPoint[1];\n\n // Center the model.\n const centerPoint = this._model3DRuntimeObject._centerPoint;\n if (centerPoint) {\n threeObject.position.set(\n -(boundingBox.min.x + modelWidth * centerPoint[0]),\n // The model is flipped on Y axis.\n -(boundingBox.min.y + modelHeight * (1 - centerPoint[1])),\n -(boundingBox.min.z + modelDepth * centerPoint[2])\n );\n }\n\n // Rotate the model.\n threeObject.scale.set(1, 1, 1);\n threeObject.rotation.set(\n gdjs.toRad(rotationX),\n gdjs.toRad(rotationY),\n gdjs.toRad(rotationZ)\n );\n\n // Stretch the model in a 1x1x1 cube.\n const scaleX = modelWidth < epsilon ? 1 : 1 / modelWidth;\n const scaleY = modelHeight < epsilon ? 1 : 1 / modelHeight;\n const scaleZ = modelDepth < epsilon ? 1 : 1 / modelDepth;\n\n const scaleMatrix = new THREE.Matrix4();\n // Flip on Y because the Y axis is on the opposite side of direct basis.\n // It avoids models to be like a mirror refection.\n scaleMatrix.makeScale(scaleX, -scaleY, scaleZ);\n threeObject.updateMatrix();\n threeObject.applyMatrix4(scaleMatrix);\n\n if (keepAspectRatio) {\n // Reduce the object dimensions to keep aspect ratio.\n const widthRatio =\n modelWidth < epsilon\n ? Number.POSITIVE_INFINITY\n : originalWidth / modelWidth;\n const heightRatio =\n modelHeight < epsilon\n ? Number.POSITIVE_INFINITY\n : originalHeight / modelHeight;\n const depthRatio =\n modelDepth < epsilon\n ? Number.POSITIVE_INFINITY\n : originalDepth / modelDepth;\n let scaleRatio = Math.min(widthRatio, heightRatio, depthRatio);\n if (!Number.isFinite(scaleRatio)) {\n scaleRatio = 1;\n }\n\n this._object._setOriginalWidth(scaleRatio * modelWidth);\n this._object._setOriginalHeight(scaleRatio * modelHeight);\n this._object._setOriginalDepth(scaleRatio * modelDepth);\n }\n }\n\n /**\n * `_updateModel` should always be called after this method.\n * Ideally, use `Model3DRuntimeObject#_reloadModel` instead.\n */\n _reloadModel(\n runtimeObject: Model3DRuntimeObject,\n instanceContainer: gdjs.RuntimeInstanceContainer\n ) {\n this._originalModel = instanceContainer\n .getGame()\n .getModel3DManager()\n .getModel(runtimeObject._modelResourceName);\n }\n\n _updateModel(\n rotationX: float,\n rotationY: float,\n rotationZ: float,\n originalWidth: float,\n originalHeight: float,\n originalDepth: float,\n keepAspectRatio: boolean\n ) {\n // Start from the original model because:\n // - _replaceMaterials is destructive\n // - _updateDefaultTransformation may need to work with meshes in local space\n\n // This group hold the rotation defined by properties.\n const threeObject = new THREE.Group();\n threeObject.rotation.order = 'ZYX';\n const root = THREE_ADDONS.SkeletonUtils.clone(this._originalModel.scene);\n threeObject.add(root);\n\n this._replaceMaterials(threeObject);\n\n this._updateDefaultTransformation(\n threeObject,\n rotationX,\n rotationY,\n rotationZ,\n originalWidth,\n originalHeight,\n originalDepth,\n keepAspectRatio\n );\n\n // Replace the 3D object.\n this.get3DRendererObject().remove(this._threeObject);\n this.get3DRendererObject().add(threeObject);\n this._threeObject = threeObject;\n\n // Start the current animation on the new 3D object.\n this._animationMixer = new THREE.AnimationMixer(root);\n const isAnimationPaused = this._model3DRuntimeObject.isAnimationPaused();\n this._model3DRuntimeObject.setAnimationIndex(\n this._model3DRuntimeObject.getAnimationIndex()\n );\n if (isAnimationPaused) {\n this.pauseAnimation();\n }\n }\n\n /**\n * Replace materials to better work with lights (or no light).\n */\n private _replaceMaterials(threeObject: THREE.Object3D) {\n if (\n this._model3DRuntimeObject._materialType ===\n gdjs.Model3DRuntimeObject.MaterialType.StandardWithoutMetalness\n ) {\n traverseToRemoveMetalnessFromMeshes(threeObject);\n } else if (\n this._model3DRuntimeObject._materialType ===\n gdjs.Model3DRuntimeObject.MaterialType.Basic\n ) {\n traverseToSetBasicMaterialFromMeshes(threeObject);\n }\n }\n\n getAnimationCount() {\n return this._originalModel.animations.length;\n }\n\n getAnimationName(animationIndex: integer) {\n return this._originalModel.animations[animationIndex].name;\n }\n\n /**\n * Return true if animation has ended.\n * The animation had ended if:\n * - it's not configured as a loop;\n * - the current frame is the last frame;\n * - the last frame has been displayed long enough.\n */\n hasAnimationEnded(): boolean {\n if (!this._action) {\n return true;\n }\n return !this._action.isRunning();\n }\n\n animationPaused() {\n if (!this._action) {\n return;\n }\n return this._action.paused;\n }\n\n pauseAnimation() {\n if (!this._action) {\n return;\n }\n this._action.paused = true;\n }\n\n resumeAnimation() {\n if (!this._action) {\n return;\n }\n this._action.paused = false;\n }\n\n playAnimation(animationName: string, shouldLoop: boolean) {\n this._animationMixer.stopAllAction();\n const clip = THREE.AnimationClip.findByName(\n this._originalModel.animations,\n animationName\n );\n if (!clip) {\n console.error(\n `The GLB file: ${this._model3DRuntimeObject._modelResourceName} doesn't have any animation named: ${animationName}`\n );\n return;\n }\n this._action = this._animationMixer.clipAction(clip);\n this._action.setLoop(\n shouldLoop ? THREE.LoopRepeat : THREE.LoopOnce,\n Number.POSITIVE_INFINITY\n );\n this._action.clampWhenFinished = true;\n this._action.play();\n // Make sure the first frame is displayed.\n this._animationMixer.update(0);\n }\n\n getAnimationElapsedTime(): float {\n return this._action ? this._action.time : 0;\n }\n\n setAnimationElapsedTime(time: float): void {\n if (this._action) {\n this._action.time = time;\n }\n }\n\n getAnimationDuration(animationName: string): float {\n const clip = THREE.AnimationClip.findByName(\n this._originalModel.animations,\n animationName\n );\n return clip ? clip.duration : 0;\n }\n }\n\n export const Model3DRuntimeObjectRenderer = Model3DRuntimeObject3DRenderer;\n export type Model3DRuntimeObjectRenderer = Model3DRuntimeObject3DRenderer;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,GAAU,MAAV,UAAU,EAAV,CAGE,KAAM,GAAU,EAAK,IAAK,IAEpB,EAAkB,AAAC,GAAmC,CAE1D,AAAI,EAAS,WAEX,GAAS,UAAY,IAInB,EAA0B,AAAC,GAAyB,CACxD,KAAM,GAAO,EACb,GAAI,EAAC,EAAK,SAGV,GAAI,MAAM,QAAQ,EAAK,UACrB,OAAS,GAAQ,EAAG,EAAQ,EAAK,SAAS,OAAQ,IAChD,EAAgB,EAAK,SAAS,QAGhC,GAAgB,EAAK,WAInB,EAAsC,AAAC,GAC3C,EAAK,SAAS,GAEV,EAAyB,AAC7B,GAC4B,CAC5B,KAAM,GAAgB,GAAI,OAAM,kBAEhC,MAAI,GAAS,OAEX,GAAc,MAAQ,EAAS,OAG7B,EAAS,KAEX,GAAc,IAAM,EAAS,KAExB,G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AqB,CACxD,KAAK,gBAAgB,gBACrB,KAAM,GAAO,MAAM,cAAc,WAC/B,KAAK,eAAe,WACpB,GAEF,GAAI,CAAC,EAAM,CACT,QAAQ,MACN,iBAAiB,KAAK,sBAAsB,wDAAwD,KAEtG,OAEF,KAAK,QAAU,KAAK,gBAAgB,WAAW,GAC/C,KAAK,QAAQ,QACX,EAAa,MAAM,WAAa,MAAM,SACtC,OAAO,mBAET,KAAK,QAAQ,kBAAoB,GACjC,KAAK,QAAQ,OAEb,KAAK,gBAAgB,OAAO,GAG9B,yBAAiC,CAC/B,MAAO,MAAK,QAAU,KAAK,QAAQ,KAAO,EAG5C,wBAAwB,EAAmB,CACzC,AAAI,KAAK,SACP,MAAK,QAAQ,KAAO,GAIxB,qBAAqB,EAA8B,CACjD,KAAM,GAAO,MAAM,cAAc,WAC/B,KAAK,eAAe,WACpB,GAEF,MAAO,GAAO,EAAK,SAAW,GAI3B,AAAM,+BAA+B,IAlZpC",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -33,6 +33,14 @@ module.exports = {
|
|
|
33
33
|
.addInstructionOrExpressionGroupMetadata(_('AdMob'))
|
|
34
34
|
.setIcon('JsPlatform/Extensions/admobicon24.png');
|
|
35
35
|
|
|
36
|
+
extension
|
|
37
|
+
.addDependency()
|
|
38
|
+
.setName('Consent Cordova plugin')
|
|
39
|
+
.setDependencyType('cordova')
|
|
40
|
+
.setExportName('cordova-plugin-consent')
|
|
41
|
+
.setVersion('3.0.0-alpha.8')
|
|
42
|
+
.onlyIfOtherDependencyIsExported('AdMob Cordova plugin');
|
|
43
|
+
|
|
36
44
|
extension
|
|
37
45
|
.registerProperty('AdMobAppIdAndroid')
|
|
38
46
|
.setLabel(_('AdMob Android App ID'))
|
|
@@ -50,7 +58,7 @@ module.exports = {
|
|
|
50
58
|
.setName('AdMob Cordova plugin')
|
|
51
59
|
.setDependencyType('cordova')
|
|
52
60
|
.setExportName('admob-plus-cordova')
|
|
53
|
-
.setVersion('
|
|
61
|
+
.setVersion('2.0.0-alpha.18')
|
|
54
62
|
.setExtraSetting(
|
|
55
63
|
'APP_ID_ANDROID',
|
|
56
64
|
new gd.PropertyDescriptor('AdMobAppIdAndroid').setType(
|
|
@@ -63,13 +71,6 @@ module.exports = {
|
|
|
63
71
|
)
|
|
64
72
|
.onlyIfSomeExtraSettingsNonEmpty();
|
|
65
73
|
|
|
66
|
-
extension
|
|
67
|
-
.addDependency()
|
|
68
|
-
.setName('Consent Cordova plugin')
|
|
69
|
-
.setDependencyType('cordova')
|
|
70
|
-
.setExportName('cordova-plugin-consent')
|
|
71
|
-
.onlyIfOtherDependencyIsExported('AdMob Cordova plugin');
|
|
72
|
-
|
|
73
74
|
extension
|
|
74
75
|
.addAction(
|
|
75
76
|
'SetTestMode',
|
|
@@ -165,11 +166,11 @@ module.exports = {
|
|
|
165
166
|
)
|
|
166
167
|
.addParameter('string', _('Android app open ID'), '', false)
|
|
167
168
|
.setParameterLongDescription(
|
|
168
|
-
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/
|
|
169
|
+
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/9257395921"` for loading a test app open.'
|
|
169
170
|
)
|
|
170
171
|
.addParameter('string', _('iOS app open ID'), '', false)
|
|
171
172
|
.setParameterLongDescription(
|
|
172
|
-
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/
|
|
173
|
+
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/5575463023"` for loading a test app open.'
|
|
173
174
|
)
|
|
174
175
|
.addParameter(
|
|
175
176
|
'yesorno',
|