diff --git a/README.md b/README.md index 149f2ad9..840c64c8 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ With declarative (TSX/JSX) coding and HMR, you experience the same development w ![BabylonJS HMR](https://raw.githubusercontent.com/brianzinn/react-babylonjs/master/media/react-babylonjs-hmr.gif) # @babylonjs/core API Support -1. **Node -> Mesh** - abstractMesh, mesh, node, transformNode +1. **Node -> Mesh** - abstractMesh, groundMesh, instancedLinesMesh, instancedMesh, linesMesh, mesh, node, transformNode, trailMesh 2. **Cameras** - anaglyphArcRotateCamera, anaglyphFreeCamera, anaglyphGamepadCamera, anaglyphUniversalCamera, arcFollowCamera, arcRotateCamera, camera, deviceOrientationCamera, flyCamera, followCamera, freeCamera, gamepadCamera, stereoscopicArcRotateCamera, stereoscopicFreeCamera, stereoscopicGamepadCamera, stereoscopicUniversalCamera, targetCamera, touchCamera, universalCamera, virtualJoysticksCamera, vrDeviceOrientationArcRotateCamera, vrDeviceOrientationFreeCamera, vrDeviceOrientationGamepadCamera, webVrFreeCamera, webXrCamera diff --git a/package.json b/package.json index c54705f2..fdfc8735 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "cross-env": "^7.0.0", "earcut": "^2.2.2", "gsap": "^2.1.3", + "honeycomb-grid": "^3.1.7", "lint-staged": "^8.1.0", "lodash.camelcase": "^4.3.0", "pixi-projection": "^0.3.11", diff --git a/src/PropsHandler.ts b/src/PropsHandler.ts index 68b47d20..1f52be6e 100644 --- a/src/PropsHandler.ts +++ b/src/PropsHandler.ts @@ -312,6 +312,18 @@ export const checkControlDiff = (oldProp: Control | undefined, newProp: Control }) } +export const checkObjectDiff = (oldProp: object | undefined, newProp: object | undefined, propertyName: string, changedProps: PropertyUpdate[]): void => { + propertyCheck(oldProp, newProp, propertyName, PropChangeType.Primitive, changedProps, (oldProp, newProp, changedProps) => { + if (newProp !== oldProp) { + changedProps.push({ + propertyName, + changeType: PropChangeType.Primitive, + value: newProp + }) + } + }) +} + export type PrimitiveType = string | number | undefined | null | boolean; export const checkPrimitiveDiff = (oldProp: PrimitiveType | undefined, newProp: PrimitiveType | undefined, propertyName: string, changedProps: PropertyUpdate[]): void => { diff --git a/src/generatedCode.ts b/src/generatedCode.ts index beea32e9..118dbff7 100644 --- a/src/generatedCode.ts +++ b/src/generatedCode.ts @@ -1,9 +1,8 @@ -import { PropsHandler, PropertyUpdate, HasPropsHandlers, checkColor3Diff, checkColor4Diff, checkControlDiff, checkFresnelParametersDiff, checkLambdaDiff, checkMethodDiff, checkNumericArrayDiff, checkObservableDiff, checkPrimitiveDiff, checkQuaternionDiff, checkTextureDiff, checkVector3Diff } from "./PropsHandler"; +import { PropsHandler, PropertyUpdate, HasPropsHandlers, checkColor3Diff, checkColor4Diff, checkControlDiff, checkFresnelParametersDiff, checkLambdaDiff, checkMethodDiff, checkNumericArrayDiff, checkObjectDiff, checkObservableDiff, checkPrimitiveDiff, checkQuaternionDiff, checkTextureDiff, checkVector3Diff } from "./PropsHandler"; import { CreatedInstanceMetadata } from "./CreatedInstance"; -import { FiberNodeProps, FiberTransformNodeProps, FiberAbstractMeshProps, FiberMeshProps, FiberCameraProps, FiberTargetCameraProps, FiberFreeCameraProps, FiberTouchCameraProps, FiberUniversalCameraProps, FiberGamepadCameraProps, FiberAnaglyphGamepadCameraProps, FiberStereoscopicGamepadCameraProps, FiberAnaglyphUniversalCameraProps, FiberStereoscopicUniversalCameraProps, FiberDeviceOrientationCameraProps, FiberVRDeviceOrientationFreeCameraProps, FiberVRDeviceOrientationGamepadCameraProps, FiberAnaglyphFreeCameraProps, FiberStereoscopicFreeCameraProps, FiberVirtualJoysticksCameraProps, FiberWebVRFreeCameraProps, FiberWebXRCameraProps, FiberArcRotateCameraProps, FiberAnaglyphArcRotateCameraProps, FiberStereoscopicArcRotateCameraProps, FiberVRDeviceOrientationArcRotateCameraProps, FiberFlyCameraProps, FiberFollowCameraProps, FiberArcFollowCameraProps, FiberMaterialProps, FiberShaderMaterialProps, FiberMultiMaterialProps, FiberPushMaterialProps, FiberStandardMaterialProps, FiberBackgroundMaterialProps, FiberPBRBaseMaterialProps, FiberPBRBaseSimpleMaterialProps, FiberPBRMetallicRoughnessMaterialProps, FiberPBRSpecularGlossinessMaterialProps, FiberPBRMaterialProps, FiberNodeMaterialProps, FiberFluentMaterialProps, FiberLightProps, FiberShadowLightProps, FiberDirectionalLightProps, FiberPointLightProps, FiberSpotLightProps, FiberHemisphericLightProps, FiberControlProps, FiberContainerProps, FiberRectangleProps, FiberButtonProps, FiberSelectionPanelProps, FiberScrollViewerProps, FiberStackPanelProps, FiberVirtualKeyboardProps, FiberEllipseProps, FiberGridProps, Fiber_ScrollViewerWindowProps, FiberTextBlockProps, FiberImageProps, FiberCheckboxProps, FiberColorPickerProps, FiberInputTextProps, FiberInputPasswordProps, FiberLineProps, FiberMultiLineProps, FiberRadioButtonProps, FiberBaseSliderProps, FiberScrollBarProps, FiberImageScrollBarProps, FiberSliderProps, FiberImageBasedSliderProps, FiberDisplayGridProps, FiberControl3DProps, FiberContainer3DProps, FiberVolumeBasedPanelProps, FiberCylinderPanelProps, FiberPlanePanelProps, FiberScatterPanelProps, FiberSpherePanelProps, FiberStackPanel3DProps, FiberAbstractButton3DProps, FiberButton3DProps, FiberHolographicButtonProps, FiberMeshButton3DProps, FiberEffectLayerProps, FiberGlowLayerProps, FiberHighlightLayerProps, FiberBaseTextureProps, FiberCubeTextureProps, FiberRawCubeTextureProps, FiberTextureProps, FiberRawTextureProps, FiberProceduralTextureProps, FiberCustomProceduralTextureProps, FiberNoiseProceduralTextureProps, FiberRenderTargetTextureProps, FiberMirrorTextureProps, FiberMultiRenderTargetProps, FiberRefractionTextureProps, FiberMultiviewRenderTargetProps, FiberVideoTextureProps, FiberDynamicTextureProps, FiberAdvancedDynamicTextureProps, FiberRawTexture3DProps, FiberRawTexture2DArrayProps, FiberColorGradingTextureProps, FiberEquiRectangularCubeTextureProps, FiberHDRCubeTextureProps, FiberHtmlElementTextureProps, FiberGUI3DManagerProps, FiberShadowGeneratorProps, FiberCascadedShadowGeneratorProps, FiberEnvironmentHelperProps, FiberPhysicsImpostorProps, FiberVRExperienceHelperProps, FiberDynamicTerrainProps, FiberAutoRotationBehaviorProps, FiberBouncingBehaviorProps, FiberFramingBehaviorProps, FiberAttachToBoxBehaviorProps, FiberFadeInOutBehaviorProps, FiberMultiPointerScaleBehaviorProps, FiberPointerDragBehaviorProps, FiberSixDofDragBehaviorProps, FiberSceneProps } from "./generatedProps"; +import { FiberNodeProps, FiberTransformNodeProps, FiberAbstractMeshProps, FiberInstancedMeshProps, FiberInstancedLinesMeshProps, FiberMeshProps, FiberLinesMeshProps, FiberGroundMeshProps, FiberTrailMeshProps, FiberCameraProps, FiberTargetCameraProps, FiberFreeCameraProps, FiberTouchCameraProps, FiberUniversalCameraProps, FiberGamepadCameraProps, FiberAnaglyphGamepadCameraProps, FiberStereoscopicGamepadCameraProps, FiberAnaglyphUniversalCameraProps, FiberStereoscopicUniversalCameraProps, FiberDeviceOrientationCameraProps, FiberVRDeviceOrientationFreeCameraProps, FiberVRDeviceOrientationGamepadCameraProps, FiberAnaglyphFreeCameraProps, FiberStereoscopicFreeCameraProps, FiberVirtualJoysticksCameraProps, FiberWebVRFreeCameraProps, FiberWebXRCameraProps, FiberArcRotateCameraProps, FiberAnaglyphArcRotateCameraProps, FiberStereoscopicArcRotateCameraProps, FiberVRDeviceOrientationArcRotateCameraProps, FiberFlyCameraProps, FiberFollowCameraProps, FiberArcFollowCameraProps, FiberMaterialProps, FiberShaderMaterialProps, FiberMultiMaterialProps, FiberPushMaterialProps, FiberStandardMaterialProps, FiberBackgroundMaterialProps, FiberPBRBaseMaterialProps, FiberPBRBaseSimpleMaterialProps, FiberPBRMetallicRoughnessMaterialProps, FiberPBRSpecularGlossinessMaterialProps, FiberPBRMaterialProps, FiberNodeMaterialProps, FiberFluentMaterialProps, FiberLightProps, FiberShadowLightProps, FiberDirectionalLightProps, FiberPointLightProps, FiberSpotLightProps, FiberHemisphericLightProps, FiberControlProps, FiberContainerProps, FiberRectangleProps, FiberButtonProps, FiberSelectionPanelProps, FiberScrollViewerProps, FiberStackPanelProps, FiberVirtualKeyboardProps, FiberEllipseProps, FiberGridProps, Fiber_ScrollViewerWindowProps, FiberTextBlockProps, FiberImageProps, FiberCheckboxProps, FiberColorPickerProps, FiberInputTextProps, FiberInputPasswordProps, FiberLineProps, FiberMultiLineProps, FiberRadioButtonProps, FiberBaseSliderProps, FiberScrollBarProps, FiberImageScrollBarProps, FiberSliderProps, FiberImageBasedSliderProps, FiberDisplayGridProps, FiberControl3DProps, FiberContainer3DProps, FiberVolumeBasedPanelProps, FiberCylinderPanelProps, FiberPlanePanelProps, FiberScatterPanelProps, FiberSpherePanelProps, FiberStackPanel3DProps, FiberAbstractButton3DProps, FiberButton3DProps, FiberHolographicButtonProps, FiberMeshButton3DProps, FiberEffectLayerProps, FiberGlowLayerProps, FiberHighlightLayerProps, FiberBaseTextureProps, FiberCubeTextureProps, FiberRawCubeTextureProps, FiberTextureProps, FiberRawTextureProps, FiberProceduralTextureProps, FiberCustomProceduralTextureProps, FiberNoiseProceduralTextureProps, FiberRenderTargetTextureProps, FiberMirrorTextureProps, FiberMultiRenderTargetProps, FiberRefractionTextureProps, FiberMultiviewRenderTargetProps, FiberVideoTextureProps, FiberDynamicTextureProps, FiberAdvancedDynamicTextureProps, FiberRawTexture3DProps, FiberRawTexture2DArrayProps, FiberColorGradingTextureProps, FiberEquiRectangularCubeTextureProps, FiberHDRCubeTextureProps, FiberHtmlElementTextureProps, FiberGUI3DManagerProps, FiberShadowGeneratorProps, FiberCascadedShadowGeneratorProps, FiberEnvironmentHelperProps, FiberPhysicsImpostorProps, FiberVRExperienceHelperProps, FiberDynamicTerrainProps, FiberAutoRotationBehaviorProps, FiberBouncingBehaviorProps, FiberFramingBehaviorProps, FiberAttachToBoxBehaviorProps, FiberFadeInOutBehaviorProps, FiberMultiPointerScaleBehaviorProps, FiberPointerDragBehaviorProps, FiberSixDofDragBehaviorProps, FiberSceneProps } from "./generatedProps"; import { DynamicTerrain as ExtensionsDynamicTerrain } from "./extensions/DynamicTerrain"; import { AbstractScene as BabylonjsCoreAbstractScene } from "@babylonjs/core/abstractScene"; -import { Node as BabylonjsCoreNode } from "@babylonjs/core/node"; import { Scene as BabylonjsCoreScene } from "@babylonjs/core/scene"; import { Camera as BabylonjsCoreCamera } from "@babylonjs/core/Cameras/camera"; import { DebugLayerTab as BabylonjsCoreDebugLayerTab } from "@babylonjs/core/Debug/debugLayer"; @@ -16,8 +15,10 @@ import { SceneLoaderAnimationGroupLoadingMode as BabylonjsCoreSceneLoaderAnimati import { Material as BabylonjsCoreMaterial } from "@babylonjs/core/Materials/material"; import { Space as BabylonjsCoreSpace } from "@babylonjs/core/Maths/math.axis"; import { Orientation as BabylonjsCoreOrientation } from "@babylonjs/core/Maths/math.path"; +import { AbstractMesh as BabylonjsCoreAbstractMesh } from "@babylonjs/core/Meshes/abstractMesh"; import { Mesh as BabylonjsCoreMesh } from "@babylonjs/core/Meshes/mesh"; import { MeshBuilder as BabylonjsCoreMeshBuilder } from "@babylonjs/core/Meshes/meshBuilder"; +import { TransformNode as BabylonjsCoreTransformNode } from "@babylonjs/core/Meshes/transformNode"; import { AssetTaskState as BabylonjsCoreAssetTaskState } from "@babylonjs/core/Misc/assetsManager"; import { InspectableType as BabylonjsCoreInspectableType, IInspectable as BabylonjsCoreIInspectable } from "@babylonjs/core/Misc/iInspectable"; import { JoystickAxis as BabylonjsCoreJoystickAxis } from "@babylonjs/core/Misc/virtualJoystick"; @@ -55,22 +56,24 @@ import { NodeMaterialBlockConnectionPointTypes as BabylonjsCoreNodeMaterialBlock import { NodeMaterialBlockTargets as BabylonjsCoreNodeMaterialBlockTargets } from "@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets"; import { NodeMaterialSystemValues as BabylonjsCoreNodeMaterialSystemValues } from "@babylonjs/core/Materials/Node/Enums/nodeMaterialSystemValues"; import { AnimatedInputBlockTypes as BabylonjsCoreAnimatedInputBlockTypes } from "@babylonjs/core/Materials/Node/Blocks/Input/animatedInputBlockTypes"; +import { Node as BabylonjsCoreNode } from "@babylonjs/core/node"; import { AnimationPropertiesOverride as BabylonjsCoreAnimationPropertiesOverride } from "@babylonjs/core/Animations/animationPropertiesOverride"; import { Animation as BabylonjsCoreAnimation } from "@babylonjs/core/Animations/animation"; import { Observable as BabylonjsCoreObservable } from "@babylonjs/core/Misc/observable"; import { Behavior as BabylonjsCoreBehavior } from "@babylonjs/core/Behaviors/behavior"; -import { TransformNode as BabylonjsCoreTransformNode } from "@babylonjs/core/Meshes/transformNode"; import { Vector3 as BabylonjsCoreVector3, Quaternion as BabylonjsCoreQuaternion, Matrix as BabylonjsCoreMatrix, Vector2 as BabylonjsCoreVector2, Vector4 as BabylonjsCoreVector4 } from "@babylonjs/core/Maths/math.vector"; import { DeepImmutableObject as BabylonjsCoreDeepImmutableObject, IndicesArray as BabylonjsCoreIndicesArray, FloatArray as BabylonjsCoreFloatArray } from "@babylonjs/core/types"; -import { AbstractMesh as BabylonjsCoreAbstractMesh } from "@babylonjs/core/Meshes/abstractMesh"; import { AbstractActionManager as BabylonjsCoreAbstractActionManager } from "@babylonjs/core/Actions/abstractActionManager"; import { Color4 as BabylonjsCoreColor4, Color3 as BabylonjsCoreColor3 } from "@babylonjs/core/Maths/math.color"; import { Skeleton as BabylonjsCoreSkeleton } from "@babylonjs/core/Bones/skeleton"; import { SubMesh as BabylonjsCoreSubMesh } from "@babylonjs/core/Meshes/subMesh"; import { BoundingInfo as BabylonjsCoreBoundingInfo } from "@babylonjs/core/Culling/boundingInfo"; import { InstancedMesh as BabylonjsCoreInstancedMesh } from "@babylonjs/core/Meshes/instancedMesh"; +import { InstancedLinesMesh as BabylonjsCoreInstancedLinesMesh, LinesMesh as BabylonjsCoreLinesMesh } from "@babylonjs/core/Meshes/linesMesh"; import { MorphTargetManager as BabylonjsCoreMorphTargetManager } from "@babylonjs/core/Morph/morphTargetManager"; import { VertexBuffer as BabylonjsCoreVertexBuffer } from "@babylonjs/core/Meshes/buffer"; +import { GroundMesh as BabylonjsCoreGroundMesh } from "@babylonjs/core/Meshes/groundMesh"; +import { TrailMesh as BabylonjsCoreTrailMesh } from "@babylonjs/core/Meshes/trailMesh"; import { RenderTargetTexture as BabylonjsCoreRenderTargetTexture } from "@babylonjs/core/Materials/Textures/renderTargetTexture"; import { CameraInputsManager as BabylonjsCoreCameraInputsManager } from "@babylonjs/core/Cameras/cameraInputsManager"; import { Viewport as BabylonjsCoreViewport } from "@babylonjs/core/Maths/math.viewport"; @@ -104,9 +107,7 @@ import { FlyCamera as BabylonjsCoreFlyCamera } from "@babylonjs/core/Cameras/fly import { FlyCameraInputsManager as BabylonjsCoreFlyCameraInputsManager } from "@babylonjs/core/Cameras/flyCameraInputsManager"; import { FollowCamera as BabylonjsCoreFollowCamera, ArcFollowCamera as BabylonjsCoreArcFollowCamera } from "@babylonjs/core/Cameras/followCamera"; import { FollowCameraInputsManager as BabylonjsCoreFollowCameraInputsManager } from "@babylonjs/core/Cameras/followCameraInputsManager"; -import { LinesMesh as BabylonjsCoreLinesMesh } from "@babylonjs/core/Meshes/linesMesh"; import { Plane as BabylonjsCorePlane } from "@babylonjs/core/Maths/math.plane"; -import { GroundMesh as BabylonjsCoreGroundMesh } from "@babylonjs/core/Meshes/groundMesh"; import { SmartArray as BabylonjsCoreSmartArray, ISmartArrayLike as BabylonjsCoreISmartArrayLike } from "@babylonjs/core/Misc/smartArray"; import { Effect as BabylonjsCoreEffect } from "@babylonjs/core/Materials/effect"; import { ShaderMaterial as BabylonjsCoreShaderMaterial, IShaderMaterialOptions as BabylonjsCoreIShaderMaterialOptions } from "@babylonjs/core/Materials/shaderMaterial"; @@ -199,6 +200,7 @@ import { PhysicsJoint as BabylonjsCorePhysicsJoint } from "@babylonjs/core/Physi import { PickingInfo as BabylonjsCorePickingInfo } from "@babylonjs/core/Collisions/pickingInfo"; import { WebXRDefaultExperience as BabylonjsCoreWebXRDefaultExperience } from "@babylonjs/core/XR/webXRDefaultExperience"; import { SolidParticleSystem as BabylonjsCoreSolidParticleSystem } from "@babylonjs/core/Particles/solidParticleSystem"; +import { IPhysicsEnginePlugin as BabylonjsCoreIPhysicsEnginePlugin } from "@babylonjs/core/Physics/IPhysicsEngine"; import { Collider as BabylonjsCoreCollider } from "@babylonjs/core/Collisions/collider"; import { Ray as BabylonjsCoreRay } from "@babylonjs/core/Culling/ray"; import { IOfflineProvider as BabylonjsCoreIOfflineProvider } from "@babylonjs/core/Offline/IOfflineProvider"; @@ -209,7 +211,6 @@ import { PointerEventTypes as BabylonjsCorePointerEventTypes, PointerInfo as Bab import { PostProcessManager as BabylonjsCorePostProcessManager } from "@babylonjs/core/PostProcesses/postProcessManager"; import { AnimationGroup as BabylonjsCoreAnimationGroup } from "@babylonjs/core/Animations/animationGroup"; import { IParticleSystem as BabylonjsCoreIParticleSystem } from "@babylonjs/core/Particles/IParticleSystem"; -import { IPhysicsEnginePlugin as BabylonjsCoreIPhysicsEnginePlugin } from "@babylonjs/core/Physics/IPhysicsEngine"; export class FiberNodePropsHandler implements PropsHandler { getPropertyUpdates(oldProps: FiberNodeProps, newProps: FiberNodeProps): PropertyUpdate[] | null { @@ -259,7 +260,7 @@ export class FiberNode implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Node", - "namespace": "@babylonjs/core/Meshes/mesh", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -341,7 +342,7 @@ export class FiberTransformNode implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "TransformNode", - "namespace": "@babylonjs/core/Meshes/mesh", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -396,6 +397,7 @@ export class FiberAbstractMeshPropsHandler implements PropsHandler { - private propsHandlers: PropsHandler[]; +export class FiberAbstractMesh implements HasPropsHandlers { + private propsHandlers: PropsHandler[]; constructor() { this.propsHandlers = [ @@ -453,18 +455,18 @@ export class FiberAbstractMesh implements HasPropsHandlers[] { + getPropsHandlers(): PropsHandler[] { return this.propsHandlers; } - addPropsHandler(propHandler: PropsHandler): void { + addPropsHandler(propHandler: PropsHandler): void { this.propsHandlers.push(propHandler); } public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "AbstractMesh", - "namespace": "@babylonjs/core/Meshes/mesh", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -484,6 +486,121 @@ export class FiberAbstractMesh implements HasPropsHandlers { + getPropertyUpdates(oldProps: FiberInstancedMeshProps, newProps: FiberInstancedMeshProps): PropertyUpdate[] | null { + const changedProps: PropertyUpdate[] = [] + checkPrimitiveDiff(oldProps.renderingGroupId, newProps.renderingGroupId, 'renderingGroupId', changedProps) + checkMethodDiff(oldProps.setIndices, newProps.setIndices, 'setIndices', changedProps) + checkMethodDiff(oldProps.setVerticesData, newProps.setVerticesData, 'setVerticesData', changedProps) + return changedProps.length === 0 ? null : changedProps; + } +} + +/** + * Creates an instance based on a source mesh. + * + * This code has been generated + */ +export class FiberInstancedMesh implements HasPropsHandlers { + private propsHandlers: PropsHandler[]; + + constructor() { + this.propsHandlers = [ + new FiberInstancedMeshPropsHandler(), + new FiberAbstractMeshPropsHandler(), + new FiberTransformNodePropsHandler(), + new FiberNodePropsHandler() + ]; + } + + getPropsHandlers(): PropsHandler[] { + return this.propsHandlers; + } + + addPropsHandler(propHandler: PropsHandler): void { + this.propsHandlers.push(propHandler); + } + + public static readonly CreateInfo = { + "creationType": "Constructor", + "libraryLocation": "InstancedMesh", + "namespace": "@babylonjs/core", + "parameters": [ + { + "name": "name", + "type": "string", + "optional": false + }, + { + "name": "source", + "type": "BabylonjsCoreMesh", + "optional": false + } + ] + }; + public static readonly Metadata: CreatedInstanceMetadata = { + "isNode": true, + "className": "FiberInstancedMesh" + }; +} + +export class FiberInstancedLinesMeshPropsHandler implements PropsHandler { + getPropertyUpdates(oldProps: FiberInstancedLinesMeshProps, newProps: FiberInstancedLinesMeshProps): PropertyUpdate[] | null { + const changedProps: PropertyUpdate[] = [] + checkPrimitiveDiff(oldProps.intersectionThreshold, newProps.intersectionThreshold, 'intersectionThreshold', changedProps) + return changedProps.length === 0 ? null : changedProps; + } +} + +/** + * Creates an instance based on a source LinesMesh + * + * This code has been generated + */ +export class FiberInstancedLinesMesh implements HasPropsHandlers { + private propsHandlers: PropsHandler[]; + + constructor() { + this.propsHandlers = [ + new FiberInstancedLinesMeshPropsHandler(), + new FiberInstancedMeshPropsHandler(), + new FiberAbstractMeshPropsHandler(), + new FiberTransformNodePropsHandler(), + new FiberNodePropsHandler() + ]; + } + + getPropsHandlers(): PropsHandler[] { + return this.propsHandlers; + } + + addPropsHandler(propHandler: PropsHandler): void { + this.propsHandlers.push(propHandler); + } + + public static readonly CreateInfo = { + "creationType": "Constructor", + "libraryLocation": "InstancedLinesMesh", + "namespace": "@babylonjs/core", + "parameters": [ + { + "name": "name", + "type": "string", + "optional": false + }, + { + "name": "source", + "type": "BabylonjsCoreLinesMesh", + "optional": false + } + ] + }; + public static readonly Metadata: CreatedInstanceMetadata = { + "isNode": true, + "className": "FiberInstancedLinesMesh" + }; +} + export class FiberMeshPropsHandler implements PropsHandler { getPropertyUpdates(oldProps: FiberMeshProps, newProps: FiberMeshProps): PropertyUpdate[] | null { const changedProps: PropertyUpdate[] = [] @@ -537,7 +654,7 @@ export class FiberMesh implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Mesh", - "namespace": "@babylonjs/core/Meshes/mesh", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -577,6 +694,224 @@ export class FiberMesh implements HasPropsHandlers { }; } +export class FiberLinesMeshPropsHandler implements PropsHandler { + getPropertyUpdates(oldProps: FiberLinesMeshProps, newProps: FiberLinesMeshProps): PropertyUpdate[] | null { + const changedProps: PropertyUpdate[] = [] + checkPrimitiveDiff(oldProps.alpha, newProps.alpha, 'alpha', changedProps) + checkColor3Diff(oldProps.color, newProps.color, 'color', changedProps) + // type: 'any' property (not coded) BabylonjsCoreLinesMesh.color4. + checkPrimitiveDiff(oldProps.intersectionThreshold, newProps.intersectionThreshold, 'intersectionThreshold', changedProps) + // type: 'BabylonjsCoreMaterial' property (not coded) BabylonjsCoreLinesMesh.material. + return changedProps.length === 0 ? null : changedProps; + } +} + +/** + * Line mesh + * + * This code has been generated + */ +export class FiberLinesMesh implements HasPropsHandlers { + private propsHandlers: PropsHandler[]; + + constructor() { + this.propsHandlers = [ + new FiberLinesMeshPropsHandler(), + new FiberMeshPropsHandler(), + new FiberAbstractMeshPropsHandler(), + new FiberTransformNodePropsHandler(), + new FiberNodePropsHandler() + ]; + } + + getPropsHandlers(): PropsHandler[] { + return this.propsHandlers; + } + + addPropsHandler(propHandler: PropsHandler): void { + this.propsHandlers.push(propHandler); + } + + public static readonly CreateInfo = { + "creationType": "Constructor", + "libraryLocation": "LinesMesh", + "namespace": "@babylonjs/core", + "parameters": [ + { + "name": "name", + "type": "string", + "optional": false + }, + { + "name": "scene", + "type": "BabylonjsCoreScene", + "optional": true + }, + { + "name": "parent", + "type": "BabylonjsCoreNode", + "optional": true + }, + { + "name": "source", + "type": "BabylonjsCoreLinesMesh", + "optional": true + }, + { + "name": "doNotCloneChildren", + "type": "boolean", + "optional": true + }, + { + "name": "useVertexColor", + "type": "boolean", + "optional": true + }, + { + "name": "useVertexAlpha", + "type": "boolean", + "optional": true + } + ] + }; + public static readonly Metadata: CreatedInstanceMetadata = { + "isNode": true, + "className": "FiberLinesMesh" + }; +} + +export class FiberGroundMeshPropsHandler implements PropsHandler { + getPropertyUpdates(oldProps: FiberGroundMeshProps, newProps: FiberGroundMeshProps): PropertyUpdate[] | null { + const changedProps: PropertyUpdate[] = [] + checkPrimitiveDiff(oldProps.generateOctree, newProps.generateOctree, 'generateOctree', changedProps) + return changedProps.length === 0 ? null : changedProps; + } +} + +/** + * Mesh representing the gorund + * + * This code has been generated + */ +export class FiberGroundMesh implements HasPropsHandlers { + private propsHandlers: PropsHandler[]; + + constructor() { + this.propsHandlers = [ + new FiberGroundMeshPropsHandler(), + new FiberMeshPropsHandler(), + new FiberAbstractMeshPropsHandler(), + new FiberTransformNodePropsHandler(), + new FiberNodePropsHandler() + ]; + } + + getPropsHandlers(): PropsHandler[] { + return this.propsHandlers; + } + + addPropsHandler(propHandler: PropsHandler): void { + this.propsHandlers.push(propHandler); + } + + public static readonly CreateInfo = { + "creationType": "Constructor", + "libraryLocation": "GroundMesh", + "namespace": "@babylonjs/core", + "parameters": [ + { + "name": "name", + "type": "string", + "optional": false + }, + { + "name": "scene", + "type": "BabylonjsCoreScene", + "optional": false + } + ] + }; + public static readonly Metadata: CreatedInstanceMetadata = { + "isNode": true, + "className": "FiberGroundMesh" + }; +} + +export class FiberTrailMeshPropsHandler implements PropsHandler { + getPropertyUpdates(oldProps: FiberTrailMeshProps, newProps: FiberTrailMeshProps): PropertyUpdate[] | null { + return null; // no props to check + } +} + +/** + * Class used to create a trail following a mesh + * + * This code has been generated + */ +export class FiberTrailMesh implements HasPropsHandlers { + private propsHandlers: PropsHandler[]; + + constructor() { + this.propsHandlers = [ + new FiberTrailMeshPropsHandler(), + new FiberMeshPropsHandler(), + new FiberAbstractMeshPropsHandler(), + new FiberTransformNodePropsHandler(), + new FiberNodePropsHandler() + ]; + } + + getPropsHandlers(): PropsHandler[] { + return this.propsHandlers; + } + + addPropsHandler(propHandler: PropsHandler): void { + this.propsHandlers.push(propHandler); + } + + public static readonly CreateInfo = { + "creationType": "Constructor", + "libraryLocation": "TrailMesh", + "namespace": "@babylonjs/core", + "parameters": [ + { + "name": "name", + "type": "string", + "optional": false + }, + { + "name": "generator", + "type": "BabylonjsCoreTransformNode", + "optional": false + }, + { + "name": "scene", + "type": "BabylonjsCoreScene", + "optional": false + }, + { + "name": "diameter", + "type": "number", + "optional": true + }, + { + "name": "length", + "type": "number", + "optional": true + }, + { + "name": "autoStart", + "type": "boolean", + "optional": true + } + ] + }; + public static readonly Metadata: CreatedInstanceMetadata = { + "isNode": true, + "className": "FiberTrailMesh" + }; +} + export class FiberCameraPropsHandler implements PropsHandler { getPropertyUpdates(oldProps: FiberCameraProps, newProps: FiberCameraProps): PropertyUpdate[] | null { const changedProps: PropertyUpdate[] = [] @@ -646,7 +981,7 @@ export class FiberCamera implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Camera", - "namespace": "@babylonjs/core/Cameras/camera", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -728,7 +1063,7 @@ export class FiberTargetCamera implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "TargetCamera", - "namespace": "@babylonjs/core/Cameras/camera", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -814,7 +1149,7 @@ export class FiberFreeCamera implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "FreeCamera", - "namespace": "@babylonjs/core/Cameras/camera", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -885,7 +1220,7 @@ export class FiberTouchCamera implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "TouchCamera", - "namespace": "@babylonjs/core/Cameras/camera", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -952,7 +1287,7 @@ export class FiberUniversalCamera implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "UniversalCamera", - "namespace": "@babylonjs/core/Cameras/camera", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -1017,7 +1352,7 @@ export class FiberGamepadCamera implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "GamepadCamera", - "namespace": "@babylonjs/core/Cameras/camera", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -1082,7 +1417,7 @@ export class FiberAnaglyphGamepadCamera implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "WebVRFreeCamera", - "namespace": "@babylonjs/core/Cameras/camera", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -1868,7 +2203,7 @@ export class FiberWebXRCamera implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "WebXRCamera", - "namespace": "@babylonjs/core/Cameras/camera", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -1999,7 +2334,7 @@ export class FiberArcRotateCamera implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "ArcRotateCamera", - "namespace": "@babylonjs/core/Cameras/camera", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -2081,7 +2416,7 @@ export class FiberAnaglyphArcRotateCamera implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "FlyCamera", - "namespace": "@babylonjs/core/Cameras/camera", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -2448,7 +2783,7 @@ export class FiberFollowCamera implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "FollowCamera", - "namespace": "@babylonjs/core/Cameras/camera", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -2520,7 +2855,7 @@ export class FiberArcFollowCamera implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "ArcFollowCamera", - "namespace": "@babylonjs/core/Cameras/camera", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -5467,7 +5802,7 @@ export class FiberMaterial implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Material", - "namespace": "@babylonjs/core/Materials/material", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -5547,7 +5882,7 @@ export class FiberShaderMaterial implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "ShaderMaterial", - "namespace": "@babylonjs/core/Materials/material", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -5611,7 +5946,7 @@ export class FiberMultiMaterial implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "MultiMaterial", - "namespace": "@babylonjs/core/Materials/material", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -5665,7 +6000,7 @@ export class FiberPushMaterial implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "PushMaterial", - "namespace": "@babylonjs/core/Materials/material", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -5781,7 +6116,7 @@ export class FiberStandardMaterial implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "PBRMaterial", - "namespace": "@babylonjs/core/Materials/material", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -6327,7 +6662,7 @@ export class FiberNodeMaterial implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "NodeMaterial", - "namespace": "@babylonjs/core/Materials/material", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -6402,7 +6737,7 @@ export class FiberFluentMaterial implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "FluentMaterial", - "namespace": "@babylonjs/core/Materials/material", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -6472,7 +6807,7 @@ export class FiberLight implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Light", - "namespace": "@babylonjs/core/Lights/light", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -6548,7 +6883,7 @@ export class FiberShadowLight implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "ShadowLight", - "namespace": "@babylonjs/core/Lights/light", + "namespace": "@babylonjs/core", "parameters": [] }; public static readonly Metadata: CreatedInstanceMetadata = { @@ -6600,7 +6935,7 @@ export class FiberDirectionalLight implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "DirectionalLight", - "namespace": "@babylonjs/core/Lights/light", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -6669,7 +7004,7 @@ export class FiberPointLight implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "PointLight", - "namespace": "@babylonjs/core/Lights/light", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -6745,7 +7080,7 @@ export class FiberSpotLight implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "SpotLight", - "namespace": "@babylonjs/core/Lights/light", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -6827,7 +7162,7 @@ export class FiberHemisphericLight implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "HemisphericLight", - "namespace": "@babylonjs/core/Lights/light", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -6952,7 +7287,7 @@ export class FiberControl implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Control", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -7007,7 +7342,7 @@ export class FiberContainer implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Container", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -7059,7 +7394,7 @@ export class FiberRectangle implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Rectangle", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -7115,7 +7450,7 @@ export class FiberButton implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Button", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -7179,7 +7514,7 @@ export class FiberSelectionPanel implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "SelectionPanel", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -7255,7 +7590,7 @@ export class FiberScrollViewer implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "ScrollViewer", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -7314,7 +7649,7 @@ export class FiberStackPanel implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "StackPanel", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -7377,7 +7712,7 @@ export class FiberVirtualKeyboard implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "VirtualKeyboard", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [] }; public static readonly Metadata: CreatedInstanceMetadata = { @@ -7422,7 +7757,7 @@ export class FiberEllipse implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Ellipse", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -7477,7 +7812,7 @@ export class FiberGrid implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Grid", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -7530,7 +7865,7 @@ export class Fiber_ScrollViewerWindow implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "TextBlock", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -7662,7 +7997,7 @@ export class FiberImage implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Image", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -7721,7 +8056,7 @@ export class FiberCheckbox implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Checkbox", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -7775,7 +8110,7 @@ export class FiberColorPicker implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "ColorPicker", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -7853,7 +8188,7 @@ export class FiberInputText implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "InputText", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -7906,7 +8241,7 @@ export class FiberInputPassword implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "InputPassword", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [] }; public static readonly Metadata: CreatedInstanceMetadata = { @@ -7958,7 +8293,7 @@ export class FiberLine implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Line", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -8013,7 +8348,7 @@ export class FiberMultiLine implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "MultiLine", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -8068,7 +8403,7 @@ export class FiberRadioButton implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "RadioButton", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -8127,7 +8462,7 @@ export class FiberBaseSlider implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "BaseSlider", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -8179,7 +8514,7 @@ export class FiberScrollBar implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "ScrollBar", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -8235,7 +8570,7 @@ export class FiberImageScrollBar implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "ImageScrollBar", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -8289,7 +8624,7 @@ export class FiberSlider implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Slider", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -8343,7 +8678,7 @@ export class FiberImageBasedSlider implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "DisplayGrid", - "namespace": "@babylonjs/gui/2D/controls/control", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -8471,7 +8806,7 @@ export class FiberControl3D implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Control3D", - "namespace": "@babylonjs/gui/3D/controls/control3D", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -8521,7 +8856,7 @@ export class FiberContainer3D implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Container3D", - "namespace": "@babylonjs/gui/3D/controls/control3D", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -8574,7 +8909,7 @@ export class FiberVolumeBasedPanel implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "CylinderPanel", - "namespace": "@babylonjs/gui/3D/controls/control3D", + "namespace": "@babylonjs/gui", "parameters": [] }; public static readonly Metadata: CreatedInstanceMetadata = { @@ -8662,7 +8997,7 @@ export class FiberPlanePanel implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "PlanePanel", - "namespace": "@babylonjs/gui/3D/controls/control3D", + "namespace": "@babylonjs/gui", "parameters": [] }; public static readonly Metadata: CreatedInstanceMetadata = { @@ -8707,7 +9042,7 @@ export class FiberScatterPanel implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "ScatterPanel", - "namespace": "@babylonjs/gui/3D/controls/control3D", + "namespace": "@babylonjs/gui", "parameters": [] }; public static readonly Metadata: CreatedInstanceMetadata = { @@ -8752,7 +9087,7 @@ export class FiberSpherePanel implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "SpherePanel", - "namespace": "@babylonjs/gui/3D/controls/control3D", + "namespace": "@babylonjs/gui", "parameters": [] }; public static readonly Metadata: CreatedInstanceMetadata = { @@ -8797,7 +9132,7 @@ export class FiberStackPanel3D implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "StackPanel3D", - "namespace": "@babylonjs/gui/3D/controls/control3D", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "isVertical", @@ -8844,7 +9179,7 @@ export class FiberAbstractButton3D implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Button3D", - "namespace": "@babylonjs/gui/3D/controls/control3D", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "name", @@ -8950,7 +9285,7 @@ export class FiberHolographicButton implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "MeshButton3D", - "namespace": "@babylonjs/gui/3D/controls/control3D", + "namespace": "@babylonjs/gui", "parameters": [ { "name": "mesh", @@ -9072,7 +9407,7 @@ export class FiberEffectLayer implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "EffectLayer", - "namespace": "@babylonjs/core/Layers/effectLayer", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -9135,7 +9470,7 @@ export class FiberGlowLayer implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "GlowLayer", - "namespace": "@babylonjs/core/Layers/effectLayer", + "namespace": "@babylonjs/core", "parameters": [ { "name": "name", @@ -9207,7 +9542,7 @@ export class FiberHighlightLayer implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "BaseTexture", - "namespace": "@babylonjs/core/Materials/Textures/baseTexture", + "namespace": "@babylonjs/core", "parameters": [ { "name": "scene", @@ -9355,7 +9690,7 @@ export class FiberCubeTexture implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "CubeTexture", - "namespace": "@babylonjs/core/Materials/Textures/baseTexture", + "namespace": "@babylonjs/core", "parameters": [ { "name": "rootUrl", @@ -9463,7 +9798,7 @@ export class FiberRawCubeTexture implements HasPropsHandlers { public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "Texture", - "namespace": "@babylonjs/core/Materials/Textures/baseTexture", + "namespace": "@babylonjs/core", "parameters": [ { "name": "url", @@ -9667,7 +10002,7 @@ export class FiberRawTexture implements HasPropsHandlers public static readonly CreateInfo = { "creationType": "Constructor", "libraryLocation": "RawTexture", - "namespace": "@babylonjs/core/Materials/Textures/baseTexture", + "namespace": "@babylonjs/core", "parameters": [ { "name": "data", @@ -9773,7 +10108,7 @@ export class FiberProceduralTexture implements HasPropsHandlers { checkObservableDiff(oldProps.onAfterCameraRenderObservable, newProps.onAfterCameraRenderObservable, 'onAfterCameraRenderObservable', changedProps) checkObservableDiff(oldProps.onAfterDrawPhaseObservable, newProps.onAfterDrawPhaseObservable, 'onAfterDrawPhaseObservable', changedProps) checkObservableDiff(oldProps.onAfterParticlesRenderingObservable, newProps.onAfterParticlesRenderingObservable, 'onAfterParticlesRenderingObservable', changedProps) + checkObservableDiff(oldProps.onAfterPhysicsObservable, newProps.onAfterPhysicsObservable, 'onAfterPhysicsObservable', changedProps) checkObservableDiff(oldProps.onAfterRenderCameraObservable, newProps.onAfterRenderCameraObservable, 'onAfterRenderCameraObservable', changedProps) checkObservableDiff(oldProps.onAfterRenderingGroupObservable, newProps.onAfterRenderingGroupObservable, 'onAfterRenderingGroupObservable', changedProps) checkObservableDiff(oldProps.onAfterRenderObservable, newProps.onAfterRenderObservable, 'onAfterRenderObservable', changedProps) @@ -12368,6 +12704,7 @@ export class FiberScenePropsHandler implements PropsHandler { checkObservableDiff(oldProps.onBeforeCameraRenderObservable, newProps.onBeforeCameraRenderObservable, 'onBeforeCameraRenderObservable', changedProps) checkObservableDiff(oldProps.onBeforeDrawPhaseObservable, newProps.onBeforeDrawPhaseObservable, 'onBeforeDrawPhaseObservable', changedProps) checkObservableDiff(oldProps.onBeforeParticlesRenderingObservable, newProps.onBeforeParticlesRenderingObservable, 'onBeforeParticlesRenderingObservable', changedProps) + checkObservableDiff(oldProps.onBeforePhysicsObservable, newProps.onBeforePhysicsObservable, 'onBeforePhysicsObservable', changedProps) checkObservableDiff(oldProps.onBeforeRenderingGroupObservable, newProps.onBeforeRenderingGroupObservable, 'onBeforeRenderingGroupObservable', changedProps) checkObservableDiff(oldProps.onBeforeRenderObservable, newProps.onBeforeRenderObservable, 'onBeforeRenderObservable', changedProps) checkObservableDiff(oldProps.onBeforeRenderTargetsRenderObservable, newProps.onBeforeRenderTargetsRenderObservable, 'onBeforeRenderTargetsRenderObservable', changedProps) @@ -12440,6 +12777,8 @@ export class FiberScenePropsHandler implements PropsHandler { checkMethodDiff(oldProps.addSkeleton, newProps.addSkeleton, 'addSkeleton', changedProps) checkMethodDiff(oldProps.addTexture, newProps.addTexture, 'addTexture', changedProps) checkMethodDiff(oldProps.addTransformNode, newProps.addTransformNode, 'addTransformNode', changedProps) + checkMethodDiff(oldProps.deleteCompoundImpostor, newProps.deleteCompoundImpostor, 'deleteCompoundImpostor', changedProps) + checkMethodDiff(oldProps.enablePhysics, newProps.enablePhysics, 'enablePhysics', changedProps) checkMethodDiff(oldProps.setActiveCameraByID, newProps.setActiveCameraByID, 'setActiveCameraByID', changedProps) checkMethodDiff(oldProps.setActiveCameraByName, newProps.setActiveCameraByName, 'setActiveCameraByName', changedProps) checkMethodDiff(oldProps.setPointerOverMesh, newProps.setPointerOverMesh, 'setPointerOverMesh', changedProps) @@ -12451,19 +12790,20 @@ export class FiberScenePropsHandler implements PropsHandler { } } -export const ADTForMesh: string = 'ADTForMesh', ADTFullscreenUI: string = 'ADTFullscreenUI', AbstractButton3D: string = 'AbstractButton3D', AbstractMesh: string = 'AbstractMesh', AdvancedDynamicTexture: string = 'AdvancedDynamicTexture', AnaglyphArcRotateCamera: string = 'AnaglyphArcRotateCamera', AnaglyphFreeCamera: string = 'AnaglyphFreeCamera', AnaglyphGamepadCamera: string = 'AnaglyphGamepadCamera', AnaglyphUniversalCamera: string = 'AnaglyphUniversalCamera', ArcFollowCamera: string = 'ArcFollowCamera', ArcRotateCamera: string = 'ArcRotateCamera', AttachToBoxBehavior: string = 'AttachToBoxBehavior', AutoRotationBehavior: string = 'AutoRotationBehavior', BackgroundMaterial: string = 'BackgroundMaterial', BaseSlider: string = 'BaseSlider', BaseTexture: string = 'BaseTexture', BouncingBehavior: string = 'BouncingBehavior', Box: string = 'Box', Button: string = 'Button', Button3D: string = 'Button3D', Camera: string = 'Camera', CascadedShadowGenerator: string = 'CascadedShadowGenerator', Checkbox: string = 'Checkbox', ColorGradingTexture: string = 'ColorGradingTexture', ColorPicker: string = 'ColorPicker', Container: string = 'Container', Container3D: string = 'Container3D', Control: string = 'Control', Control3D: string = 'Control3D', CubeTexture: string = 'CubeTexture', CustomProceduralTexture: string = 'CustomProceduralTexture', Cylinder: string = 'Cylinder', CylinderPanel: string = 'CylinderPanel', DashedLines: string = 'DashedLines', Decal: string = 'Decal', DeviceOrientationCamera: string = 'DeviceOrientationCamera', DirectionalLight: string = 'DirectionalLight', Disc: string = 'Disc', DisplayGrid: string = 'DisplayGrid', DynamicTerrain: string = 'DynamicTerrain', DynamicTexture: string = 'DynamicTexture', EffectLayer: string = 'EffectLayer', Ellipse: string = 'Ellipse', EnvironmentHelper: string = 'EnvironmentHelper', EquiRectangularCubeTexture: string = 'EquiRectangularCubeTexture', ExtrudePolygon: string = 'ExtrudePolygon', ExtrudeShape: string = 'ExtrudeShape', ExtrudeShapeCustom: string = 'ExtrudeShapeCustom', FadeInOutBehavior: string = 'FadeInOutBehavior', FluentMaterial: string = 'FluentMaterial', FlyCamera: string = 'FlyCamera', FollowCamera: string = 'FollowCamera', FramingBehavior: string = 'FramingBehavior', FreeCamera: string = 'FreeCamera', GUI3DManager: string = 'GUI3DManager', GamepadCamera: string = 'GamepadCamera', GlowLayer: string = 'GlowLayer', Grid: string = 'Grid', Ground: string = 'Ground', GroundFromHeightMap: string = 'GroundFromHeightMap', HDRCubeTexture: string = 'HDRCubeTexture', HemisphericLight: string = 'HemisphericLight', HighlightLayer: string = 'HighlightLayer', HolographicButton: string = 'HolographicButton', HtmlElementTexture: string = 'HtmlElementTexture', IcoSphere: string = 'IcoSphere', Image: string = 'Image', ImageBasedSlider: string = 'ImageBasedSlider', ImageScrollBar: string = 'ImageScrollBar', InputPassword: string = 'InputPassword', InputText: string = 'InputText', Lathe: string = 'Lathe', Light: string = 'Light', Line: string = 'Line', LineSystem: string = 'LineSystem', Lines: string = 'Lines', Material: string = 'Material', Mesh: string = 'Mesh', MeshButton3D: string = 'MeshButton3D', MirrorTexture: string = 'MirrorTexture', Model: string = 'Model', MultiLine: string = 'MultiLine', MultiMaterial: string = 'MultiMaterial', MultiPointerScaleBehavior: string = 'MultiPointerScaleBehavior', MultiRenderTarget: string = 'MultiRenderTarget', MultiviewRenderTarget: string = 'MultiviewRenderTarget', Node: string = 'Node', NodeMaterial: string = 'NodeMaterial', NoiseProceduralTexture: string = 'NoiseProceduralTexture', PBRBaseMaterial: string = 'PBRBaseMaterial', PBRBaseSimpleMaterial: string = 'PBRBaseSimpleMaterial', PBRMaterial: string = 'PBRMaterial', PBRMetallicRoughnessMaterial: string = 'PBRMetallicRoughnessMaterial', PBRSpecularGlossinessMaterial: string = 'PBRSpecularGlossinessMaterial', PhysicsImpostor: string = 'PhysicsImpostor', Plane: string = 'Plane', PlanePanel: string = 'PlanePanel', PointLight: string = 'PointLight', PointerDragBehavior: string = 'PointerDragBehavior', Polygon: string = 'Polygon', Polyhedron: string = 'Polyhedron', ProceduralTexture: string = 'ProceduralTexture', PushMaterial: string = 'PushMaterial', RadioButton: string = 'RadioButton', RawCubeTexture: string = 'RawCubeTexture', RawTexture: string = 'RawTexture', RawTexture2DArray: string = 'RawTexture2DArray', RawTexture3D: string = 'RawTexture3D', Rectangle: string = 'Rectangle', RefractionTexture: string = 'RefractionTexture', RenderTargetTexture: string = 'RenderTargetTexture', Ribbon: string = 'Ribbon', ScatterPanel: string = 'ScatterPanel', ScrollBar: string = 'ScrollBar', ScrollViewer: string = 'ScrollViewer', SelectionPanel: string = 'SelectionPanel', ShaderMaterial: string = 'ShaderMaterial', ShadowGenerator: string = 'ShadowGenerator', ShadowLight: string = 'ShadowLight', SixDofDragBehavior: string = 'SixDofDragBehavior', Slider: string = 'Slider', Sphere: string = 'Sphere', SpherePanel: string = 'SpherePanel', SpotLight: string = 'SpotLight', StackPanel: string = 'StackPanel', StackPanel3D: string = 'StackPanel3D', StandardMaterial: string = 'StandardMaterial', StereoscopicArcRotateCamera: string = 'StereoscopicArcRotateCamera', StereoscopicFreeCamera: string = 'StereoscopicFreeCamera', StereoscopicGamepadCamera: string = 'StereoscopicGamepadCamera', StereoscopicUniversalCamera: string = 'StereoscopicUniversalCamera', TargetCamera: string = 'TargetCamera', TextBlock: string = 'TextBlock', Texture: string = 'Texture', TiledBox: string = 'TiledBox', TiledGround: string = 'TiledGround', TiledPlane: string = 'TiledPlane', Torus: string = 'Torus', TorusKnot: string = 'TorusKnot', TouchCamera: string = 'TouchCamera', TransformNode: string = 'TransformNode', Tube: string = 'Tube', UniversalCamera: string = 'UniversalCamera', VRDeviceOrientationArcRotateCamera: string = 'VRDeviceOrientationArcRotateCamera', VRDeviceOrientationFreeCamera: string = 'VRDeviceOrientationFreeCamera', VRDeviceOrientationGamepadCamera: string = 'VRDeviceOrientationGamepadCamera', VRExperienceHelper: string = 'VRExperienceHelper', VideoTexture: string = 'VideoTexture', VirtualJoysticksCamera: string = 'VirtualJoysticksCamera', VirtualKeyboard: string = 'VirtualKeyboard', VolumeBasedPanel: string = 'VolumeBasedPanel', WebVRFreeCamera: string = 'WebVRFreeCamera', WebXRCamera: string = 'WebXRCamera', _ScrollViewerWindow: string = '_ScrollViewerWindow'; +export const ADTForMesh: string = 'ADTForMesh', ADTFullscreenUI: string = 'ADTFullscreenUI', AbstractButton3D: string = 'AbstractButton3D', AbstractMesh: string = 'AbstractMesh', AdvancedDynamicTexture: string = 'AdvancedDynamicTexture', AnaglyphArcRotateCamera: string = 'AnaglyphArcRotateCamera', AnaglyphFreeCamera: string = 'AnaglyphFreeCamera', AnaglyphGamepadCamera: string = 'AnaglyphGamepadCamera', AnaglyphUniversalCamera: string = 'AnaglyphUniversalCamera', ArcFollowCamera: string = 'ArcFollowCamera', ArcRotateCamera: string = 'ArcRotateCamera', AttachToBoxBehavior: string = 'AttachToBoxBehavior', AutoRotationBehavior: string = 'AutoRotationBehavior', BackgroundMaterial: string = 'BackgroundMaterial', BaseSlider: string = 'BaseSlider', BaseTexture: string = 'BaseTexture', BouncingBehavior: string = 'BouncingBehavior', Box: string = 'Box', Button: string = 'Button', Button3D: string = 'Button3D', Camera: string = 'Camera', CascadedShadowGenerator: string = 'CascadedShadowGenerator', Checkbox: string = 'Checkbox', ColorGradingTexture: string = 'ColorGradingTexture', ColorPicker: string = 'ColorPicker', Container: string = 'Container', Container3D: string = 'Container3D', Control: string = 'Control', Control3D: string = 'Control3D', CubeTexture: string = 'CubeTexture', CustomProceduralTexture: string = 'CustomProceduralTexture', Cylinder: string = 'Cylinder', CylinderPanel: string = 'CylinderPanel', DashedLines: string = 'DashedLines', Decal: string = 'Decal', DeviceOrientationCamera: string = 'DeviceOrientationCamera', DirectionalLight: string = 'DirectionalLight', Disc: string = 'Disc', DisplayGrid: string = 'DisplayGrid', DynamicTerrain: string = 'DynamicTerrain', DynamicTexture: string = 'DynamicTexture', EffectLayer: string = 'EffectLayer', Ellipse: string = 'Ellipse', EnvironmentHelper: string = 'EnvironmentHelper', EquiRectangularCubeTexture: string = 'EquiRectangularCubeTexture', ExtrudePolygon: string = 'ExtrudePolygon', ExtrudeShape: string = 'ExtrudeShape', ExtrudeShapeCustom: string = 'ExtrudeShapeCustom', FadeInOutBehavior: string = 'FadeInOutBehavior', FluentMaterial: string = 'FluentMaterial', FlyCamera: string = 'FlyCamera', FollowCamera: string = 'FollowCamera', FramingBehavior: string = 'FramingBehavior', FreeCamera: string = 'FreeCamera', GUI3DManager: string = 'GUI3DManager', GamepadCamera: string = 'GamepadCamera', GlowLayer: string = 'GlowLayer', Grid: string = 'Grid', Ground: string = 'Ground', GroundFromHeightMap: string = 'GroundFromHeightMap', GroundMesh: string = 'GroundMesh', HDRCubeTexture: string = 'HDRCubeTexture', HemisphericLight: string = 'HemisphericLight', HighlightLayer: string = 'HighlightLayer', HolographicButton: string = 'HolographicButton', HtmlElementTexture: string = 'HtmlElementTexture', IcoSphere: string = 'IcoSphere', Image: string = 'Image', ImageBasedSlider: string = 'ImageBasedSlider', ImageScrollBar: string = 'ImageScrollBar', InputPassword: string = 'InputPassword', InputText: string = 'InputText', InstancedLinesMesh: string = 'InstancedLinesMesh', InstancedMesh: string = 'InstancedMesh', Lathe: string = 'Lathe', Light: string = 'Light', Line: string = 'Line', LineSystem: string = 'LineSystem', Lines: string = 'Lines', LinesMesh: string = 'LinesMesh', Material: string = 'Material', Mesh: string = 'Mesh', MeshButton3D: string = 'MeshButton3D', MirrorTexture: string = 'MirrorTexture', Model: string = 'Model', MultiLine: string = 'MultiLine', MultiMaterial: string = 'MultiMaterial', MultiPointerScaleBehavior: string = 'MultiPointerScaleBehavior', MultiRenderTarget: string = 'MultiRenderTarget', MultiviewRenderTarget: string = 'MultiviewRenderTarget', Node: string = 'Node', NodeMaterial: string = 'NodeMaterial', NoiseProceduralTexture: string = 'NoiseProceduralTexture', PBRBaseMaterial: string = 'PBRBaseMaterial', PBRBaseSimpleMaterial: string = 'PBRBaseSimpleMaterial', PBRMaterial: string = 'PBRMaterial', PBRMetallicRoughnessMaterial: string = 'PBRMetallicRoughnessMaterial', PBRSpecularGlossinessMaterial: string = 'PBRSpecularGlossinessMaterial', PhysicsImpostor: string = 'PhysicsImpostor', Plane: string = 'Plane', PlanePanel: string = 'PlanePanel', PointLight: string = 'PointLight', PointerDragBehavior: string = 'PointerDragBehavior', Polygon: string = 'Polygon', Polyhedron: string = 'Polyhedron', ProceduralTexture: string = 'ProceduralTexture', PushMaterial: string = 'PushMaterial', RadioButton: string = 'RadioButton', RawCubeTexture: string = 'RawCubeTexture', RawTexture: string = 'RawTexture', RawTexture2DArray: string = 'RawTexture2DArray', RawTexture3D: string = 'RawTexture3D', Rectangle: string = 'Rectangle', RefractionTexture: string = 'RefractionTexture', RenderTargetTexture: string = 'RenderTargetTexture', Ribbon: string = 'Ribbon', ScatterPanel: string = 'ScatterPanel', ScrollBar: string = 'ScrollBar', ScrollViewer: string = 'ScrollViewer', SelectionPanel: string = 'SelectionPanel', ShaderMaterial: string = 'ShaderMaterial', ShadowGenerator: string = 'ShadowGenerator', ShadowLight: string = 'ShadowLight', SixDofDragBehavior: string = 'SixDofDragBehavior', Slider: string = 'Slider', Sphere: string = 'Sphere', SpherePanel: string = 'SpherePanel', SpotLight: string = 'SpotLight', StackPanel: string = 'StackPanel', StackPanel3D: string = 'StackPanel3D', StandardMaterial: string = 'StandardMaterial', StereoscopicArcRotateCamera: string = 'StereoscopicArcRotateCamera', StereoscopicFreeCamera: string = 'StereoscopicFreeCamera', StereoscopicGamepadCamera: string = 'StereoscopicGamepadCamera', StereoscopicUniversalCamera: string = 'StereoscopicUniversalCamera', TargetCamera: string = 'TargetCamera', TextBlock: string = 'TextBlock', Texture: string = 'Texture', TiledBox: string = 'TiledBox', TiledGround: string = 'TiledGround', TiledPlane: string = 'TiledPlane', Torus: string = 'Torus', TorusKnot: string = 'TorusKnot', TouchCamera: string = 'TouchCamera', TrailMesh: string = 'TrailMesh', TransformNode: string = 'TransformNode', Tube: string = 'Tube', UniversalCamera: string = 'UniversalCamera', VRDeviceOrientationArcRotateCamera: string = 'VRDeviceOrientationArcRotateCamera', VRDeviceOrientationFreeCamera: string = 'VRDeviceOrientationFreeCamera', VRDeviceOrientationGamepadCamera: string = 'VRDeviceOrientationGamepadCamera', VRExperienceHelper: string = 'VRExperienceHelper', VideoTexture: string = 'VideoTexture', VirtualJoysticksCamera: string = 'VirtualJoysticksCamera', VirtualKeyboard: string = 'VirtualKeyboard', VolumeBasedPanel: string = 'VolumeBasedPanel', WebVRFreeCamera: string = 'WebVRFreeCamera', WebXRCamera: string = 'WebXRCamera', _ScrollViewerWindow: string = '_ScrollViewerWindow'; const classesMap: object = { dynamicTerrain: ExtensionsDynamicTerrain, DynamicTerrain: ExtensionsDynamicTerrain, abstractScene: BabylonjsCoreAbstractScene, AbstractScene: BabylonjsCoreAbstractScene, - node: BabylonjsCoreNode, Node: BabylonjsCoreNode, scene: BabylonjsCoreScene, Scene: BabylonjsCoreScene, camera: BabylonjsCoreCamera, Camera: BabylonjsCoreCamera, environmentHelper: BabylonjsCoreEnvironmentHelper, EnvironmentHelper: BabylonjsCoreEnvironmentHelper, effectLayer: BabylonjsCoreEffectLayer, EffectLayer: BabylonjsCoreEffectLayer, light: BabylonjsCoreLight, Light: BabylonjsCoreLight, material: BabylonjsCoreMaterial, Material: BabylonjsCoreMaterial, + abstractMesh: BabylonjsCoreAbstractMesh, AbstractMesh: BabylonjsCoreAbstractMesh, mesh: BabylonjsCoreMesh, Mesh: BabylonjsCoreMesh, meshBuilder: BabylonjsCoreMeshBuilder, MeshBuilder: BabylonjsCoreMeshBuilder, + transformNode: BabylonjsCoreTransformNode, TransformNode: BabylonjsCoreTransformNode, physicsImpostor: BabylonjsCorePhysicsImpostor, PhysicsImpostor: BabylonjsCorePhysicsImpostor, advancedDynamicTexture: BabylonjsGuiAdvancedDynamicTexture, AdvancedDynamicTexture: BabylonjsGuiAdvancedDynamicTexture, gui3DManager: BabylonjsGuiGUI3DManager, GUI3DManager: BabylonjsGuiGUI3DManager, @@ -12482,8 +12822,12 @@ const classesMap: object = { control: BabylonjsGuiControl, Control: BabylonjsGuiControl, textBlock: BabylonjsGuiTextBlock, TextBlock: BabylonjsGuiTextBlock, control3D: BabylonjsGuiControl3D, Control3D: BabylonjsGuiControl3D, - transformNode: BabylonjsCoreTransformNode, TransformNode: BabylonjsCoreTransformNode, - abstractMesh: BabylonjsCoreAbstractMesh, AbstractMesh: BabylonjsCoreAbstractMesh, + node: BabylonjsCoreNode, Node: BabylonjsCoreNode, + instancedMesh: BabylonjsCoreInstancedMesh, InstancedMesh: BabylonjsCoreInstancedMesh, + instancedLinesMesh: BabylonjsCoreInstancedLinesMesh, InstancedLinesMesh: BabylonjsCoreInstancedLinesMesh, + linesMesh: BabylonjsCoreLinesMesh, LinesMesh: BabylonjsCoreLinesMesh, + groundMesh: BabylonjsCoreGroundMesh, GroundMesh: BabylonjsCoreGroundMesh, + trailMesh: BabylonjsCoreTrailMesh, TrailMesh: BabylonjsCoreTrailMesh, renderTargetTexture: BabylonjsCoreRenderTargetTexture, RenderTargetTexture: BabylonjsCoreRenderTargetTexture, targetCamera: BabylonjsCoreTargetCamera, TargetCamera: BabylonjsCoreTargetCamera, freeCamera: BabylonjsCoreFreeCamera, FreeCamera: BabylonjsCoreFreeCamera, @@ -12586,15 +12930,16 @@ const classesMap: object = { export const intrinsicClassMap: object = { dynamicTerrain: 'DynamicTerrain', abstractScene: 'AbstractScene', - node: 'Node', scene: 'Scene', camera: 'Camera', environmentHelper: 'EnvironmentHelper', effectLayer: 'EffectLayer', light: 'Light', material: 'Material', + abstractMesh: 'AbstractMesh', mesh: 'Mesh', meshBuilder: 'MeshBuilder', + transformNode: 'TransformNode', physicsImpostor: 'PhysicsImpostor', advancedDynamicTexture: 'AdvancedDynamicTexture', gui3DManager: 'GUI3DManager', @@ -12613,8 +12958,12 @@ export const intrinsicClassMap: object = { control: 'Control', textBlock: 'TextBlock', control3D: 'Control3D', - transformNode: 'TransformNode', - abstractMesh: 'AbstractMesh', + node: 'Node', + instancedMesh: 'InstancedMesh', + instancedLinesMesh: 'InstancedLinesMesh', + linesMesh: 'LinesMesh', + groundMesh: 'GroundMesh', + trailMesh: 'TrailMesh', renderTargetTexture: 'RenderTargetTexture', targetCamera: 'TargetCamera', freeCamera: 'FreeCamera', diff --git a/src/generatedProps.ts b/src/generatedProps.ts index 42494b1c..926fcb49 100644 --- a/src/generatedProps.ts +++ b/src/generatedProps.ts @@ -3,7 +3,6 @@ import { CustomProps } from "./CreatedInstance"; import { ModelProps } from "./model"; import { DynamicTerrain as ExtensionsDynamicTerrain } from "./extensions/DynamicTerrain"; import { AbstractScene as BabylonjsCoreAbstractScene } from "@babylonjs/core/abstractScene"; -import { Node as BabylonjsCoreNode } from "@babylonjs/core/node"; import { Scene as BabylonjsCoreScene } from "@babylonjs/core/scene"; import { Camera as BabylonjsCoreCamera } from "@babylonjs/core/Cameras/camera"; import { DebugLayerTab as BabylonjsCoreDebugLayerTab } from "@babylonjs/core/Debug/debugLayer"; @@ -16,8 +15,10 @@ import { SceneLoaderAnimationGroupLoadingMode as BabylonjsCoreSceneLoaderAnimati import { Material as BabylonjsCoreMaterial } from "@babylonjs/core/Materials/material"; import { Space as BabylonjsCoreSpace } from "@babylonjs/core/Maths/math.axis"; import { Orientation as BabylonjsCoreOrientation } from "@babylonjs/core/Maths/math.path"; +import { AbstractMesh as BabylonjsCoreAbstractMesh } from "@babylonjs/core/Meshes/abstractMesh"; import { Mesh as BabylonjsCoreMesh } from "@babylonjs/core/Meshes/mesh"; import { MeshBuilder as BabylonjsCoreMeshBuilder } from "@babylonjs/core/Meshes/meshBuilder"; +import { TransformNode as BabylonjsCoreTransformNode } from "@babylonjs/core/Meshes/transformNode"; import { AssetTaskState as BabylonjsCoreAssetTaskState } from "@babylonjs/core/Misc/assetsManager"; import { InspectableType as BabylonjsCoreInspectableType, IInspectable as BabylonjsCoreIInspectable } from "@babylonjs/core/Misc/iInspectable"; import { JoystickAxis as BabylonjsCoreJoystickAxis } from "@babylonjs/core/Misc/virtualJoystick"; @@ -55,22 +56,24 @@ import { NodeMaterialBlockConnectionPointTypes as BabylonjsCoreNodeMaterialBlock import { NodeMaterialBlockTargets as BabylonjsCoreNodeMaterialBlockTargets } from "@babylonjs/core/Materials/Node/Enums/nodeMaterialBlockTargets"; import { NodeMaterialSystemValues as BabylonjsCoreNodeMaterialSystemValues } from "@babylonjs/core/Materials/Node/Enums/nodeMaterialSystemValues"; import { AnimatedInputBlockTypes as BabylonjsCoreAnimatedInputBlockTypes } from "@babylonjs/core/Materials/Node/Blocks/Input/animatedInputBlockTypes"; +import { Node as BabylonjsCoreNode } from "@babylonjs/core/node"; import { AnimationPropertiesOverride as BabylonjsCoreAnimationPropertiesOverride } from "@babylonjs/core/Animations/animationPropertiesOverride"; import { Animation as BabylonjsCoreAnimation } from "@babylonjs/core/Animations/animation"; import { Observable as BabylonjsCoreObservable } from "@babylonjs/core/Misc/observable"; import { Behavior as BabylonjsCoreBehavior } from "@babylonjs/core/Behaviors/behavior"; -import { TransformNode as BabylonjsCoreTransformNode } from "@babylonjs/core/Meshes/transformNode"; import { Vector3 as BabylonjsCoreVector3, Quaternion as BabylonjsCoreQuaternion, Matrix as BabylonjsCoreMatrix, Vector2 as BabylonjsCoreVector2, Vector4 as BabylonjsCoreVector4 } from "@babylonjs/core/Maths/math.vector"; import { DeepImmutableObject as BabylonjsCoreDeepImmutableObject, IndicesArray as BabylonjsCoreIndicesArray, FloatArray as BabylonjsCoreFloatArray } from "@babylonjs/core/types"; -import { AbstractMesh as BabylonjsCoreAbstractMesh } from "@babylonjs/core/Meshes/abstractMesh"; import { AbstractActionManager as BabylonjsCoreAbstractActionManager } from "@babylonjs/core/Actions/abstractActionManager"; import { Color4 as BabylonjsCoreColor4, Color3 as BabylonjsCoreColor3 } from "@babylonjs/core/Maths/math.color"; import { Skeleton as BabylonjsCoreSkeleton } from "@babylonjs/core/Bones/skeleton"; import { SubMesh as BabylonjsCoreSubMesh } from "@babylonjs/core/Meshes/subMesh"; import { BoundingInfo as BabylonjsCoreBoundingInfo } from "@babylonjs/core/Culling/boundingInfo"; import { InstancedMesh as BabylonjsCoreInstancedMesh } from "@babylonjs/core/Meshes/instancedMesh"; +import { InstancedLinesMesh as BabylonjsCoreInstancedLinesMesh, LinesMesh as BabylonjsCoreLinesMesh } from "@babylonjs/core/Meshes/linesMesh"; import { MorphTargetManager as BabylonjsCoreMorphTargetManager } from "@babylonjs/core/Morph/morphTargetManager"; import { VertexBuffer as BabylonjsCoreVertexBuffer } from "@babylonjs/core/Meshes/buffer"; +import { GroundMesh as BabylonjsCoreGroundMesh } from "@babylonjs/core/Meshes/groundMesh"; +import { TrailMesh as BabylonjsCoreTrailMesh } from "@babylonjs/core/Meshes/trailMesh"; import { RenderTargetTexture as BabylonjsCoreRenderTargetTexture } from "@babylonjs/core/Materials/Textures/renderTargetTexture"; import { CameraInputsManager as BabylonjsCoreCameraInputsManager } from "@babylonjs/core/Cameras/cameraInputsManager"; import { Viewport as BabylonjsCoreViewport } from "@babylonjs/core/Maths/math.viewport"; @@ -104,9 +107,7 @@ import { FlyCamera as BabylonjsCoreFlyCamera } from "@babylonjs/core/Cameras/fly import { FlyCameraInputsManager as BabylonjsCoreFlyCameraInputsManager } from "@babylonjs/core/Cameras/flyCameraInputsManager"; import { FollowCamera as BabylonjsCoreFollowCamera, ArcFollowCamera as BabylonjsCoreArcFollowCamera } from "@babylonjs/core/Cameras/followCamera"; import { FollowCameraInputsManager as BabylonjsCoreFollowCameraInputsManager } from "@babylonjs/core/Cameras/followCameraInputsManager"; -import { LinesMesh as BabylonjsCoreLinesMesh } from "@babylonjs/core/Meshes/linesMesh"; import { Plane as BabylonjsCorePlane } from "@babylonjs/core/Maths/math.plane"; -import { GroundMesh as BabylonjsCoreGroundMesh } from "@babylonjs/core/Meshes/groundMesh"; import { SmartArray as BabylonjsCoreSmartArray, ISmartArrayLike as BabylonjsCoreISmartArrayLike } from "@babylonjs/core/Misc/smartArray"; import { Effect as BabylonjsCoreEffect } from "@babylonjs/core/Materials/effect"; import { ShaderMaterial as BabylonjsCoreShaderMaterial, IShaderMaterialOptions as BabylonjsCoreIShaderMaterialOptions } from "@babylonjs/core/Materials/shaderMaterial"; @@ -199,6 +200,7 @@ import { PhysicsJoint as BabylonjsCorePhysicsJoint } from "@babylonjs/core/Physi import { PickingInfo as BabylonjsCorePickingInfo } from "@babylonjs/core/Collisions/pickingInfo"; import { WebXRDefaultExperience as BabylonjsCoreWebXRDefaultExperience } from "@babylonjs/core/XR/webXRDefaultExperience"; import { SolidParticleSystem as BabylonjsCoreSolidParticleSystem } from "@babylonjs/core/Particles/solidParticleSystem"; +import { IPhysicsEnginePlugin as BabylonjsCoreIPhysicsEnginePlugin } from "@babylonjs/core/Physics/IPhysicsEngine"; import { Collider as BabylonjsCoreCollider } from "@babylonjs/core/Collisions/collider"; import { Ray as BabylonjsCoreRay } from "@babylonjs/core/Culling/ray"; import { IOfflineProvider as BabylonjsCoreIOfflineProvider } from "@babylonjs/core/Offline/IOfflineProvider"; @@ -209,7 +211,6 @@ import { PointerEventTypes as BabylonjsCorePointerEventTypes, PointerInfo as Bab import { PostProcessManager as BabylonjsCorePostProcessManager } from "@babylonjs/core/PostProcesses/postProcessManager"; import { AnimationGroup as BabylonjsCoreAnimationGroup } from "@babylonjs/core/Animations/animationGroup"; import { IParticleSystem as BabylonjsCoreIParticleSystem } from "@babylonjs/core/Particles/IParticleSystem"; -import { IPhysicsEnginePlugin as BabylonjsCoreIPhysicsEnginePlugin } from "@babylonjs/core/Physics/IPhysicsEngine"; export type BabylonNode = { children?: ReactNode; @@ -224,7 +225,12 @@ declare global { node: FiberNodeProps & FiberNodePropsCtor & BabylonNode; transformNode: FiberTransformNodeProps & FiberTransformNodePropsCtor & BabylonNode; abstractMesh: FiberAbstractMeshProps & FiberAbstractMeshPropsCtor & BabylonNode; + instancedMesh: FiberInstancedMeshProps & FiberInstancedMeshPropsCtor & BabylonNode; + instancedLinesMesh: FiberInstancedLinesMeshProps & FiberInstancedLinesMeshPropsCtor & BabylonNode; mesh: FiberMeshProps & FiberMeshPropsCtor & BabylonNode; + linesMesh: FiberLinesMeshProps & FiberLinesMeshPropsCtor & BabylonNode; + groundMesh: FiberGroundMeshProps & FiberGroundMeshPropsCtor & BabylonNode; + trailMesh: FiberTrailMeshProps & FiberTrailMeshPropsCtor & BabylonNode; camera: FiberCameraProps & FiberCameraPropsCtor & BabylonNode; targetCamera: FiberTargetCameraProps & FiberTargetCameraPropsCtor & BabylonNode; freeCamera: FiberFreeCameraProps & FiberFreeCameraPropsCtor & BabylonNode; @@ -464,6 +470,7 @@ export type FiberAbstractMeshProps = { 'facetDepthSortFrom-y'?: number; 'facetDepthSortFrom-z'?: number; hasVertexAlpha?: boolean; + instancedBuffers?: { [key: string]: any; }; isBlocker?: boolean; isPickable?: boolean; isVisible?: boolean; @@ -504,6 +511,22 @@ export type FiberAbstractMeshProps = { export type FiberAbstractMeshPropsCtor = { name: string; }; +export type FiberInstancedMeshProps = { + renderingGroupId?: number; + setIndices?: any; + setVerticesData?: any; +} & FiberAbstractMeshProps; +export type FiberInstancedMeshPropsCtor = { + name: string; + source: BabylonjsCoreMesh; +}; +export type FiberInstancedLinesMeshProps = { + intersectionThreshold?: number; +} & FiberInstancedMeshProps; +export type FiberInstancedLinesMeshPropsCtor = { + name: string; + source: BabylonjsCoreLinesMesh; +}; export type FiberMeshProps = { addInstance?: any; addLODLevel?: any; @@ -531,6 +554,35 @@ export type FiberMeshPropsCtor = { doNotCloneChildren?: boolean; clonePhysicsImpostor?: boolean; }; +export type FiberLinesMeshProps = { + alpha?: number; + color?: BabylonjsCoreColor3; + color4?: any; + intersectionThreshold?: number; + material?: BabylonjsCoreMaterial; +} & FiberMeshProps; +export type FiberLinesMeshPropsCtor = { + name: string; + parent?: BabylonjsCoreNode; + source?: BabylonjsCoreLinesMesh; + doNotCloneChildren?: boolean; + useVertexColor?: boolean; + useVertexAlpha?: boolean; +}; +export type FiberGroundMeshProps = { + generateOctree?: boolean; +} & FiberMeshProps; +export type FiberGroundMeshPropsCtor = { + name: string; +}; +export type FiberTrailMeshProps = {} & FiberMeshProps; +export type FiberTrailMeshPropsCtor = { + name: string; + generator: BabylonjsCoreTransformNode; + diameter?: number; + length?: number; + autoStart?: boolean; +}; export type FiberCameraProps = { cameraRigMode?: number; customRenderTargets?: BabylonjsCoreRenderTargetTexture[]; @@ -2979,7 +3031,7 @@ export type FiberSceneProps = { onAfterCameraRenderObservable?: any; onAfterDrawPhaseObservable?: any; onAfterParticlesRenderingObservable?: any; - onAfterPhysicsObservable?: BabylonjsCoreObservable; + onAfterPhysicsObservable?: any; onAfterRenderCameraObservable?: any; onAfterRenderingGroupObservable?: any; onAfterRenderObservable?: any; @@ -2991,7 +3043,7 @@ export type FiberSceneProps = { onBeforeCameraRenderObservable?: any; onBeforeDrawPhaseObservable?: any; onBeforeParticlesRenderingObservable?: any; - onBeforePhysicsObservable?: BabylonjsCoreObservable; + onBeforePhysicsObservable?: any; onBeforeRenderingGroupObservable?: any; onBeforeRenderObservable?: any; onBeforeRenderTargetsRenderObservable?: any; diff --git a/stories/babylonjs/Basic/instances.stories.js b/stories/babylonjs/Basic/instances.stories.js new file mode 100644 index 00000000..05e176a8 --- /dev/null +++ b/stories/babylonjs/Basic/instances.stories.js @@ -0,0 +1,90 @@ +import React, { useState, useCallback } from 'react' +import { Engine, Scene } from '../../../dist/react-babylonjs' +import { Vector3, Color3, Color4 } from '@babylonjs/core' +import { defineGrid, extendHex } from 'honeycomb-grid' +import '../../style.css' + +export default { title: 'Babylon Basic' }; + +const GRID_WIDTH = 60; +const GRID_HEIGHT = 40; +const HOVER_COLOR = new Color4(0.8, 0.8, 0.8, 1); + +export const Instances = () => { + const [_, setState] = useState(false); + const createUpdate = () => { + setState((state) => !state); + }; + + // const hexRef = useRef>(null); + const [hexMesh, setHexMesh] = useState(null); + const hexRef = useCallback((node) => { + if (node) { + const mesh = node.hostInstance; + mesh.registerInstancedBuffer("color", 4); + setHexMesh(mesh); + } + }, []); + + const Hex = extendHex({ + size: 1, // default: 1 + orientation: 'flat', // default: 'pointy' + color: new Color4(0, 0.68, 1), + hovered: false + }) + + // create a Grid factory that uses the Hex factory: + const Grid = defineGrid(Hex) + + // create a rectangle grid with each tile assigned a random color: + const grid = Grid.rectangle({ width: GRID_WIDTH, height: GRID_HEIGHT, onCreate: (hex) => { + hex.color = new Color4(Math.random(), Math.random(), Math.random(), 1); + hex.isHovered = Math.random() < 0.1; + } }) + + return ( +
+ + + + + + + {hexMesh && + Array.from(grid.entries()).map(entry => { + const [i, tile] = entry; + const {x, y} = tile.toPoint(); + console.log(`${i}->{${x},${y}} (${tile.width()})`) + return ( + + ) + }) + } + + +
+ ); + } diff --git a/stories/babylonjs/Integrations/react-three-gui.stories.js b/stories/babylonjs/Integrations/react-three-gui.stories.js index 6207a33b..e4b54a43 100644 --- a/stories/babylonjs/Integrations/react-three-gui.stories.js +++ b/stories/babylonjs/Integrations/react-three-gui.stories.js @@ -2,7 +2,7 @@ import * as React from 'react'; import { Engine, Scene, useCustomPropsHandler, CustomPropsHandler, PropChangeType } from 'react-babylonjs'; import { animated as a } from 'react-babylon-spring'; import { Vector3, Color3, Texture, Mesh } from '@babylonjs/core'; -import { Controls, useControl } from 'react-three-gui'; +import { Controls, useControl, ControlsContext } from 'react-three-gui'; import '../../style.css' @@ -125,18 +125,52 @@ const Box = () => { } export const ReactThreeGui = () => { + const [controls, setControls] = React.useState([]); + // Persist values between reloads + const values = React.useRef(new Map()); + // GUI control state setters + const gui = React.useRef(new Map()); + // useControl state setters + const state = React.useRef(new Map()); + + const context = { + values, + gui, + state, + controls, + addControl: (control) => { + control.id = String(Math.random()); + setControls(ctrls => { + // control.id = control.id ?? String(ctrls.length); + return [...ctrls, control]; + }); + return control; + }, + removeControl: (ctrl) => { + setControls(ctrls => ctrls.filter(c => c.id !== ctrl.id)); + }, + }; + return (
- - - - - - - - - + + + {value => ( + + + + + + + + + + + )} + + +
); }; diff --git a/tools/generate-code.ts b/tools/generate-code.ts index e414d00f..ee9e9e22 100644 --- a/tools/generate-code.ts +++ b/tools/generate-code.ts @@ -16,6 +16,7 @@ import { ParameterDeclaration, WriterFunction, OptionalKind, + PropertySignature, PropertySignatureStructure, Writers, ImportDeclarationStructure, @@ -128,7 +129,8 @@ const PROPS_EXPORTS: string[] = []; // used to put all props in single import. let classesOfInterest: Map = new Map(); // always needed: -classesOfInterest.set("Node", undefined) +classesOfInterest.set("TransformNode", undefined) +classesOfInterest.set("AbstractMesh", undefined); classesOfInterest.set("Mesh", undefined); classesOfInterest.set("AbstractScene", undefined); classesOfInterest.set("Scene", undefined); @@ -367,6 +369,9 @@ const addProject = (packageNames: string[], files: string[], sourceFiles: Source // adding Scene monkey patch only for now (babylonjs/core/Physics/physicsEngineComponent), but could find way to do all. monkeyPatchInterfaces.set(interfaceDeclaration.getName(), [interfaceDeclaration]) } + if (interfaceDeclaration.getName() === 'AbstractMesh' && interfaceDeclaration.getProperties().find(prop => prop.getName() === 'instancedBuffers')) { + monkeyPatchInterfaces.set(interfaceDeclaration.getName(), [interfaceDeclaration]) + } }) ns.getClasses().forEach((classDeclaration: ClassDeclaration) => { addSourceClass(classDeclaration, sourceFiles); @@ -405,6 +410,8 @@ const addMetadata = (classDeclaration: ClassDeclaration, originalClassDeclaratio createInfoProperty.setInitializer(JSON.stringify(propertyInit, null, 2)) } +const createdFactoryClasses: string[] = []; + /** * Create Element from static factory function * @param factoryClassName @@ -428,7 +435,7 @@ const createFactoryClass = (factoryClassName: string, hostClassName: string, pre ? methodName.substr('Create'.length) : methodName; // ie: ExtrudePolygon, ExtrudeShape & ExtrudeShapeCustom factoryType = prefix + factoryType; - createdMeshClasses.push(factoryType); + createdFactoryClasses.push(factoryType); addHostElement(factoryType, hostTuple.classDeclaration); let newClassDeclaration: ClassDeclaration = addClassDeclarationFromFactoryMethod(generatedCodeSourceFile, factoryType, classesOfInterest.get(hostClassName)!.classDeclaration, method); @@ -437,22 +444,9 @@ const createFactoryClass = (factoryClassName: string, hostClassName: string, pre addMetadata(newClassDeclaration, undefined /* no original class */, metadata) } }); - console.log(`${factoryClassName} Factory - ${createdMeshClasses.sort((a, b) => a.localeCompare(b)).map(c => classToIntrinsic(c).replace(/['\u2019]/g, '')).join(', ')}`); + console.log(`${factoryClassName} Factory - ${createdFactoryClasses.sort((a, b) => a.localeCompare(b)).map(c => classToIntrinsic(c).replace(/['\u2019]/g, '')).join(', ')}`); }; -const createdMeshClasses: string[] = []; -const createMeshClasses = (generatedCodeSourceFile: SourceFile, generatedPropsSourceFile: SourceFile) => { - createFactoryClass( - 'MeshBuilder', 'Mesh', '', { - acceptsMaterials: true, - isNode: true, - isMesh: true - }, - generatedCodeSourceFile, - generatedPropsSourceFile - ); -} - const addClassDeclarationFromFactoryMethod = (generatedCodeSourceFile: SourceFile, className: string, classDeclaration: ClassDeclaration, factoryMethod: MethodDeclaration, extra?: (cd: ClassDeclaration) => void) => { const newClassDeclaration = generatedCodeSourceFile.addClass({ @@ -710,7 +704,7 @@ const getMethodType = (methodDeclaration: MethodDeclaration | MethodSignature, t return `(${paramTypes.join(', ')}) => ${returnType}`; } -const writeMethodAsUpdateFunction = (propsProperties: OptionalKind[], method: MethodDeclaration, type: string): void => { +const writeMethodAsUpdateFunction = (propsProperties: OptionalKind[], method: MethodDeclaration | MethodSignature, type: string): void => { const methodName = method.getName() // tempting to put the method signature here instead of 'any', but we need to be able to call it like: // and TODO: figure out how with ie: ((target?: BabylonjsCoreVector3) => void;!!) @@ -908,7 +902,7 @@ const isQuestionToken = (node: Node): boolean => { * The odd parameters here 'classNameToGenerate' and 'classNameBabylon' are because we are also inventing classes not based on real BabylonJS objects (ie: Box, Sphere are actually Mesh) * It probably looks like we should just pass along the ClassDeclaration... */ -const addPropsAndHandlerClasses = (generatedCodeSourceFile: SourceFile, generatedPropsSourceFile: SourceFile, classNameToGenerate: string, babylonClassDeclaration: ModuleDeclaration, propertiesToAdd: (PropertyDeclaration | SetAccessorDeclaration)[], setMethods: MethodDeclaration[], baseClass: ClassDeclaration | undefined): void => { +const addPropsAndHandlerClasses = (generatedCodeSourceFile: SourceFile, generatedPropsSourceFile: SourceFile, classNameToGenerate: string, babylonClassDeclaration: ModuleDeclaration, propertiesToAdd: (PropertyDeclaration | PropertySignature | SetAccessorDeclaration)[], setMethods: (MethodDeclaration | MethodSignature)[], baseClass: ClassDeclaration | undefined): void => { // console.log('addpropshandlers1:', classNameToGenerate, babylonClassDeclaration.className, babylonClassDeclaration.importAlias); const typeProperties: OptionalKind[] = [] @@ -938,7 +932,7 @@ const addPropsAndHandlerClasses = (generatedCodeSourceFile: SourceFile, generate // These properties break out to specific method handlers type PropertyKind = 'BabylonjsCoreBaseTexture' | 'BabylonjsCoreColor3' | 'BabylonjsCoreColor4' | 'BabylonjsCoreVector3' | 'BabylonjsCoreFresnelParameters' | 'BabylonjsCoreQuaternion' | - 'BabylonjsGuiControl' | 'number[]' | 'lambda' | 'observable' | 'method' | 'primitive'; + 'BabylonjsGuiControl' | 'number[]' | 'lambda' | 'observable' | 'method' | 'primitive' | 'object'; type NameAndType = { name: string type: string, @@ -946,7 +940,28 @@ const addPropsAndHandlerClasses = (generatedCodeSourceFile: SourceFile, generate }; const propsToCheck: NameAndType[] = []; - propertiesToAdd.sort((a, b) => a.getName().localeCompare(b.getName())).forEach((property: (PropertyDeclaration | SetAccessorDeclaration)) => { + if (monkeyPatchInterfaces.has(classNameToGenerate)) { + console.log(` > patching ${classNameToGenerate} with interface:`) + monkeyPatchInterfaces.get(classNameToGenerate)!.forEach((monkeyPatchInterface: InterfaceDeclaration) => { + monkeyPatchInterface.getProperties().filter(property => !property.getName().startsWith("_")).forEach(property => { + const type = createTypeFromText(property.getType().getText(), [generatedCodeSourceFile, generatedPropsSourceFile]); + const propertyName: string = property.getName(); + console.log(` >> adding property '${propertyName}' -> ${type}`) + propertiesToAdd.push(property); + }) + monkeyPatchInterface.getMethods().forEach(method => { + const type = getMethodType(method, [generatedCodeSourceFile, generatedPropsSourceFile]); + + if (type === null) { + return; // skip + } + const methodName = method.getName() + setMethods.push(method); + }) + }) + } + + propertiesToAdd.sort((a, b) => a.getName().localeCompare(b.getName())).forEach((property: (PropertyDeclaration | PropertySignature | SetAccessorDeclaration)) => { const type = createTypeFromText(property.getType().getText(), [generatedCodeSourceFile, generatedPropsSourceFile]); const propertyName: string = property.getName(); @@ -1009,6 +1024,13 @@ const addPropsAndHandlerClasses = (generatedCodeSourceFile: SourceFile, generate }) } break; + case '{ [key: string]: any; }': + propsToCheck.push({ + name: propertyName, + type, + propertyKind: 'object' + }); + break; default: if (OBSERVABLE_PATTERN.test(type)) { propsToCheck.push({ @@ -1035,7 +1057,7 @@ const addPropsAndHandlerClasses = (generatedCodeSourceFile: SourceFile, generate } }) - setMethods.sort((a, b) => a.getName().localeCompare(b.getName())).forEach((method: MethodDeclaration) => { + setMethods.sort((a, b) => a.getName().localeCompare(b.getName())).forEach((method: MethodDeclaration | MethodSignature) => { const type = getMethodType(method, [generatedCodeSourceFile, generatedPropsSourceFile]); if (type !== null) { writeMethodAsUpdateFunction(typeProperties, method, type); @@ -1046,7 +1068,7 @@ const addPropsAndHandlerClasses = (generatedCodeSourceFile: SourceFile, generate propertyKind: 'method' }) } - }) + }); if (propsToCheck.filter(p => p.propertyKind !== undefined).length === 0) { propsToCheck.forEach(propToCheck => { @@ -1073,6 +1095,9 @@ const addPropsAndHandlerClasses = (generatedCodeSourceFile: SourceFile, generate case 'BabylonjsCoreQuaternion': writer.writeLine(`checkQuaternionDiff(oldProps.${propToCheck.name}, newProps.${propToCheck.name}, '${propToCheck.name}', changedProps)`); break; + case 'object': + writer.writeLine(`checkObjectDiff(oldProps.${propToCheck.name}, newProps.${propToCheck.name}, '${propToCheck.name}', changedProps)`); + break; case 'primitive': if (propToCheck.name.indexOf('-') !== -1) /* ie: 'rotation-x' */ { writer.writeLine(`checkPrimitiveDiff(oldProps['${propToCheck.name}'], newProps['${propToCheck.name}'], '${propToCheck.name.replace(/-/g, '.')}', changedProps)`); @@ -1112,34 +1137,6 @@ const addPropsAndHandlerClasses = (generatedCodeSourceFile: SourceFile, generate } }) - if (monkeyPatchInterfaces.has(classNameToGenerate)) { - console.log(` > patching ${classNameToGenerate} with interface:`) - monkeyPatchInterfaces.get(classNameToGenerate)!.forEach((monkeyPatchInterface: InterfaceDeclaration) => { - monkeyPatchInterface.getProperties().filter(property => !property.getName().startsWith("_")).forEach(property => { - const type = createTypeFromText(property.getType().getText(), [generatedCodeSourceFile, generatedPropsSourceFile]); - const propertyName: string = property.getName(); - typeProperties.push({ - name: propertyName, - type: type, - hasQuestionToken: true - }) - }) - monkeyPatchInterface.getMethods().forEach(method => { - const type = getMethodType(method, [generatedCodeSourceFile, generatedPropsSourceFile]); - - if (type === null) { - return; // skip - } - const methodName = method.getName() - typeProperties.push({ - name: methodName, - type: 'any', - hasQuestionToken: true - }) - }) - }) - } - // this is temporary, where we give ALL classes these CustomProps. Will be addressed (ideally we leave intersectsWith here 'undefined' and add ONLY valid props) const intersectsWith = baseClass === undefined ? 'CustomProps' : baseClass.getName(); const propsClassName = `${ClassNamesPrefix}${classNameToGenerate}Props`; @@ -1241,10 +1238,14 @@ const addCreateInfoFromConstructor = (sourceClass: ClassDeclaration, targetClass } // this is all kind of garbage now... we cannot dynamically generate like we did before :( + const moduleSpecifier = moduleDeclaration.moduleSpecifier; + const namespace = moduleSpecifier.startsWith('@babylonjs/') + ? moduleSpecifier.substr(0, moduleSpecifier.indexOf('/', '@babylonjs/'.length)) + : moduleSpecifier; let value: CreateInfo = { creationType: CreationType.Constructor, libraryLocation: className!, - namespace: moduleDeclaration.moduleSpecifier, + namespace, parameters: constructorArguments } @@ -1422,6 +1423,7 @@ const generateCode = async () => { "checkLambdaDiff", "checkMethodDiff", "checkNumericArrayDiff", + "checkObjectDiff", "checkObservableDiff", "checkPrimitiveDiff", "checkQuaternionDiff", @@ -1492,7 +1494,8 @@ const generateCode = async () => { }) // This includes Node, which is base class for ie: Camera, Mesh, etc. - createClassesDerivedFrom(generatedCodeSourceFile, generatedPropsSourceFile, classesOfInterest.get("Mesh")!, {}, undefined) + createClassesDerivedFrom(generatedCodeSourceFile, generatedPropsSourceFile, classesOfInterest.get("TransformNode")!, {}, undefined); + createClassesInheritedFrom(generatedCodeSourceFile, generatedPropsSourceFile, classesOfInterest.get("AbstractMesh")!, () => ({isNode: true})); const extra = (newClassDeclaration: ClassDeclaration, originalClassDeclaration: ClassDeclaration) => { // consider having targetable as metadata. @@ -1523,7 +1526,18 @@ const generateCode = async () => { } if (classesOfInterest.get("MeshBuilder") !== undefined) { - createMeshClasses(generatedCodeSourceFile, generatedPropsSourceFile); + createFactoryClass( + "MeshBuilder", + "Mesh", + "", + { + acceptsMaterials: true, + isNode: true, + isMesh: true + }, + generatedCodeSourceFile, + generatedPropsSourceFile + ); } if (classesOfInterest.get("Material")) { @@ -1682,7 +1696,7 @@ const generateCode = async () => { .map(([alias, className]) => `${classToIntrinsic(className)}:'${className}'`) .join(',\n')}, - ${createdMeshClasses.map(meshName => + ${createdFactoryClasses.map(meshName => `${classToIntrinsic(meshName)}:'${meshName}'`) .join(',\n')} }`