gdcore-tools 2.0.0-gd-v5.5.224-autobuild → 2.0.0-gd-v5.5.226-autobuild
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Runtime/CustomRuntimeObject.js +1 -1
- package/dist/Runtime/CustomRuntimeObject.js.map +2 -2
- package/dist/Runtime/CustomRuntimeObject2D.js.map +2 -2
- package/dist/Runtime/Extensions/3D/A_RuntimeObject3D.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Base3DBehavior.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js +1 -1
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObject.js.map +2 -2
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObjectPixiRenderer.js +1 -1
- package/dist/Runtime/Extensions/3D/Cube3DRuntimeObjectPixiRenderer.js.map +2 -2
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3D.js.map +2 -2
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3DRenderer.js +1 -1
- package/dist/Runtime/Extensions/3D/CustomRuntimeObject3DRenderer.js.map +2 -2
- package/dist/Runtime/Extensions/3D/JsExtension.js +219 -108
- 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 +63 -1
- package/dist/Runtime/Extensions/AdMob/admobtools.js +1 -1
- package/dist/Runtime/Extensions/AdMob/admobtools.js.map +2 -2
- package/dist/Runtime/Extensions/AdvancedWindow/electron-advancedwindowtools.js.map +2 -2
- package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js +1 -1
- package/dist/Runtime/Extensions/AnchorBehavior/anchorruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/BBText/JsExtension.js +10 -9
- package/dist/Runtime/Extensions/BBText/bbtextruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/BitmapText/JsExtension.js +4 -6
- package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/BitmapText/bitmaptextruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/DialogueTree/dialoguetools.js.map +2 -2
- package/dist/Runtime/Extensions/DraggableBehavior/draggableruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/adjustment-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/advanced-bloom-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/ascii-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/bevel-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/black-and-white-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/blending-mode-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/brightness-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/bulge-pinch-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/color-map-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/color-replace-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/crt-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/displacement-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/dot-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/drop-shadow-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/glitch-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/glow-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/godray-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/kawase-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/noise-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/old-film-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/outline-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/pixelate-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/pixi-filters/types/drop-shadow/types.d.ts +10 -4
- package/dist/Runtime/Extensions/Effects/radial-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/reflection-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/rgb-split-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/sepia-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/shockwave-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/tilt-shift-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/twist-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/Effects/zoom-blur-pixi-filter.js.map +2 -2
- package/dist/Runtime/Extensions/ExampleJsExtension/dummyeffect.js.map +2 -2
- package/dist/Runtime/Extensions/FacebookInstantGames/facebookinstantgamestools.js.map +2 -2
- package/dist/Runtime/Extensions/Firebase/A_firebasejs/firebase.d.ts +5 -4
- package/dist/Runtime/Extensions/Firebase/B_firebasetools/D_cloudfirestoretools.js.map +2 -2
- package/dist/Runtime/Extensions/Firebase/B_firebasetools/D_remoteconfigtools.js.map +2 -2
- package/dist/Runtime/Extensions/Firebase/JsExtension.js +21 -21
- package/dist/Runtime/Extensions/JsExtensionTypes.d.ts +1 -0
- package/dist/Runtime/Extensions/Leaderboards/leaderboardstools.js.map +2 -2
- package/dist/Runtime/Extensions/Lighting/JsExtension.js +2 -2
- package/dist/Runtime/Extensions/Lighting/lightobstacleruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Lighting/lightruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/Lighting/lightruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/LinkedObjects/linkedobjects.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/JsExtension.js +122 -0
- package/dist/Runtime/Extensions/Multiplayer/messageManager.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/multiplayerVariablesManager.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js +1 -1
- package/dist/Runtime/Extensions/Multiplayer/multiplayercomponents.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/multiplayerobjectruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js +1 -1
- package/dist/Runtime/Extensions/Multiplayer/multiplayertools.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js +1 -1
- package/dist/Runtime/Extensions/Multiplayer/peerJsHelper.js.map +2 -2
- package/dist/Runtime/Extensions/Multiplayer/peerjs.d.ts +8 -10
- package/dist/Runtime/Extensions/P2P/peerjs.d.ts +8 -10
- package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/PanelSpriteObject/panelspriteruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/ParticleSystem/particleemitterobject.js.map +2 -2
- package/dist/Runtime/Extensions/ParticleSystem/pixi-particles-pixi-renderer.d.ts +2 -1
- package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingobstacleruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PathfindingBehavior/pathfindingruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics2Behavior/JsExtension.js +106 -106
- package/dist/Runtime/Extensions/Physics2Behavior/box2d.d.ts +13 -7
- package/dist/Runtime/Extensions/Physics2Behavior/physics2runtimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics3DBehavior/Physics3DRuntimeBehavior.js.map +2 -2
- package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js +1 -1
- package/dist/Runtime/Extensions/Physics3DBehavior/PhysicsCharacter3DRuntimeBehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PhysicsBehavior/physicsruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PlatformBehavior/platformerobjectruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PlatformBehavior/platformruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationcomponents.js.map +1 -1
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js +1 -1
- package/dist/Runtime/Extensions/PlayerAuthentication/playerauthenticationtools.js.map +2 -2
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/PrimitiveDrawing/shapepainterruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/SpatialSound/spatialsoundtools.js +1 -1
- package/dist/Runtime/Extensions/SpatialSound/spatialsoundtools.js.map +2 -2
- package/dist/Runtime/Extensions/Spine/JsExtension.js +5 -4
- 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/spineruntimeobject-pixi-renderer.js +1 -1
- package/dist/Runtime/Extensions/Spine/spineruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/Spine/spineruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/Steamworks/JsExtension.js +12 -12
- package/dist/Runtime/Extensions/Steamworks/Z_steamworksinputtools.js.map +2 -2
- package/dist/Runtime/Extensions/Steamworks/steamworkstools.js.map +2 -2
- package/dist/Runtime/Extensions/TextEntryObject/textentryruntimeobject-pixi-renderer.js.map +2 -2
- 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.map +2 -2
- package/dist/Runtime/Extensions/TextObject/textruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/TextObject/textruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/JsExtension.js +20 -18
- package/dist/Runtime/Extensions/TileMap/TileMapRuntimeManager.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/collision/TransformedTileMap.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/helper/dts/model/TileMapModel.d.ts +1 -3
- package/dist/Runtime/Extensions/TileMap/simpletilemapruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/tilemapcollisionmaskruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject-pixi-renderer.js.map +1 -1
- package/dist/Runtime/Extensions/TileMap/tilemapruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/TiledSpriteObject/tiledspriteruntimeobject.js.map +2 -2
- package/dist/Runtime/Extensions/TopDownMovementBehavior/topdownmovementruntimebehavior.js.map +2 -2
- package/dist/Runtime/Extensions/TweenBehavior/tweenruntimebehavior.js.map +1 -1
- package/dist/Runtime/Extensions/Video/JsExtension.js +2 -1
- package/dist/Runtime/Extensions/Video/videoruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/Extensions/Video/videoruntimeobject.js.map +2 -2
- package/dist/Runtime/InAppTutorialMessage.js +6 -0
- package/dist/Runtime/InAppTutorialMessage.js.map +7 -0
- package/dist/Runtime/Model3DManager.js.map +2 -2
- package/dist/Runtime/ResourceLoader.js.map +2 -2
- package/dist/Runtime/RuntimeCustomObjectLayer.js +1 -1
- package/dist/Runtime/RuntimeCustomObjectLayer.js.map +2 -2
- package/dist/Runtime/RuntimeInstanceContainer.js.map +1 -1
- package/dist/Runtime/RuntimeLayer.js.map +2 -2
- package/dist/Runtime/SpriteAnimator.js.map +2 -2
- package/dist/Runtime/affinetransformation.js.map +1 -1
- package/dist/Runtime/debugger-client/abstract-debugger-client.js.map +2 -2
- package/dist/Runtime/debugger-client/hot-reloader.js +2 -2
- package/dist/Runtime/debugger-client/hot-reloader.js.map +2 -2
- package/dist/Runtime/debugger-client/websocket-debugger-client.js +1 -1
- package/dist/Runtime/debugger-client/websocket-debugger-client.js.map +2 -2
- package/dist/Runtime/events-tools/networktools.js +1 -1
- package/dist/Runtime/events-tools/networktools.js.map +2 -2
- package/dist/Runtime/fontfaceobserver-font-manager/fontfaceobserver-font-manager.js.map +2 -2
- package/dist/Runtime/gd.js.map +2 -2
- package/dist/Runtime/howler-sound-manager/howler-sound-manager.js +1 -1
- package/dist/Runtime/howler-sound-manager/howler-sound-manager.js.map +2 -2
- package/dist/Runtime/inputmanager.js.map +2 -2
- package/dist/Runtime/jsonmanager.js.map +2 -2
- package/dist/Runtime/layer.js.map +2 -2
- package/dist/Runtime/libs/nanomarkdown.js +5 -0
- package/dist/Runtime/libs/nanomarkdown.js.map +7 -0
- package/dist/Runtime/object-capabilities/AnimatableBehavior.js.map +2 -2
- package/dist/Runtime/object-capabilities/EffectBehavior.js.map +2 -2
- package/dist/Runtime/object-capabilities/FlippableBehavior.js.map +2 -2
- package/dist/Runtime/object-capabilities/OpacityBehavior.js.map +2 -2
- package/dist/Runtime/object-capabilities/ResizableBehavior.js.map +2 -2
- package/dist/Runtime/object-capabilities/ScalableBehavior.js.map +2 -2
- package/dist/Runtime/object-capabilities/TextContainerBehavior.js.map +2 -2
- package/dist/Runtime/pixi-renderers/CustomRuntimeObject2DPixiRenderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/DebuggerPixiRenderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/layer-pixi-renderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/loadingscreen-pixi-renderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/pixi-bitmapfont-manager.js.map +2 -2
- package/dist/Runtime/pixi-renderers/pixi-filters-tools.js.map +2 -2
- package/dist/Runtime/pixi-renderers/pixi-image-manager.js +1 -1
- package/dist/Runtime/pixi-renderers/pixi-image-manager.js.map +2 -2
- package/dist/Runtime/pixi-renderers/pixi.js +123 -177
- 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/runtimescene-pixi-renderer.js.map +2 -2
- package/dist/Runtime/pixi-renderers/spriteruntimeobject-pixi-renderer.js.map +2 -2
- package/dist/Runtime/profiler.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.map +2 -2
- package/dist/Runtime/runtimewatermark.js.map +2 -2
- package/dist/Runtime/scenestack.js.map +2 -2
- package/dist/Runtime/spriteruntimeobject.js.map +2 -2
- package/dist/Runtime/variable.js.map +2 -2
- package/dist/Runtime/variablescontainer.js.map +2 -2
- package/dist/lib/libGD.cjs +1 -1
- package/dist/lib/libGD.wasm +0 -0
- package/gd.d.ts +5 -2
- package/package.json +1 -1
|
@@ -69,7 +69,7 @@ module.exports = {
|
|
|
69
69
|
_('Center Z position'),
|
|
70
70
|
_('the Z position of the center of rotation'),
|
|
71
71
|
_('the Z position of the center'),
|
|
72
|
-
_('Position
|
|
72
|
+
_('Position ❯ Center'),
|
|
73
73
|
'res/conditions/3d_box.svg'
|
|
74
74
|
)
|
|
75
75
|
.addParameter('object', _('3D object'), '', false)
|
|
@@ -800,6 +800,20 @@ module.exports = {
|
|
|
800
800
|
.markAsSimple()
|
|
801
801
|
.setHidden()
|
|
802
802
|
.setFunctionName('hasAnimationEnded');
|
|
803
|
+
|
|
804
|
+
object
|
|
805
|
+
.addScopedAction(
|
|
806
|
+
'SetCrossfadeDuration',
|
|
807
|
+
_('Set crossfade duration'),
|
|
808
|
+
_('Set the crossfade duration when switching to a new animation.'),
|
|
809
|
+
_('Set crossfade duration of _PARAM0_ to _PARAM1_ seconds'),
|
|
810
|
+
_('Animations and images'),
|
|
811
|
+
'res/conditions/animation24.png',
|
|
812
|
+
'res/conditions/animation.png'
|
|
813
|
+
)
|
|
814
|
+
.addParameter('object', _('3D model'), 'Model3DObject', false)
|
|
815
|
+
.addParameter('number', _('Crossfade duration (in seconds)'), '', false)
|
|
816
|
+
.setFunctionName('setCrossfadeDuration');
|
|
803
817
|
}
|
|
804
818
|
|
|
805
819
|
const Cube3DObject = new gd.ObjectJsImplementation();
|
|
@@ -822,7 +836,8 @@ module.exports = {
|
|
|
822
836
|
propertyName === 'bottomFaceResourceName' ||
|
|
823
837
|
propertyName === 'backFaceUpThroughWhichAxisRotation' ||
|
|
824
838
|
propertyName === 'facesOrientation' ||
|
|
825
|
-
propertyName === 'materialType'
|
|
839
|
+
propertyName === 'materialType' ||
|
|
840
|
+
propertyName === 'tint'
|
|
826
841
|
) {
|
|
827
842
|
objectContent[propertyName] = newValue;
|
|
828
843
|
return true;
|
|
@@ -902,6 +917,12 @@ module.exports = {
|
|
|
902
917
|
.setLabel(_('Depth'))
|
|
903
918
|
.setMeasurementUnit(gd.MeasurementUnit.getPixel())
|
|
904
919
|
.setGroup(_('Default size'));
|
|
920
|
+
objectProperties
|
|
921
|
+
.getOrCreate('tint')
|
|
922
|
+
.setValue(objectContent.tint || '255;255;255')
|
|
923
|
+
.setType('Color')
|
|
924
|
+
.setLabel(_('Tint'))
|
|
925
|
+
.setGroup(_('Texture'));
|
|
905
926
|
|
|
906
927
|
objectProperties
|
|
907
928
|
.getOrCreate('frontFaceResourceName')
|
|
@@ -1092,6 +1113,7 @@ module.exports = {
|
|
|
1092
1113
|
topFaceResourceRepeat: false,
|
|
1093
1114
|
bottomFaceResourceRepeat: false,
|
|
1094
1115
|
materialType: 'Basic',
|
|
1116
|
+
tint: '255;255;255',
|
|
1095
1117
|
};
|
|
1096
1118
|
|
|
1097
1119
|
Cube3DObject.updateInitialInstanceProperty = function (
|
|
@@ -1568,6 +1590,21 @@ module.exports = {
|
|
|
1568
1590
|
.addParameter('imageResource', _('Image'), '', false)
|
|
1569
1591
|
.setFunctionName('setFaceResourceName');
|
|
1570
1592
|
|
|
1593
|
+
object
|
|
1594
|
+
.addScopedAction(
|
|
1595
|
+
'SetTint',
|
|
1596
|
+
_('Tint color'),
|
|
1597
|
+
_('Change the tint of the cube.'),
|
|
1598
|
+
_('Change the tint of _PARAM0_ to _PARAM1_'),
|
|
1599
|
+
_('Effects'),
|
|
1600
|
+
'res/actions/color24.png',
|
|
1601
|
+
'res/actions/color.png'
|
|
1602
|
+
)
|
|
1603
|
+
.addParameter('object', _('3D Cube'), 'Cube3DObject', false)
|
|
1604
|
+
.addParameter('color', _('Tint'), '', false)
|
|
1605
|
+
.getCodeExtraInformation()
|
|
1606
|
+
.setFunctionName('setColor');
|
|
1607
|
+
|
|
1571
1608
|
extension
|
|
1572
1609
|
.addExpressionAndConditionAndAction(
|
|
1573
1610
|
'number',
|
|
@@ -2062,6 +2099,10 @@ module.exports = {
|
|
|
2062
2099
|
3: [1, 0],
|
|
2063
2100
|
};
|
|
2064
2101
|
|
|
2102
|
+
/**
|
|
2103
|
+
* @param {*} objectConfiguration
|
|
2104
|
+
* @returns {string | null}
|
|
2105
|
+
*/
|
|
2065
2106
|
const getFirstVisibleFaceResourceName = (objectConfiguration) => {
|
|
2066
2107
|
const object = gd.castObject(
|
|
2067
2108
|
objectConfiguration,
|
|
@@ -2090,25 +2131,44 @@ module.exports = {
|
|
|
2090
2131
|
return null;
|
|
2091
2132
|
};
|
|
2092
2133
|
|
|
2134
|
+
/** @type {THREE.MeshBasicMaterial | null} */
|
|
2093
2135
|
let transparentMaterial = null;
|
|
2136
|
+
/**
|
|
2137
|
+
* @returns {THREE.MeshBasicMaterial}
|
|
2138
|
+
*/
|
|
2094
2139
|
const getTransparentMaterial = () => {
|
|
2095
|
-
if (
|
|
2096
|
-
transparentMaterial
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2140
|
+
if (transparentMaterial) {
|
|
2141
|
+
return transparentMaterial;
|
|
2142
|
+
}
|
|
2143
|
+
const newTransparentMaterial = new THREE.MeshBasicMaterial({
|
|
2144
|
+
transparent: true,
|
|
2145
|
+
opacity: 0,
|
|
2146
|
+
// Set the alpha test to to ensure the faces behind are rendered
|
|
2147
|
+
// (no "back face culling" that would still be done if alphaTest is not set).
|
|
2148
|
+
alphaTest: 1,
|
|
2149
|
+
});
|
|
2150
|
+
transparentMaterial = newTransparentMaterial;
|
|
2151
|
+
return newTransparentMaterial;
|
|
2105
2152
|
};
|
|
2106
2153
|
|
|
2107
2154
|
class RenderedCube3DObject2DInstance extends RenderedInstance {
|
|
2155
|
+
/** @type {number} */
|
|
2156
|
+
_defaultWidth;
|
|
2157
|
+
/** @type {number} */
|
|
2158
|
+
_defaultHeight;
|
|
2159
|
+
/** @type {number} */
|
|
2160
|
+
_defaultDepth;
|
|
2108
2161
|
/** @type {number} */
|
|
2109
2162
|
_centerX = 0;
|
|
2110
2163
|
/** @type {number} */
|
|
2111
2164
|
_centerY = 0;
|
|
2165
|
+
/**
|
|
2166
|
+
* The name of the resource that is rendered.
|
|
2167
|
+
* If no face is visible, this will be null.
|
|
2168
|
+
* @type {string | null | undefined}
|
|
2169
|
+
*/
|
|
2170
|
+
_renderedResourceName = undefined;
|
|
2171
|
+
_renderFallbackObject = false;
|
|
2112
2172
|
|
|
2113
2173
|
constructor(
|
|
2114
2174
|
project,
|
|
@@ -2124,11 +2184,6 @@ module.exports = {
|
|
|
2124
2184
|
pixiContainer,
|
|
2125
2185
|
pixiResourcesLoader
|
|
2126
2186
|
);
|
|
2127
|
-
|
|
2128
|
-
// Name of the resource that is rendered.
|
|
2129
|
-
// If no face is visible, this will be null.
|
|
2130
|
-
this._renderedResourceName = undefined;
|
|
2131
|
-
|
|
2132
2187
|
const object = gd.castObject(
|
|
2133
2188
|
this._associatedObjectConfiguration,
|
|
2134
2189
|
gd.ObjectJsImplementation
|
|
@@ -2145,7 +2200,6 @@ module.exports = {
|
|
|
2145
2200
|
this._pixiObject.addChild(this._pixiTexturedObject);
|
|
2146
2201
|
this._pixiObject.addChild(this._pixiFallbackObject);
|
|
2147
2202
|
this._pixiContainer.addChild(this._pixiObject);
|
|
2148
|
-
this._renderFallbackObject = false;
|
|
2149
2203
|
this.updateTexture();
|
|
2150
2204
|
}
|
|
2151
2205
|
|
|
@@ -2160,9 +2214,10 @@ module.exports = {
|
|
|
2160
2214
|
}
|
|
2161
2215
|
|
|
2162
2216
|
static getThumbnail(project, resourcesLoader, objectConfiguration) {
|
|
2163
|
-
const textureResourceName =
|
|
2164
|
-
|
|
2165
|
-
|
|
2217
|
+
const textureResourceName =
|
|
2218
|
+
RenderedCube3DObject2DInstance._getResourceNameToDisplay(
|
|
2219
|
+
objectConfiguration
|
|
2220
|
+
);
|
|
2166
2221
|
if (textureResourceName) {
|
|
2167
2222
|
return resourcesLoader.getResourceFullUrl(
|
|
2168
2223
|
project,
|
|
@@ -2174,18 +2229,20 @@ module.exports = {
|
|
|
2174
2229
|
}
|
|
2175
2230
|
|
|
2176
2231
|
updateTextureIfNeeded() {
|
|
2177
|
-
const textureName =
|
|
2178
|
-
|
|
2179
|
-
|
|
2232
|
+
const textureName =
|
|
2233
|
+
RenderedCube3DObject2DInstance._getResourceNameToDisplay(
|
|
2234
|
+
this._associatedObjectConfiguration
|
|
2235
|
+
);
|
|
2180
2236
|
if (textureName === this._renderedResourceName) return;
|
|
2181
2237
|
|
|
2182
2238
|
this.updateTexture();
|
|
2183
2239
|
}
|
|
2184
2240
|
|
|
2185
2241
|
updateTexture() {
|
|
2186
|
-
const textureName =
|
|
2187
|
-
|
|
2188
|
-
|
|
2242
|
+
const textureName =
|
|
2243
|
+
RenderedCube3DObject2DInstance._getResourceNameToDisplay(
|
|
2244
|
+
this._associatedObjectConfiguration
|
|
2245
|
+
);
|
|
2189
2246
|
|
|
2190
2247
|
if (!textureName) {
|
|
2191
2248
|
this._renderFallbackObject = true;
|
|
@@ -2308,6 +2365,17 @@ module.exports = {
|
|
|
2308
2365
|
}
|
|
2309
2366
|
|
|
2310
2367
|
class RenderedCube3DObject3DInstance extends Rendered3DInstance {
|
|
2368
|
+
_defaultWidth = 1;
|
|
2369
|
+
_defaultHeight = 1;
|
|
2370
|
+
_defaultDepth = 1;
|
|
2371
|
+
_faceResourceNames = new Array(6).fill(null);
|
|
2372
|
+
_faceVisibilities = new Array(6).fill(null);
|
|
2373
|
+
_shouldRepeatTextureOnFace = new Array(6).fill(null);
|
|
2374
|
+
_facesOrientation = 'Y';
|
|
2375
|
+
_backFaceUpThroughWhichAxisRotation = 'X';
|
|
2376
|
+
_shouldUseTransparentTexture = false;
|
|
2377
|
+
_tint = '';
|
|
2378
|
+
|
|
2311
2379
|
constructor(
|
|
2312
2380
|
project,
|
|
2313
2381
|
instance,
|
|
@@ -2324,21 +2392,9 @@ module.exports = {
|
|
|
2324
2392
|
threeGroup,
|
|
2325
2393
|
pixiResourcesLoader
|
|
2326
2394
|
);
|
|
2327
|
-
|
|
2328
|
-
this._defaultWidth = 1;
|
|
2329
|
-
this._defaultHeight = 1;
|
|
2330
|
-
this._defaultDepth = 1;
|
|
2331
|
-
|
|
2332
2395
|
this._pixiObject = new PIXI.Graphics();
|
|
2333
2396
|
this._pixiContainer.addChild(this._pixiObject);
|
|
2334
2397
|
|
|
2335
|
-
this._faceResourceNames = new Array(6).fill(null);
|
|
2336
|
-
this._faceVisibilities = new Array(6).fill(null);
|
|
2337
|
-
this._shouldRepeatTextureOnFace = new Array(6).fill(null);
|
|
2338
|
-
this._facesOrientation = 'Y';
|
|
2339
|
-
this._backFaceUpThroughWhichAxisRotation = 'X';
|
|
2340
|
-
this._shouldUseTransparentTexture = false;
|
|
2341
|
-
|
|
2342
2398
|
const geometry = new THREE.BoxGeometry(1, 1, 1);
|
|
2343
2399
|
const materials = [
|
|
2344
2400
|
getTransparentMaterial(),
|
|
@@ -2357,8 +2413,9 @@ module.exports = {
|
|
|
2357
2413
|
|
|
2358
2414
|
async _updateThreeObjectMaterials() {
|
|
2359
2415
|
const getFaceMaterial = async (project, faceIndex) => {
|
|
2360
|
-
if (!this._faceVisibilities[faceIndex])
|
|
2416
|
+
if (!this._faceVisibilities[faceIndex]) {
|
|
2361
2417
|
return getTransparentMaterial();
|
|
2418
|
+
}
|
|
2362
2419
|
|
|
2363
2420
|
return await this._pixiResourcesLoader.getThreeMaterial(
|
|
2364
2421
|
project,
|
|
@@ -2389,11 +2446,35 @@ module.exports = {
|
|
|
2389
2446
|
this._updateTextureUvMapping();
|
|
2390
2447
|
}
|
|
2391
2448
|
|
|
2449
|
+
_updateTint() {
|
|
2450
|
+
const tints = [];
|
|
2451
|
+
const normalizedTint = objectsRenderingService
|
|
2452
|
+
.hexNumberToRGBArray(
|
|
2453
|
+
objectsRenderingService.rgbOrHexToHexNumber(this._tint)
|
|
2454
|
+
)
|
|
2455
|
+
.map((component) => component / 255);
|
|
2456
|
+
|
|
2457
|
+
for (
|
|
2458
|
+
let i = 0;
|
|
2459
|
+
i < this._threeObject.geometry.attributes.position.count;
|
|
2460
|
+
i++
|
|
2461
|
+
) {
|
|
2462
|
+
tints.push(...normalizedTint);
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
this._threeObject.geometry.setAttribute(
|
|
2466
|
+
'color',
|
|
2467
|
+
new THREE.BufferAttribute(new Float32Array(tints), 3)
|
|
2468
|
+
);
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2392
2471
|
static _getResourceNameToDisplay(objectConfiguration) {
|
|
2393
2472
|
return getFirstVisibleFaceResourceName(objectConfiguration);
|
|
2394
2473
|
}
|
|
2395
2474
|
|
|
2396
2475
|
updateThreeObject() {
|
|
2476
|
+
/** @type {gdjs.Cube3DObjectData} */
|
|
2477
|
+
//@ts-ignore This works because the properties are set to `content` in JavaScript.
|
|
2397
2478
|
const object = gd.castObject(
|
|
2398
2479
|
this._associatedObjectConfiguration,
|
|
2399
2480
|
gd.ObjectJsImplementation
|
|
@@ -2421,13 +2502,19 @@ module.exports = {
|
|
|
2421
2502
|
|
|
2422
2503
|
let materialsDirty = false;
|
|
2423
2504
|
let uvMappingDirty = false;
|
|
2505
|
+
let tintDirty = false;
|
|
2424
2506
|
|
|
2425
2507
|
const shouldUseTransparentTexture =
|
|
2426
|
-
object.content.enableTextureTransparency;
|
|
2508
|
+
object.content.enableTextureTransparency || false;
|
|
2427
2509
|
if (this._shouldUseTransparentTexture !== shouldUseTransparentTexture) {
|
|
2428
2510
|
this._shouldUseTransparentTexture = shouldUseTransparentTexture;
|
|
2429
2511
|
materialsDirty = true;
|
|
2430
2512
|
}
|
|
2513
|
+
const tint = object.content.tint || '255;255;255';
|
|
2514
|
+
if (this._tint !== tint) {
|
|
2515
|
+
this._tint = tint;
|
|
2516
|
+
tintDirty = true;
|
|
2517
|
+
}
|
|
2431
2518
|
|
|
2432
2519
|
const faceResourceNames = [
|
|
2433
2520
|
object.content.frontFaceResourceName,
|
|
@@ -2471,12 +2558,12 @@ module.exports = {
|
|
|
2471
2558
|
}
|
|
2472
2559
|
|
|
2473
2560
|
const shouldRepeatTextureOnFace = [
|
|
2474
|
-
object.content.frontFaceResourceRepeat,
|
|
2475
|
-
object.content.backFaceResourceRepeat,
|
|
2476
|
-
object.content.leftFaceResourceRepeat,
|
|
2477
|
-
object.content.rightFaceResourceRepeat,
|
|
2478
|
-
object.content.topFaceResourceRepeat,
|
|
2479
|
-
object.content.bottomFaceResourceRepeat,
|
|
2561
|
+
object.content.frontFaceResourceRepeat || false,
|
|
2562
|
+
object.content.backFaceResourceRepeat || false,
|
|
2563
|
+
object.content.leftFaceResourceRepeat || false,
|
|
2564
|
+
object.content.rightFaceResourceRepeat || false,
|
|
2565
|
+
object.content.topFaceResourceRepeat || false,
|
|
2566
|
+
object.content.bottomFaceResourceRepeat || false,
|
|
2480
2567
|
];
|
|
2481
2568
|
if (
|
|
2482
2569
|
this._shouldRepeatTextureOnFace[0] !== shouldRepeatTextureOnFace[0] ||
|
|
@@ -2491,16 +2578,17 @@ module.exports = {
|
|
|
2491
2578
|
}
|
|
2492
2579
|
|
|
2493
2580
|
const backFaceUpThroughWhichAxisRotation =
|
|
2494
|
-
object.content.backFaceUpThroughWhichAxisRotation;
|
|
2581
|
+
object.content.backFaceUpThroughWhichAxisRotation || 'X';
|
|
2495
2582
|
if (
|
|
2496
2583
|
backFaceUpThroughWhichAxisRotation !==
|
|
2497
2584
|
this._backFaceUpThroughWhichAxisRotation
|
|
2498
2585
|
) {
|
|
2499
|
-
this._backFaceUpThroughWhichAxisRotation =
|
|
2586
|
+
this._backFaceUpThroughWhichAxisRotation =
|
|
2587
|
+
backFaceUpThroughWhichAxisRotation;
|
|
2500
2588
|
uvMappingDirty = true;
|
|
2501
2589
|
}
|
|
2502
2590
|
|
|
2503
|
-
const facesOrientation = object.content.facesOrientation;
|
|
2591
|
+
const facesOrientation = object.content.facesOrientation || 'Y';
|
|
2504
2592
|
if (facesOrientation !== this._facesOrientation) {
|
|
2505
2593
|
this._facesOrientation = facesOrientation;
|
|
2506
2594
|
uvMappingDirty = true;
|
|
@@ -2520,6 +2608,7 @@ module.exports = {
|
|
|
2520
2608
|
|
|
2521
2609
|
if (materialsDirty) this._updateThreeObjectMaterials();
|
|
2522
2610
|
if (uvMappingDirty) this._updateTextureUvMapping();
|
|
2611
|
+
if (tintDirty) this._updateTint();
|
|
2523
2612
|
}
|
|
2524
2613
|
|
|
2525
2614
|
/**
|
|
@@ -2529,11 +2618,11 @@ module.exports = {
|
|
|
2529
2618
|
* for the method to work.
|
|
2530
2619
|
*/
|
|
2531
2620
|
_updateTextureUvMapping() {
|
|
2532
|
-
// @ts-ignore - position is stored as a Float32BufferAttribute
|
|
2533
2621
|
/** @type {THREE.BufferAttribute} */
|
|
2622
|
+
// @ts-ignore - position is stored as a Float32BufferAttribute
|
|
2534
2623
|
const pos = this._threeObject.geometry.getAttribute('position');
|
|
2535
|
-
// @ts-ignore - uv is stored as a Float32BufferAttribute
|
|
2536
2624
|
/** @type {THREE.BufferAttribute} */
|
|
2625
|
+
// @ts-ignore - uv is stored as a Float32BufferAttribute
|
|
2537
2626
|
const uvMapping = this._threeObject.geometry.getAttribute('uv');
|
|
2538
2627
|
const startIndex = 0;
|
|
2539
2628
|
const endIndex = 23;
|
|
@@ -2552,9 +2641,10 @@ module.exports = {
|
|
|
2552
2641
|
continue;
|
|
2553
2642
|
}
|
|
2554
2643
|
|
|
2555
|
-
const shouldRepeatTexture =
|
|
2556
|
-
|
|
2557
|
-
|
|
2644
|
+
const shouldRepeatTexture =
|
|
2645
|
+
this._shouldRepeatTextureOnFace[
|
|
2646
|
+
materialIndexToFaceIndex[materialIndex]
|
|
2647
|
+
];
|
|
2558
2648
|
|
|
2559
2649
|
const shouldOrientateFacesTowardsY = this._facesOrientation === 'Y';
|
|
2560
2650
|
|
|
@@ -2589,16 +2679,13 @@ module.exports = {
|
|
|
2589
2679
|
}
|
|
2590
2680
|
} else {
|
|
2591
2681
|
if (shouldOrientateFacesTowardsY) {
|
|
2592
|
-
[x, y] =
|
|
2593
|
-
vertexIndex % 4
|
|
2594
|
-
];
|
|
2682
|
+
[x, y] =
|
|
2683
|
+
noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];
|
|
2595
2684
|
} else {
|
|
2596
|
-
[
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
vertexIndex % 4
|
|
2601
|
-
];
|
|
2685
|
+
[x, y] =
|
|
2686
|
+
noRepeatTextureVertexIndexToUvMappingForLeftAndRightFacesTowardsZ[
|
|
2687
|
+
vertexIndex % 4
|
|
2688
|
+
];
|
|
2602
2689
|
}
|
|
2603
2690
|
}
|
|
2604
2691
|
break;
|
|
@@ -2628,16 +2715,13 @@ module.exports = {
|
|
|
2628
2715
|
}
|
|
2629
2716
|
} else {
|
|
2630
2717
|
if (shouldOrientateFacesTowardsY) {
|
|
2631
|
-
[x, y] =
|
|
2632
|
-
vertexIndex % 4
|
|
2633
|
-
];
|
|
2718
|
+
[x, y] =
|
|
2719
|
+
noRepeatTextureVertexIndexToUvMapping[vertexIndex % 4];
|
|
2634
2720
|
} else {
|
|
2635
|
-
[
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
vertexIndex % 4
|
|
2640
|
-
];
|
|
2721
|
+
[x, y] =
|
|
2722
|
+
noRepeatTextureVertexIndexToUvMappingForLeftAndRightFacesTowardsZ[
|
|
2723
|
+
vertexIndex % 4
|
|
2724
|
+
];
|
|
2641
2725
|
x = -x;
|
|
2642
2726
|
y = -y;
|
|
2643
2727
|
}
|
|
@@ -2786,6 +2870,19 @@ module.exports = {
|
|
|
2786
2870
|
const epsilon = 1 / (1 << 16);
|
|
2787
2871
|
|
|
2788
2872
|
class Model3DRendered2DInstance extends RenderedInstance {
|
|
2873
|
+
/** @type {number} */
|
|
2874
|
+
_defaultWidth;
|
|
2875
|
+
/** @type {number} */
|
|
2876
|
+
_defaultHeight;
|
|
2877
|
+
/** @type {number} */
|
|
2878
|
+
_defaultDepth;
|
|
2879
|
+
|
|
2880
|
+
/** @type {[number, number, number] | null} */
|
|
2881
|
+
_originPoint;
|
|
2882
|
+
/** @type {[number, number, number] | null} */
|
|
2883
|
+
_centerPoint;
|
|
2884
|
+
|
|
2885
|
+
/** @type {[number, number, number]} */
|
|
2789
2886
|
_modelOriginPoint = [0, 0, 0];
|
|
2790
2887
|
|
|
2791
2888
|
constructor(
|
|
@@ -3028,10 +3125,15 @@ module.exports = {
|
|
|
3028
3125
|
}
|
|
3029
3126
|
}
|
|
3030
3127
|
|
|
3128
|
+
/**
|
|
3129
|
+
* @param {[number, number, number] | null} point1
|
|
3130
|
+
* @param {[number, number, number] | null} point2
|
|
3131
|
+
* @returns {boolean}
|
|
3132
|
+
*/
|
|
3031
3133
|
const isSamePoint = (point1, point2) => {
|
|
3032
|
-
if (
|
|
3033
|
-
|
|
3034
|
-
if (!point1
|
|
3134
|
+
if (!!point1 !== !!point2) return false;
|
|
3135
|
+
// At this point || or && doesn't matter and the type checking prefer ||.
|
|
3136
|
+
if (!point1 || !point2) return true;
|
|
3035
3137
|
return (
|
|
3036
3138
|
point1[0] === point2[0] &&
|
|
3037
3139
|
point1[1] === point2[1] &&
|
|
@@ -3039,6 +3141,10 @@ module.exports = {
|
|
|
3039
3141
|
);
|
|
3040
3142
|
};
|
|
3041
3143
|
|
|
3144
|
+
/**
|
|
3145
|
+
* @param {string} location
|
|
3146
|
+
* @returns {[number, number, number] | null}
|
|
3147
|
+
*/
|
|
3042
3148
|
const getPointForLocation = (location) => {
|
|
3043
3149
|
switch (location) {
|
|
3044
3150
|
case 'ModelOrigin':
|
|
@@ -3057,8 +3163,27 @@ module.exports = {
|
|
|
3057
3163
|
};
|
|
3058
3164
|
|
|
3059
3165
|
class Model3DRendered3DInstance extends Rendered3DInstance {
|
|
3166
|
+
_defaultWidth = 1;
|
|
3167
|
+
_defaultHeight = 1;
|
|
3168
|
+
_defaultDepth = 1;
|
|
3169
|
+
_originalWidth = 1;
|
|
3170
|
+
_originalHeight = 1;
|
|
3171
|
+
_originalDepth = 1;
|
|
3172
|
+
_rotationX = 0;
|
|
3173
|
+
_rotationY = 0;
|
|
3174
|
+
_rotationZ = 0;
|
|
3175
|
+
_keepAspectRatio = false;
|
|
3176
|
+
/** @type {[number, number, number] | null} */
|
|
3177
|
+
_originPoint = null;
|
|
3178
|
+
/** @type {[number, number, number] | null} */
|
|
3179
|
+
_centerPoint = null;
|
|
3180
|
+
|
|
3181
|
+
/** @type {[number, number, number]} */
|
|
3060
3182
|
_modelOriginPoint = [0, 0, 0];
|
|
3061
3183
|
|
|
3184
|
+
/** @type {THREE.Object3D | null} */
|
|
3185
|
+
_clonedModel3D = null;
|
|
3186
|
+
|
|
3062
3187
|
constructor(
|
|
3063
3188
|
project,
|
|
3064
3189
|
instance,
|
|
@@ -3076,29 +3201,12 @@ module.exports = {
|
|
|
3076
3201
|
pixiResourcesLoader
|
|
3077
3202
|
);
|
|
3078
3203
|
|
|
3079
|
-
this._defaultWidth = 1;
|
|
3080
|
-
this._defaultHeight = 1;
|
|
3081
|
-
this._defaultDepth = 1;
|
|
3082
|
-
this._originalWidth = 1;
|
|
3083
|
-
this._originalHeight = 1;
|
|
3084
|
-
this._originalDepth = 1;
|
|
3085
|
-
this._rotationX = 0;
|
|
3086
|
-
this._rotationY = 0;
|
|
3087
|
-
this._rotationZ = 0;
|
|
3088
|
-
this._keepAspectRatio = false;
|
|
3089
|
-
|
|
3090
|
-
this._originPoint = null;
|
|
3091
|
-
this._centerPoint = null;
|
|
3092
|
-
|
|
3093
3204
|
this._pixiObject = new PIXI.Graphics();
|
|
3094
3205
|
this._pixiContainer.addChild(this._pixiObject);
|
|
3095
3206
|
|
|
3096
3207
|
this._threeObject = new THREE.Group();
|
|
3097
3208
|
this._threeObject.rotation.order = 'ZYX';
|
|
3098
3209
|
this._threeGroup.add(this._threeObject);
|
|
3099
|
-
|
|
3100
|
-
this._threeModelGroup = null;
|
|
3101
|
-
this._clonedModel3D = null;
|
|
3102
3210
|
}
|
|
3103
3211
|
|
|
3104
3212
|
getOriginX() {
|
|
@@ -3140,27 +3248,30 @@ module.exports = {
|
|
|
3140
3248
|
}
|
|
3141
3249
|
|
|
3142
3250
|
_updateDefaultTransformation() {
|
|
3143
|
-
if (!this._clonedModel3D)
|
|
3251
|
+
if (!this._clonedModel3D) {
|
|
3252
|
+
// Model is not ready - nothing to do.
|
|
3253
|
+
return;
|
|
3254
|
+
}
|
|
3144
3255
|
|
|
3145
3256
|
if (this._threeModelGroup) {
|
|
3146
3257
|
// Remove any previous container as we will recreate it just below
|
|
3147
3258
|
this._threeObject.clear();
|
|
3148
3259
|
}
|
|
3260
|
+
|
|
3149
3261
|
// This group hold the rotation defined by properties.
|
|
3150
3262
|
// Always restart from a new group to avoid miscomputing bounding boxes/sizes.
|
|
3151
|
-
|
|
3152
|
-
this._threeModelGroup
|
|
3153
|
-
|
|
3263
|
+
const threeModelGroup = new THREE.Group();
|
|
3264
|
+
this._threeModelGroup = threeModelGroup;
|
|
3265
|
+
threeModelGroup.rotation.order = 'ZYX';
|
|
3266
|
+
threeModelGroup.add(this._clonedModel3D);
|
|
3154
3267
|
|
|
3155
|
-
|
|
3268
|
+
threeModelGroup.rotation.set(
|
|
3156
3269
|
(this._rotationX * Math.PI) / 180,
|
|
3157
3270
|
(this._rotationY * Math.PI) / 180,
|
|
3158
3271
|
(this._rotationZ * Math.PI) / 180
|
|
3159
3272
|
);
|
|
3160
|
-
|
|
3161
|
-
const boundingBox = new THREE.Box3().setFromObject(
|
|
3162
|
-
this._threeModelGroup
|
|
3163
|
-
);
|
|
3273
|
+
threeModelGroup.updateMatrixWorld(true);
|
|
3274
|
+
const boundingBox = new THREE.Box3().setFromObject(threeModelGroup);
|
|
3164
3275
|
|
|
3165
3276
|
const shouldKeepModelOrigin = !this._originPoint;
|
|
3166
3277
|
if (shouldKeepModelOrigin) {
|
|
@@ -3187,7 +3298,7 @@ module.exports = {
|
|
|
3187
3298
|
// Center the model.
|
|
3188
3299
|
const centerPoint = this._centerPoint;
|
|
3189
3300
|
if (centerPoint) {
|
|
3190
|
-
|
|
3301
|
+
threeModelGroup.position.set(
|
|
3191
3302
|
-(boundingBox.min.x + modelWidth * centerPoint[0]),
|
|
3192
3303
|
// The model is flipped on Y axis.
|
|
3193
3304
|
-(boundingBox.min.y + modelHeight * (1 - centerPoint[1])),
|
|
@@ -3196,8 +3307,8 @@ module.exports = {
|
|
|
3196
3307
|
}
|
|
3197
3308
|
|
|
3198
3309
|
// Rotate the model.
|
|
3199
|
-
|
|
3200
|
-
|
|
3310
|
+
threeModelGroup.scale.set(1, 1, 1);
|
|
3311
|
+
threeModelGroup.rotation.set(
|
|
3201
3312
|
(this._rotationX * Math.PI) / 180,
|
|
3202
3313
|
(this._rotationY * Math.PI) / 180,
|
|
3203
3314
|
(this._rotationZ * Math.PI) / 180
|
|
@@ -3212,8 +3323,8 @@ module.exports = {
|
|
|
3212
3323
|
// Flip on Y because the Y axis is on the opposite side of direct basis.
|
|
3213
3324
|
// It avoids models to be like a mirror refection.
|
|
3214
3325
|
scaleMatrix.makeScale(scaleX, -scaleY, scaleZ);
|
|
3215
|
-
|
|
3216
|
-
|
|
3326
|
+
threeModelGroup.updateMatrix();
|
|
3327
|
+
threeModelGroup.applyMatrix4(scaleMatrix);
|
|
3217
3328
|
|
|
3218
3329
|
if (this._keepAspectRatio) {
|
|
3219
3330
|
// Reduce the object dimensions to keep aspect ratio.
|
|
@@ -3280,7 +3391,7 @@ module.exports = {
|
|
|
3280
3391
|
this._defaultDepth = this._originalDepth;
|
|
3281
3392
|
}
|
|
3282
3393
|
|
|
3283
|
-
this._threeObject.add(
|
|
3394
|
+
this._threeObject.add(threeModelGroup);
|
|
3284
3395
|
}
|
|
3285
3396
|
|
|
3286
3397
|
updateThreeObject() {
|
|
@@ -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
|
|
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 a 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._crossfadeDuration=0;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._crossfadeDuration=t.content.crossfadeDuration||0,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,cfd:this._crossfadeDuration}}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()),e.cfd!==void 0&&(this._crossfadeDuration=e.cfd)}_reloadModel(e){this._modelResourceName=e.content.modelResourceName,this._renderer._reloadModel(this,this._runtimeScene),this.onModelChanged(e)}_updateModel(e){const t=e.content.rotationX||0,s=e.content.rotationY||0,d=e.content.rotationZ||0,i=e.content.keepAspectRatio;this._renderer._updateModel(t,s,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(s=>s.name===e);t>=0&&this.setAnimationIndex(t)}isCurrentAnimationName(e){return this.getAnimationName()===e}hasAnimationEnded(){return this._renderer.hasAnimationEnded()}setCrossfadeDuration(e){this._crossfadeDuration!==e&&(this._crossfadeDuration=e)}isAnimationPaused(){return this._animationPaused}pauseAnimation(){this._animationPaused=!0,this._renderer.pauseAnimation()}resumeAnimation(){this._animationPaused=!1,this._renderer.resumeAnimation()}getAnimationSpeedScale(){return this._animationSpeedScale}setAnimationSpeedScale(e){this._animationSpeedScale=e}getAnimationElapsedTime(){return this._renderer.getAnimationElapsedTime()}setAnimationElapsedTime(e){this._renderer.setAnimationElapsedTime(e),this._animationPaused||this._renderer.resumeAnimation()}getAnimationDuration(){return this._renderer.getAnimationDuration(this._animations[this._currentAnimationIndex].source)}getCenterX(){const e=this._renderer.getCenterPoint();return this.getWidth()*e[0]}getCenterY(){const e=this._renderer.getCenterPoint();return this.getHeight()*e[1]}getCenterZ(){const e=this._renderer.getCenterPoint();return this.getDepth()*e[2]}getDrawableX(){const e=this._renderer.getOriginPoint();return this.getX()-this.getWidth()*e[0]}getDrawableY(){const e=this._renderer.getOriginPoint();return this.getY()-this.getHeight()*e[1]}getDrawableZ(){const e=this._renderer.getOriginPoint();return this.getZ()-this.getDepth()*e[2]}}n.Model3DRuntimeObject=a,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={}))}(a=n.Model3DRuntimeObject||(n.Model3DRuntimeObject={})),n.registerObject("Scene3D::Model3DObject",n.Model3DRuntimeObject)})(gdjs||(gdjs={}));
|
|
2
2
|
//# sourceMappingURL=Model3DRuntimeObject.js.map
|