@babylonjs/core 8.46.1 → 8.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +1 -1
- package/Engines/constants.js +1 -1
- package/Engines/constants.js.map +1 -1
- package/Lights/areaLight.d.ts +1 -1
- package/Lights/areaLight.js +1 -1
- package/Lights/areaLight.js.map +1 -1
- package/Lights/rectAreaLight.d.ts +20 -0
- package/Lights/rectAreaLight.js +45 -0
- package/Lights/rectAreaLight.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +6 -3
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/material.d.ts +1 -1
- package/Materials/material.js +1 -1
- package/Materials/material.js.map +1 -1
- package/Materials/materialHelper.functions.d.ts +2 -1
- package/Materials/materialHelper.functions.js +6 -2
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/materialPluginManager.js +2 -2
- package/Materials/materialPluginManager.js.map +1 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +1 -5
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
- package/Misc/areaLightsTextureTools.d.ts +52 -0
- package/Misc/areaLightsTextureTools.js +227 -0
- package/Misc/areaLightsTextureTools.js.map +1 -0
- package/Misc/decorators.serialization.js +6 -1
- package/Misc/decorators.serialization.js.map +1 -1
- package/Misc/index.d.ts +3 -0
- package/Misc/index.js +4 -0
- package/Misc/index.js.map +1 -1
- package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +4 -0
- package/Particles/Node/Blocks/particleSourceTextureBlock.js +9 -3
- package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.d.ts +2 -0
- package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +1 -0
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.d.ts +10 -0
- package/Physics/v2/Plugins/havokPlugin.js +13 -0
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsBody.d.ts +10 -0
- package/Physics/v2/physicsBody.js +12 -0
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Physics/v2/physicsEngineComponent.d.ts +5 -0
- package/Physics/v2/physicsEngineComponent.js +13 -0
- package/Physics/v2/physicsEngineComponent.js.map +1 -1
- package/Rendering/utilityLayerRenderer.d.ts +6 -0
- package/Rendering/utilityLayerRenderer.js +14 -5
- package/Rendering/utilityLayerRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/lightFragment.js +13 -0
- package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
- package/Shaders/ShadersInclude/lightFragmentDeclaration.js +3 -0
- package/Shaders/ShadersInclude/lightFragmentDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/lightUboDeclaration.js +3 -0
- package/Shaders/ShadersInclude/lightUboDeclaration.js.map +1 -1
- package/Shaders/ShadersInclude/lightsFragmentFunctions.js +6 -0
- package/Shaders/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/ltcHelperFunctions.js +17 -1
- package/Shaders/ShadersInclude/ltcHelperFunctions.js.map +1 -1
- package/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js +6 -0
- package/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
- package/Shaders/areaLightTextureProcessing.fragment.d.ts +5 -0
- package/Shaders/areaLightTextureProcessing.fragment.js +13 -0
- package/Shaders/areaLightTextureProcessing.fragment.js.map +1 -0
- package/ShadersWGSL/ShadersInclude/lightFragment.js +14 -0
- package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js +3 -0
- package/ShadersWGSL/ShadersInclude/lightUboDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js +6 -0
- package/ShadersWGSL/ShadersInclude/lightsFragmentFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/ltcHelperFunctions.js +19 -1
- package/ShadersWGSL/ShadersInclude/ltcHelperFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js +5 -0
- package/ShadersWGSL/ShadersInclude/pbrDirectLightingSetupFunctions.js.map +1 -1
- package/ShadersWGSL/areaLightTextureProcessing.fragment.d.ts +5 -0
- package/ShadersWGSL/areaLightTextureProcessing.fragment.js +12 -0
- package/ShadersWGSL/areaLightTextureProcessing.fragment.js.map +1 -0
- package/ShadersWGSL/iblVoxelGrid.vertex.js +2 -2
- package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
- package/States/alphaCullingState.js +0 -1
- package/States/alphaCullingState.js.map +1 -1
- package/package.json +1 -1
|
@@ -23,7 +23,12 @@ const CopySource = function (creationFunction, source, instanciate, options = {}
|
|
|
23
23
|
case 6: // Mesh reference
|
|
24
24
|
case 9: // Image processing configuration reference
|
|
25
25
|
case 11: // Camera reference
|
|
26
|
-
|
|
26
|
+
if (typeof sourceProperty.slice === "function") {
|
|
27
|
+
destination[property] = sourceProperty.slice();
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
destination[property] = sourceProperty;
|
|
31
|
+
}
|
|
27
32
|
break;
|
|
28
33
|
case 1: // Texture
|
|
29
34
|
if (options.cloneTexturesOnlyOnce && textureMap[sourceProperty.uniqueId]) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.serialization.js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AAK,CAAC;AAE3C;;GAEG;AACW,uDAAmC,GAAG,CAAC,cAAmB,EAAgC,EAAE;IACtG,MAAM,WAAW,CAAC,8BAA8B,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF;;GAEG;AACW,4CAAwB,GAAG,CAAC,cAAmB,EAAqB,EAAE;IAChF,MAAM,WAAW,CAAC,mBAAmB,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEF;;GAEG;AACW,sCAAkB,GAAG,CAAC,cAAmB,EAAe,EAAE;IACpE,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF;;GAEG;AACW,kCAAc,GAAG,CAAC,cAAmB,EAAE,KAAY,EAAE,OAAe,EAAyB,EAAE;IACzG,MAAM,WAAW,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC,CAAC","sourcesContent":["import type { FresnelParameters } from \"../Materials/fresnelParameters\";\r\nimport type { ImageProcessingConfiguration } from \"../Materials/imageProcessingConfiguration\";\r\nimport { _WarnImport } from \"./devTools\";\r\nimport type { ColorCurves } from \"../Materials/colorCurves\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport type { IAnimatable } from \"../Animations/animatable.interface\";\r\nimport { Tags } from \"./tags\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport { Matrix, Quaternion, Vector2, Vector3 } from \"../Maths/math.vector\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { GetMergedStore } from \"./decorators.functions\";\r\n\r\n/** @internal */\r\nexport interface ICopySourceOptions {\r\n /*\r\n * if a texture is used in more than one channel (e.g diffuse and opacity),\r\n * only clone it once and reuse it on the other channels. Default false\r\n */\r\n cloneTexturesOnlyOnce?: boolean;\r\n}\r\n\r\nconst CopySource = function <T>(creationFunction: () => T, source: T, instanciate: boolean, options: ICopySourceOptions = {}): T {\r\n const destination = creationFunction();\r\n\r\n // Tags\r\n if (Tags && Tags.HasTags(source)) {\r\n Tags.AddTagsTo(destination, Tags.GetTags(source, true));\r\n }\r\n\r\n const classStore = GetMergedStore(destination);\r\n\r\n // Map from source texture uniqueId to destination texture\r\n const textureMap: Record<number, any> = {};\r\n\r\n // Properties\r\n for (const property in classStore) {\r\n const propertyDescriptor = classStore[property];\r\n const sourceProperty = (<any>source)[property];\r\n const propertyType = propertyDescriptor.type;\r\n\r\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\r\n switch (propertyType) {\r\n case 0: // Value\r\n case 6: // Mesh reference\r\n case 9: // Image processing configuration reference\r\n case 11: // Camera reference\r\n (<any>destination)[property] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n if (options.cloneTexturesOnlyOnce && textureMap[sourceProperty.uniqueId]) {\r\n (<any>destination)[property] = textureMap[sourceProperty.uniqueId];\r\n } else {\r\n (<any>destination)[property] = instanciate || sourceProperty.isRenderTarget ? sourceProperty : sourceProperty.clone();\r\n textureMap[sourceProperty.uniqueId] = (<any>destination)[property];\r\n }\r\n break;\r\n case 2: // Color3\r\n case 3: // FresnelParameters\r\n case 4: // Vector2\r\n case 5: // Vector3\r\n case 7: // Color Curves\r\n case 8: // Color 4\r\n case 10: // Quaternion\r\n case 12: // Matrix\r\n (<any>destination)[property] = instanciate ? sourceProperty : sourceProperty.clone();\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return destination;\r\n};\r\n\r\n/**\r\n * Class used to help serialization objects\r\n */\r\nexport class SerializationHelper {\r\n /**\r\n * Gets or sets a boolean to indicate if the UniqueId property should be serialized\r\n */\r\n public static AllowLoadingUniqueId = false;\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _ImageProcessingConfigurationParser = (sourceProperty: any): ImageProcessingConfiguration => {\r\n throw _WarnImport(\"ImageProcessingConfiguration\");\r\n };\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _FresnelParametersParser = (sourceProperty: any): FresnelParameters => {\r\n throw _WarnImport(\"FresnelParameters\");\r\n };\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _ColorCurvesParser = (sourceProperty: any): ColorCurves => {\r\n throw _WarnImport(\"ColorCurves\");\r\n };\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _TextureParser = (sourceProperty: any, scene: Scene, rootUrl: string): Nullable<BaseTexture> => {\r\n throw _WarnImport(\"Texture\");\r\n };\r\n\r\n /**\r\n * Appends the serialized animations from the source animations\r\n * @param source Source containing the animations\r\n * @param destination Target to store the animations\r\n */\r\n public static AppendSerializedAnimations(source: IAnimatable, destination: any): void {\r\n if (source.animations) {\r\n destination.animations = [];\r\n for (let animationIndex = 0; animationIndex < source.animations.length; animationIndex++) {\r\n const animation = source.animations[animationIndex];\r\n\r\n destination.animations.push(animation.serialize());\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Static function used to serialized a specific entity\r\n * @param entity defines the entity to serialize\r\n * @param serializationObject defines the optional target object where serialization data will be stored\r\n * @returns a JSON compatible object representing the serialization of the entity\r\n */\r\n public static Serialize<T>(entity: T, serializationObject?: any): any {\r\n if (!serializationObject) {\r\n serializationObject = {};\r\n }\r\n\r\n // Tags\r\n if (Tags) {\r\n serializationObject.tags = Tags.GetTags(entity);\r\n }\r\n\r\n const serializedProperties = GetMergedStore(entity);\r\n\r\n // Properties\r\n for (const property in serializedProperties) {\r\n const propertyDescriptor = serializedProperties[property];\r\n const targetPropertyName = propertyDescriptor.sourceName || property;\r\n const propertyType = propertyDescriptor.type;\r\n const sourceProperty = (<any>entity)[property];\r\n\r\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\r\n switch (propertyType) {\r\n case 0: // Value\r\n if (Array.isArray(sourceProperty)) {\r\n serializationObject[targetPropertyName] = sourceProperty.slice();\r\n } else {\r\n serializationObject[targetPropertyName] = sourceProperty;\r\n }\r\n break;\r\n case 1: // Texture\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 2: // Color3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 3: // FresnelParameters\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 4: // Vector2\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 5: // Vector3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 6: // Mesh reference\r\n serializationObject[targetPropertyName] = sourceProperty.id;\r\n break;\r\n case 7: // Color Curves\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 8: // Color 4\r\n serializationObject[targetPropertyName] = (<Color4>sourceProperty).asArray();\r\n break;\r\n case 9: // Image Processing\r\n serializationObject[targetPropertyName] = (<ImageProcessingConfiguration>sourceProperty).serialize();\r\n break;\r\n case 10: // Quaternion\r\n serializationObject[targetPropertyName] = (<Quaternion>sourceProperty).asArray();\r\n break;\r\n case 11: // Camera reference\r\n serializationObject[targetPropertyName] = (<Camera>sourceProperty).id;\r\n break;\r\n case 12: // Matrix\r\n serializationObject[targetPropertyName] = (<Matrix>sourceProperty).asArray();\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Given a source json and a destination object in a scene, this function will parse the source and will try to apply its content to the destination object\r\n * @param source the source json data\r\n * @param destination the destination object\r\n * @param scene the scene where the object is\r\n * @param rootUrl root url to use to load assets\r\n */\r\n public static ParseProperties(source: any, destination: any, scene: Nullable<Scene>, rootUrl: Nullable<string>) {\r\n if (!rootUrl) {\r\n rootUrl = \"\";\r\n }\r\n\r\n const classStore = GetMergedStore(destination);\r\n\r\n // Properties\r\n for (const property in classStore) {\r\n const propertyDescriptor = classStore[property];\r\n const sourceProperty = source[propertyDescriptor.sourceName || property];\r\n const propertyType = propertyDescriptor.type;\r\n\r\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\r\n const dest = destination;\r\n switch (propertyType) {\r\n case 0: // Value\r\n dest[property] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n if (scene) {\r\n dest[property] = SerializationHelper._TextureParser(sourceProperty, scene, rootUrl);\r\n }\r\n break;\r\n case 2: // Color3\r\n dest[property] = Color3.FromArray(sourceProperty);\r\n break;\r\n case 3: // FresnelParameters\r\n dest[property] = SerializationHelper._FresnelParametersParser(sourceProperty);\r\n break;\r\n case 4: // Vector2\r\n dest[property] = Vector2.FromArray(sourceProperty);\r\n break;\r\n case 5: // Vector3\r\n dest[property] = Vector3.FromArray(sourceProperty);\r\n break;\r\n case 6: // Mesh reference\r\n if (scene) {\r\n dest[property] = scene.getLastMeshById(sourceProperty);\r\n }\r\n break;\r\n case 7: // Color Curves\r\n dest[property] = SerializationHelper._ColorCurvesParser(sourceProperty);\r\n break;\r\n case 8: // Color 4\r\n dest[property] = Color4.FromArray(sourceProperty);\r\n break;\r\n case 9: // Image Processing\r\n dest[property] = SerializationHelper._ImageProcessingConfigurationParser(sourceProperty);\r\n break;\r\n case 10: // Quaternion\r\n dest[property] = Quaternion.FromArray(sourceProperty);\r\n break;\r\n case 11: // Camera reference\r\n if (scene) {\r\n dest[property] = scene.getCameraById(sourceProperty);\r\n }\r\n break;\r\n case 12: // Matrix\r\n dest[property] = Matrix.FromArray(sourceProperty);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new entity from a serialization data object\r\n * @param creationFunction defines a function used to instanciated the new entity\r\n * @param source defines the source serialization data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url for resources\r\n * @returns a new entity\r\n */\r\n public static Parse<T>(creationFunction: () => T, source: any, scene: Nullable<Scene>, rootUrl: Nullable<string> = null): T {\r\n const destination = creationFunction();\r\n\r\n // Tags\r\n if (Tags) {\r\n Tags.AddTagsTo(destination, source.tags);\r\n }\r\n\r\n SerializationHelper.ParseProperties(source, destination, scene, rootUrl);\r\n\r\n return destination;\r\n }\r\n\r\n /**\r\n * Clones an object\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @param options defines the options to use\r\n * @returns the cloned object\r\n */\r\n public static Clone<T>(creationFunction: () => T, source: T, options: ICopySourceOptions = {}): T {\r\n return CopySource(creationFunction, source, false, options);\r\n }\r\n\r\n /**\r\n * Instanciates a new object based on a source one (some data will be shared between both object)\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @returns the new object\r\n */\r\n public static Instanciate<T>(creationFunction: () => T, source: T): T {\r\n return CopySource(creationFunction, source, true);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"decorators.serialization.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/decorators.serialization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAMzC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAWxD,MAAM,UAAU,GAAG,UAAa,gBAAyB,EAAE,MAAS,EAAE,WAAoB,EAAE,UAA8B,EAAE;IACxH,MAAM,WAAW,GAAG,gBAAgB,EAAE,CAAC;IAEvC,OAAO;IACP,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/B,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM,UAAU,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IAE/C,0DAA0D;IAC1D,MAAM,UAAU,GAAwB,EAAE,CAAC;IA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QACP,IAAI,IAAI,EAAE,CAAC;YACP,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAC7C,CAAC;QAED,mBAAmB,CAAC,eAAe,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAEzE,OAAO,WAAW,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,KAAK,CAAI,gBAAyB,EAAE,MAAS,EAAE,UAA8B,EAAE;QACzF,OAAO,UAAU,CAAC,gBAAgB,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,WAAW,CAAI,gBAAyB,EAAE,MAAS;QAC7D,OAAO,UAAU,CAAC,gBAAgB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;;AA/OD;;GAEG;AACW,wCAAoB,GAAG,KAAK,CAAC;AAE3C;;GAEG;AACW,uDAAmC,GAAG,CAAC,cAAmB,EAAgC,EAAE;IACtG,MAAM,WAAW,CAAC,8BAA8B,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF;;GAEG;AACW,4CAAwB,GAAG,CAAC,cAAmB,EAAqB,EAAE;IAChF,MAAM,WAAW,CAAC,mBAAmB,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEF;;GAEG;AACW,sCAAkB,GAAG,CAAC,cAAmB,EAAe,EAAE;IACpE,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF;;GAEG;AACW,kCAAc,GAAG,CAAC,cAAmB,EAAE,KAAY,EAAE,OAAe,EAAyB,EAAE;IACzG,MAAM,WAAW,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC,CAAC","sourcesContent":["import type { FresnelParameters } from \"../Materials/fresnelParameters\";\r\nimport type { ImageProcessingConfiguration } from \"../Materials/imageProcessingConfiguration\";\r\nimport { _WarnImport } from \"./devTools\";\r\nimport type { ColorCurves } from \"../Materials/colorCurves\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport type { IAnimatable } from \"../Animations/animatable.interface\";\r\nimport { Tags } from \"./tags\";\r\nimport { Color3, Color4 } from \"../Maths/math.color\";\r\nimport { Matrix, Quaternion, Vector2, Vector3 } from \"../Maths/math.vector\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { GetMergedStore } from \"./decorators.functions\";\r\n\r\n/** @internal */\r\nexport interface ICopySourceOptions {\r\n /*\r\n * if a texture is used in more than one channel (e.g diffuse and opacity),\r\n * only clone it once and reuse it on the other channels. Default false\r\n */\r\n cloneTexturesOnlyOnce?: boolean;\r\n}\r\n\r\nconst CopySource = function <T>(creationFunction: () => T, source: T, instanciate: boolean, options: ICopySourceOptions = {}): T {\r\n const destination = creationFunction();\r\n\r\n // Tags\r\n if (Tags && Tags.HasTags(source)) {\r\n Tags.AddTagsTo(destination, Tags.GetTags(source, true));\r\n }\r\n\r\n const classStore = GetMergedStore(destination);\r\n\r\n // Map from source texture uniqueId to destination texture\r\n const textureMap: Record<number, any> = {};\r\n\r\n // Properties\r\n for (const property in classStore) {\r\n const propertyDescriptor = classStore[property];\r\n const sourceProperty = (<any>source)[property];\r\n const propertyType = propertyDescriptor.type;\r\n\r\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\r\n switch (propertyType) {\r\n case 0: // Value\r\n case 6: // Mesh reference\r\n case 9: // Image processing configuration reference\r\n case 11: // Camera reference\r\n if (typeof sourceProperty.slice === \"function\") {\r\n (<any>destination)[property] = sourceProperty.slice();\r\n } else {\r\n (<any>destination)[property] = sourceProperty;\r\n }\r\n break;\r\n case 1: // Texture\r\n if (options.cloneTexturesOnlyOnce && textureMap[sourceProperty.uniqueId]) {\r\n (<any>destination)[property] = textureMap[sourceProperty.uniqueId];\r\n } else {\r\n (<any>destination)[property] = instanciate || sourceProperty.isRenderTarget ? sourceProperty : sourceProperty.clone();\r\n textureMap[sourceProperty.uniqueId] = (<any>destination)[property];\r\n }\r\n break;\r\n case 2: // Color3\r\n case 3: // FresnelParameters\r\n case 4: // Vector2\r\n case 5: // Vector3\r\n case 7: // Color Curves\r\n case 8: // Color 4\r\n case 10: // Quaternion\r\n case 12: // Matrix\r\n (<any>destination)[property] = instanciate ? sourceProperty : sourceProperty.clone();\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return destination;\r\n};\r\n\r\n/**\r\n * Class used to help serialization objects\r\n */\r\nexport class SerializationHelper {\r\n /**\r\n * Gets or sets a boolean to indicate if the UniqueId property should be serialized\r\n */\r\n public static AllowLoadingUniqueId = false;\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _ImageProcessingConfigurationParser = (sourceProperty: any): ImageProcessingConfiguration => {\r\n throw _WarnImport(\"ImageProcessingConfiguration\");\r\n };\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _FresnelParametersParser = (sourceProperty: any): FresnelParameters => {\r\n throw _WarnImport(\"FresnelParameters\");\r\n };\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _ColorCurvesParser = (sourceProperty: any): ColorCurves => {\r\n throw _WarnImport(\"ColorCurves\");\r\n };\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _TextureParser = (sourceProperty: any, scene: Scene, rootUrl: string): Nullable<BaseTexture> => {\r\n throw _WarnImport(\"Texture\");\r\n };\r\n\r\n /**\r\n * Appends the serialized animations from the source animations\r\n * @param source Source containing the animations\r\n * @param destination Target to store the animations\r\n */\r\n public static AppendSerializedAnimations(source: IAnimatable, destination: any): void {\r\n if (source.animations) {\r\n destination.animations = [];\r\n for (let animationIndex = 0; animationIndex < source.animations.length; animationIndex++) {\r\n const animation = source.animations[animationIndex];\r\n\r\n destination.animations.push(animation.serialize());\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Static function used to serialized a specific entity\r\n * @param entity defines the entity to serialize\r\n * @param serializationObject defines the optional target object where serialization data will be stored\r\n * @returns a JSON compatible object representing the serialization of the entity\r\n */\r\n public static Serialize<T>(entity: T, serializationObject?: any): any {\r\n if (!serializationObject) {\r\n serializationObject = {};\r\n }\r\n\r\n // Tags\r\n if (Tags) {\r\n serializationObject.tags = Tags.GetTags(entity);\r\n }\r\n\r\n const serializedProperties = GetMergedStore(entity);\r\n\r\n // Properties\r\n for (const property in serializedProperties) {\r\n const propertyDescriptor = serializedProperties[property];\r\n const targetPropertyName = propertyDescriptor.sourceName || property;\r\n const propertyType = propertyDescriptor.type;\r\n const sourceProperty = (<any>entity)[property];\r\n\r\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\r\n switch (propertyType) {\r\n case 0: // Value\r\n if (Array.isArray(sourceProperty)) {\r\n serializationObject[targetPropertyName] = sourceProperty.slice();\r\n } else {\r\n serializationObject[targetPropertyName] = sourceProperty;\r\n }\r\n break;\r\n case 1: // Texture\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 2: // Color3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 3: // FresnelParameters\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 4: // Vector2\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 5: // Vector3\r\n serializationObject[targetPropertyName] = sourceProperty.asArray();\r\n break;\r\n case 6: // Mesh reference\r\n serializationObject[targetPropertyName] = sourceProperty.id;\r\n break;\r\n case 7: // Color Curves\r\n serializationObject[targetPropertyName] = sourceProperty.serialize();\r\n break;\r\n case 8: // Color 4\r\n serializationObject[targetPropertyName] = (<Color4>sourceProperty).asArray();\r\n break;\r\n case 9: // Image Processing\r\n serializationObject[targetPropertyName] = (<ImageProcessingConfiguration>sourceProperty).serialize();\r\n break;\r\n case 10: // Quaternion\r\n serializationObject[targetPropertyName] = (<Quaternion>sourceProperty).asArray();\r\n break;\r\n case 11: // Camera reference\r\n serializationObject[targetPropertyName] = (<Camera>sourceProperty).id;\r\n break;\r\n case 12: // Matrix\r\n serializationObject[targetPropertyName] = (<Matrix>sourceProperty).asArray();\r\n break;\r\n }\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Given a source json and a destination object in a scene, this function will parse the source and will try to apply its content to the destination object\r\n * @param source the source json data\r\n * @param destination the destination object\r\n * @param scene the scene where the object is\r\n * @param rootUrl root url to use to load assets\r\n */\r\n public static ParseProperties(source: any, destination: any, scene: Nullable<Scene>, rootUrl: Nullable<string>) {\r\n if (!rootUrl) {\r\n rootUrl = \"\";\r\n }\r\n\r\n const classStore = GetMergedStore(destination);\r\n\r\n // Properties\r\n for (const property in classStore) {\r\n const propertyDescriptor = classStore[property];\r\n const sourceProperty = source[propertyDescriptor.sourceName || property];\r\n const propertyType = propertyDescriptor.type;\r\n\r\n if (sourceProperty !== undefined && sourceProperty !== null && (property !== \"uniqueId\" || SerializationHelper.AllowLoadingUniqueId)) {\r\n const dest = destination;\r\n switch (propertyType) {\r\n case 0: // Value\r\n dest[property] = sourceProperty;\r\n break;\r\n case 1: // Texture\r\n if (scene) {\r\n dest[property] = SerializationHelper._TextureParser(sourceProperty, scene, rootUrl);\r\n }\r\n break;\r\n case 2: // Color3\r\n dest[property] = Color3.FromArray(sourceProperty);\r\n break;\r\n case 3: // FresnelParameters\r\n dest[property] = SerializationHelper._FresnelParametersParser(sourceProperty);\r\n break;\r\n case 4: // Vector2\r\n dest[property] = Vector2.FromArray(sourceProperty);\r\n break;\r\n case 5: // Vector3\r\n dest[property] = Vector3.FromArray(sourceProperty);\r\n break;\r\n case 6: // Mesh reference\r\n if (scene) {\r\n dest[property] = scene.getLastMeshById(sourceProperty);\r\n }\r\n break;\r\n case 7: // Color Curves\r\n dest[property] = SerializationHelper._ColorCurvesParser(sourceProperty);\r\n break;\r\n case 8: // Color 4\r\n dest[property] = Color4.FromArray(sourceProperty);\r\n break;\r\n case 9: // Image Processing\r\n dest[property] = SerializationHelper._ImageProcessingConfigurationParser(sourceProperty);\r\n break;\r\n case 10: // Quaternion\r\n dest[property] = Quaternion.FromArray(sourceProperty);\r\n break;\r\n case 11: // Camera reference\r\n if (scene) {\r\n dest[property] = scene.getCameraById(sourceProperty);\r\n }\r\n break;\r\n case 12: // Matrix\r\n dest[property] = Matrix.FromArray(sourceProperty);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new entity from a serialization data object\r\n * @param creationFunction defines a function used to instanciated the new entity\r\n * @param source defines the source serialization data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url for resources\r\n * @returns a new entity\r\n */\r\n public static Parse<T>(creationFunction: () => T, source: any, scene: Nullable<Scene>, rootUrl: Nullable<string> = null): T {\r\n const destination = creationFunction();\r\n\r\n // Tags\r\n if (Tags) {\r\n Tags.AddTagsTo(destination, source.tags);\r\n }\r\n\r\n SerializationHelper.ParseProperties(source, destination, scene, rootUrl);\r\n\r\n return destination;\r\n }\r\n\r\n /**\r\n * Clones an object\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @param options defines the options to use\r\n * @returns the cloned object\r\n */\r\n public static Clone<T>(creationFunction: () => T, source: T, options: ICopySourceOptions = {}): T {\r\n return CopySource(creationFunction, source, false, options);\r\n }\r\n\r\n /**\r\n * Instanciates a new object based on a source one (some data will be shared between both object)\r\n * @param creationFunction defines the function used to instanciate the new object\r\n * @param source defines the source object\r\n * @returns the new object\r\n */\r\n public static Instanciate<T>(creationFunction: () => T, source: T): T {\r\n return CopySource(creationFunction, source, true);\r\n }\r\n}\r\n"]}
|
package/Misc/index.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ export * from "./error.js";
|
|
|
67
67
|
export * from "./snapshotRenderingHelper.js";
|
|
68
68
|
export * from "./observableCoroutine.js";
|
|
69
69
|
export * from "./copyTextureToTexture.js";
|
|
70
|
+
export * from "./areaLightsTextureTools.js";
|
|
70
71
|
export { DumpTools, EncodeImageAsync } from "./dumpTools.js";
|
|
71
72
|
export * from "./greasedLineTools.js";
|
|
72
73
|
export * from "./equirectangularCapture.js";
|
|
@@ -81,4 +82,6 @@ export * from "../ShadersWGSL/rgbdDecode.fragment.js";
|
|
|
81
82
|
export * from "../ShadersWGSL/rgbdEncode.fragment.js";
|
|
82
83
|
export * from "../Shaders/copyTextureToTexture.fragment.js";
|
|
83
84
|
export * from "../ShadersWGSL/copyTextureToTexture.fragment.js";
|
|
85
|
+
export * from "../Shaders/areaLightTextureProcessing.fragment.js";
|
|
86
|
+
export * from "../ShadersWGSL/areaLightTextureProcessing.fragment.js";
|
|
84
87
|
export * from "./tools.internals.js";
|
package/Misc/index.js
CHANGED
|
@@ -70,6 +70,7 @@ export * from "./snapshotRenderingHelper.js";
|
|
|
70
70
|
// eslint-disable-next-line import/export
|
|
71
71
|
export * from "./observableCoroutine.js";
|
|
72
72
|
export * from "./copyTextureToTexture.js";
|
|
73
|
+
export * from "./areaLightsTextureTools.js";
|
|
73
74
|
export { DumpTools, EncodeImageAsync } from "./dumpTools.js";
|
|
74
75
|
export * from "./greasedLineTools.js";
|
|
75
76
|
export * from "./equirectangularCapture.js";
|
|
@@ -86,5 +87,8 @@ export * from "../ShadersWGSL/rgbdEncode.fragment.js";
|
|
|
86
87
|
// CopyTextureToTexture
|
|
87
88
|
export * from "../Shaders/copyTextureToTexture.fragment.js";
|
|
88
89
|
export * from "../ShadersWGSL/copyTextureToTexture.fragment.js";
|
|
90
|
+
// Area Light Texture
|
|
91
|
+
export * from "../Shaders/areaLightTextureProcessing.fragment.js";
|
|
92
|
+
export * from "../ShadersWGSL/areaLightTextureProcessing.fragment.js";
|
|
89
93
|
export * from "./tools.internals.js";
|
|
90
94
|
//# sourceMappingURL=index.js.map
|
package/Misc/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","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AAiC,CAAC;AAChD,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,2BAA2B,CAAC;AAC1C,yCAAyC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AAEvB,mBAAmB;AACnB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AAEnD,uBAAuB;AACvB,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAE7D,cAAc,mBAAmB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./andOrNotEvaluator\";\r\nexport * from \"./assetsManager\";\r\nexport * from \"./basis\";\r\nexport * from \"./dds\";\r\nexport * from \"./decorators\";\r\nexport * from \"./deferred\";\r\nexport * from \"./environmentTextureTools\";\r\nexport * from \"./meshExploder\";\r\nexport * from \"./filesInput\";\r\nexport * from \"./HighDynamicRange/index\";\r\nexport * from \"./khronosTextureContainer\";\r\nexport * from \"./observable\";\r\nexport * from \"./observable.extensions\";\r\nexport * from \"./performanceMonitor\";\r\nexport * from \"./sceneOptimizer\";\r\nexport * from \"./sceneSerializer\";\r\nexport * from \"./smartArray\";\r\nexport * from \"./stringDictionary\";\r\nexport * from \"./tags\";\r\nexport * from \"./textureTools\";\r\n// loaded from texture tools\r\nexport * from \"../Shaders/lodCube.fragment\";\r\nexport * from \"../Shaders/lod.fragment\";\r\nexport * from \"../ShadersWGSL/lodCube.fragment\";\r\nexport * from \"../ShadersWGSL/lod.fragment\";\r\nexport * from \"./tga\";\r\nexport * from \"./tools\";\r\nexport * from \"./videoRecorder\";\r\nexport * from \"./virtualJoystick\";\r\nexport * from \"./workerPool\";\r\nexport * from \"./logger\";\r\nexport * from \"./typeStore\";\r\nexport * from \"./filesInputStore\";\r\nexport * from \"./deepCopier\";\r\nexport * from \"./deepMerger\";\r\nexport * from \"./pivotTools\";\r\nexport * from \"./precisionDate\";\r\nexport * from \"./screenshotTools\";\r\nexport * from \"./webRequest\";\r\nexport * from \"./iInspectable\";\r\nexport * from \"./brdfTextureTools\";\r\nexport * from \"./rgbdTextureTools\";\r\nexport * from \"./gradients\";\r\nexport * from \"./perfCounter\";\r\nexport * from \"./fileRequest\";\r\nexport * from \"./customAnimationFrameRequester\";\r\nexport * from \"./retryStrategy\";\r\nexport * from \"./interfaces/screenshotSize\";\r\nexport * from \"./interfaces/iPerfViewer\";\r\nexport * from \"./fileTools\";\r\nexport * from \"./stringTools\";\r\nexport * from \"./dataReader\";\r\nexport * from \"./minMaxReducer\";\r\nexport * from \"./depthReducer\";\r\nexport * from \"./dataStorage\";\r\nexport * from \"./sceneRecorder\";\r\nexport * from \"./khronosTextureContainer2\";\r\nexport * from \"./trajectoryClassifier\";\r\nexport * from \"./timer\";\r\nexport * from \"./copyTools\";\r\nexport * from \"./reflector\";\r\nexport * from \"./domManagement\";\r\nexport * from \"./pressureObserverWrapper\";\r\nexport * from \"./PerformanceViewer/index\";\r\nexport * from \"./coroutine\";\r\nexport * from \"./guid\";\r\nexport * from \"./error\";\r\nexport * from \"./snapshotRenderingHelper\";\r\n// eslint-disable-next-line import/export\r\nexport * from \"./observableCoroutine\";\r\nexport * from \"./copyTextureToTexture\";\r\nexport { DumpTools, EncodeImageAsync } from \"./dumpTools\";\r\nexport * from \"./greasedLineTools\";\r\nexport * from \"./equirectangularCapture\";\r\nexport * from \"./decorators.serialization\";\r\nexport * from \"./asyncLock\";\r\nexport * from \"./bitArray\";\r\nexport * from \"./urlTools\";\r\nexport * from \"./lazy\";\r\n\r\n// RGBDTextureTools\r\nexport * from \"../Shaders/rgbdDecode.fragment\";\r\nexport * from \"../Shaders/rgbdEncode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdDecode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdEncode.fragment\";\r\n\r\n// CopyTextureToTexture\r\nexport * from \"../Shaders/copyTextureToTexture.fragment\";\r\nexport * from \"../ShadersWGSL/copyTextureToTexture.fragment\";\r\n\r\nexport * from \"./tools.internals\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,cAAc,C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aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,2BAA2B,CAAC;AAC1C,yCAAyC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AAEvB,mBAAmB;AACnB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AAEnD,uBAAuB;AACvB,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAE7D,qBAAqB;AACrB,cAAc,gDAAgD,CAAC;AAC/D,cAAc,oDAAoD,CAAC;AACnE,cAAc,mBAAmB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-restricted-imports */\r\nexport * from \"./andOrNotEvaluator\";\r\nexport * from \"./assetsManager\";\r\nexport * from \"./basis\";\r\nexport * from \"./dds\";\r\nexport * from \"./decorators\";\r\nexport * from \"./deferred\";\r\nexport * from \"./environmentTextureTools\";\r\nexport * from \"./meshExploder\";\r\nexport * from \"./filesInput\";\r\nexport * from \"./HighDynamicRange/index\";\r\nexport * from \"./khronosTextureContainer\";\r\nexport * from \"./observable\";\r\nexport * from \"./observable.extensions\";\r\nexport * from \"./performanceMonitor\";\r\nexport * from \"./sceneOptimizer\";\r\nexport * from \"./sceneSerializer\";\r\nexport * from \"./smartArray\";\r\nexport * from \"./stringDictionary\";\r\nexport * from \"./tags\";\r\nexport * from \"./textureTools\";\r\n// loaded from texture tools\r\nexport * from \"../Shaders/lodCube.fragment\";\r\nexport * from \"../Shaders/lod.fragment\";\r\nexport * from \"../ShadersWGSL/lodCube.fragment\";\r\nexport * from \"../ShadersWGSL/lod.fragment\";\r\nexport * from \"./tga\";\r\nexport * from \"./tools\";\r\nexport * from \"./videoRecorder\";\r\nexport * from \"./virtualJoystick\";\r\nexport * from \"./workerPool\";\r\nexport * from \"./logger\";\r\nexport * from \"./typeStore\";\r\nexport * from \"./filesInputStore\";\r\nexport * from \"./deepCopier\";\r\nexport * from \"./deepMerger\";\r\nexport * from \"./pivotTools\";\r\nexport * from \"./precisionDate\";\r\nexport * from \"./screenshotTools\";\r\nexport * from \"./webRequest\";\r\nexport * from \"./iInspectable\";\r\nexport * from \"./brdfTextureTools\";\r\nexport * from \"./rgbdTextureTools\";\r\nexport * from \"./gradients\";\r\nexport * from \"./perfCounter\";\r\nexport * from \"./fileRequest\";\r\nexport * from \"./customAnimationFrameRequester\";\r\nexport * from \"./retryStrategy\";\r\nexport * from \"./interfaces/screenshotSize\";\r\nexport * from \"./interfaces/iPerfViewer\";\r\nexport * from \"./fileTools\";\r\nexport * from \"./stringTools\";\r\nexport * from \"./dataReader\";\r\nexport * from \"./minMaxReducer\";\r\nexport * from \"./depthReducer\";\r\nexport * from \"./dataStorage\";\r\nexport * from \"./sceneRecorder\";\r\nexport * from \"./khronosTextureContainer2\";\r\nexport * from \"./trajectoryClassifier\";\r\nexport * from \"./timer\";\r\nexport * from \"./copyTools\";\r\nexport * from \"./reflector\";\r\nexport * from \"./domManagement\";\r\nexport * from \"./pressureObserverWrapper\";\r\nexport * from \"./PerformanceViewer/index\";\r\nexport * from \"./coroutine\";\r\nexport * from \"./guid\";\r\nexport * from \"./error\";\r\nexport * from \"./snapshotRenderingHelper\";\r\n// eslint-disable-next-line import/export\r\nexport * from \"./observableCoroutine\";\r\nexport * from \"./copyTextureToTexture\";\r\nexport * from \"./areaLightsTextureTools\";\r\nexport { DumpTools, EncodeImageAsync } from \"./dumpTools\";\r\nexport * from \"./greasedLineTools\";\r\nexport * from \"./equirectangularCapture\";\r\nexport * from \"./decorators.serialization\";\r\nexport * from \"./asyncLock\";\r\nexport * from \"./bitArray\";\r\nexport * from \"./urlTools\";\r\nexport * from \"./lazy\";\r\n\r\n// RGBDTextureTools\r\nexport * from \"../Shaders/rgbdDecode.fragment\";\r\nexport * from \"../Shaders/rgbdEncode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdDecode.fragment\";\r\nexport * from \"../ShadersWGSL/rgbdEncode.fragment\";\r\n\r\n// CopyTextureToTexture\r\nexport * from \"../Shaders/copyTextureToTexture.fragment\";\r\nexport * from \"../ShadersWGSL/copyTextureToTexture.fragment\";\r\n\r\n// Area Light Texture\r\nexport * from \"../Shaders/areaLightTextureProcessing.fragment\";\r\nexport * from \"../ShadersWGSL/areaLightTextureProcessing.fragment\";\r\nexport * from \"./tools.internals\";\r\n"]}
|
|
@@ -23,6 +23,10 @@ export declare class ParticleTextureSourceBlock extends NodeParticleBlock {
|
|
|
23
23
|
private _sourceTexture;
|
|
24
24
|
private _cachedData;
|
|
25
25
|
private _clonedTextures;
|
|
26
|
+
/**
|
|
27
|
+
* Gets or sets the strenght of the flow map effect
|
|
28
|
+
*/
|
|
29
|
+
invertY: boolean;
|
|
26
30
|
/**
|
|
27
31
|
* Indicates if the texture data should be serialized as a base64 string.
|
|
28
32
|
*/
|
|
@@ -62,6 +62,10 @@ export class ParticleTextureSourceBlock extends NodeParticleBlock {
|
|
|
62
62
|
this._sourceTexture = null;
|
|
63
63
|
this._cachedData = null;
|
|
64
64
|
this._clonedTextures = [];
|
|
65
|
+
/**
|
|
66
|
+
* Gets or sets the strenght of the flow map effect
|
|
67
|
+
*/
|
|
68
|
+
this.invertY = true;
|
|
65
69
|
/**
|
|
66
70
|
* Indicates if the texture data should be serialized as a base64 string.
|
|
67
71
|
*/
|
|
@@ -157,7 +161,7 @@ export class ParticleTextureSourceBlock extends NodeParticleBlock {
|
|
|
157
161
|
// Cross-engine: recreate texture from URL if available, preserving invertY
|
|
158
162
|
const url = this._sourceTexture.url || this._url;
|
|
159
163
|
if (url) {
|
|
160
|
-
const invertY = this._sourceTexture.invertY ??
|
|
164
|
+
const invertY = this._sourceTexture.invertY ?? this.invertY;
|
|
161
165
|
const tex = new Texture(url, state.scene, undefined, invertY);
|
|
162
166
|
this._copyTextureProperties(this._sourceTexture, tex);
|
|
163
167
|
this._clonedTextures.push(tex);
|
|
@@ -185,12 +189,12 @@ export class ParticleTextureSourceBlock extends NodeParticleBlock {
|
|
|
185
189
|
return;
|
|
186
190
|
}
|
|
187
191
|
if (this._textureDataUrl) {
|
|
188
|
-
const tex = new Texture(this._textureDataUrl, state.scene);
|
|
192
|
+
const tex = new Texture(this._textureDataUrl, state.scene, undefined, this.invertY);
|
|
189
193
|
this._clonedTextures.push(tex);
|
|
190
194
|
this.texture._storedValue = tex;
|
|
191
195
|
return;
|
|
192
196
|
}
|
|
193
|
-
const tex = new Texture(this._url, state.scene);
|
|
197
|
+
const tex = new Texture(this._url, state.scene, undefined, this.invertY);
|
|
194
198
|
this._clonedTextures.push(tex);
|
|
195
199
|
this.texture._storedValue = tex;
|
|
196
200
|
}
|
|
@@ -202,6 +206,7 @@ export class ParticleTextureSourceBlock extends NodeParticleBlock {
|
|
|
202
206
|
const serializationObject = super.serialize();
|
|
203
207
|
serializationObject.url = this.url;
|
|
204
208
|
serializationObject.serializedCachedData = this.serializedCachedData;
|
|
209
|
+
serializationObject.invertY = this.invertY;
|
|
205
210
|
if (this.serializedCachedData) {
|
|
206
211
|
serializationObject.textureDataUrl = this.textureDataUrl;
|
|
207
212
|
}
|
|
@@ -215,6 +220,7 @@ export class ParticleTextureSourceBlock extends NodeParticleBlock {
|
|
|
215
220
|
super._deserialize(serializationObject);
|
|
216
221
|
this.url = serializationObject.url;
|
|
217
222
|
this.serializedCachedData = !!serializationObject.serializedCachedData;
|
|
223
|
+
this.invertY = !!serializationObject.invertY;
|
|
218
224
|
if (serializationObject.textureDataUrl) {
|
|
219
225
|
this.textureDataUrl = serializationObject.textureDataUrl;
|
|
220
226
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"particleSourceTextureBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleSourceTextureBlock.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,+CAAwC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,sCAA+B;AActD;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAY7D;;OAEG;IACH,IAAW,GAAG;QACV,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,IAAW,GAAG,CAAC,KAAa;QACxB,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YACtB,OAAO;QACX,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED,IAAW,cAAc,CAAC,KAAa;QACnC,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,EAAE,CAAC;YACjC,OAAO;QACX,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,eAAe,GAAG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,MAAM,CAAC,eAAe,CAAC;QAChD,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,yBAAyB,GAAG,MAAM,CAAC,yBAAyB,CAAC;QAEpE,8DAA8D;QAC9D,MAAM,aAAa,GAAG,MAAiB,CAAC;QACxC,MAAM,aAAa,GAAG,MAAiB,CAAC;QACxC,IAAI,aAAa,CAAC,OAAO,KAAK,SAAS,IAAI,aAAa,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC7E,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;YAC9C,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;YAC9C,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;YAC5C,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;YAC5C,aAAa,CAAC,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC;YACxC,aAAa,CAAC,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC;YACxC,aAAa,CAAC,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC;QAC5C,CAAC;IACL,CAAC;CACJ;AAED,aAAa,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { BaseTexture } from \"../../../Materials/Textures/baseTexture\";\r\nimport type { ProceduralTexture } from \"../../../Materials\";\r\n\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport { TextureTools } from \"core/Misc/textureTools\";\r\n\r\n/**\r\n * Interface used to define texture data\r\n */\r\nexport interface INodeParticleTextureData {\r\n /** Width of the texture in pixels */\r\n width: number;\r\n /** Height of the texture in pixels */\r\n height: number;\r\n /** RGBA pixel data */\r\n data: Uint8ClampedArray;\r\n}\r\n\r\n/**\r\n * Block used to provide a texture for particles in a particle system\r\n */\r\nexport class ParticleTextureSourceBlock extends NodeParticleBlock {\r\n private _url: string = \"\";\r\n private _textureDataUrl: string = \"\";\r\n private _sourceTexture: Nullable<BaseTexture> = null;\r\n private _cachedData: Nullable<INodeParticleTextureData> = null;\r\n private _clonedTextures: BaseTexture[] = [];\r\n\r\n /**\r\n * Indicates if the texture data should be serialized as a base64 string.\r\n */\r\n public serializedCachedData: boolean = false;\r\n\r\n /**\r\n * Gets or sets the URL of the texture to be used by this block.\r\n */\r\n public get url(): string {\r\n return this._url;\r\n }\r\n\r\n public set url(value: string) {\r\n if (this._url === value) {\r\n return;\r\n }\r\n this._cachedData = null;\r\n this._url = value;\r\n this._textureDataUrl = \"\";\r\n this._sourceTexture = null;\r\n }\r\n\r\n /**\r\n * Gets or sets the data URL of the texture to be used by this block.\r\n * This is a base64 encoded string representing the texture data.\r\n */\r\n public get textureDataUrl(): string {\r\n return this._textureDataUrl;\r\n }\r\n\r\n public set textureDataUrl(value: string) {\r\n if (this._textureDataUrl === value) {\r\n return;\r\n }\r\n\r\n this._cachedData = null;\r\n this._textureDataUrl = value;\r\n this._url = \"\";\r\n this._sourceTexture = null;\r\n }\r\n\r\n /**\r\n * Directly sets the texture to be used by this block.\r\n * This value will not be serialized.\r\n */\r\n public set sourceTexture(value: Nullable<BaseTexture>) {\r\n if (this._sourceTexture === value) {\r\n return;\r\n }\r\n this._cachedData = null;\r\n this._sourceTexture = value;\r\n this._url = (value as Texture).url || \"\";\r\n this._textureDataUrl = \"\";\r\n }\r\n\r\n /**\r\n * Create a new ParticleTextureSourceBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerOutput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleTextureSourceBlock\";\r\n }\r\n\r\n /**\r\n * Gets the texture output component\r\n */\r\n public get texture(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the texture content as a promise\r\n * @returns a promise that resolves to the texture content, including width, height, and pixel data\r\n */\r\n async extractTextureContentAsync() {\r\n if (!this.texture._storedValue && !this._sourceTexture) {\r\n return null;\r\n }\r\n\r\n if (this._cachedData) {\r\n return this._cachedData;\r\n }\r\n\r\n const texture = this.texture._storedValue || this._sourceTexture;\r\n return await new Promise<\r\n Nullable<{\r\n width: number;\r\n height: number;\r\n data: Uint8ClampedArray;\r\n }>\r\n >((resolve, reject) => {\r\n if (!texture.isReady()) {\r\n texture.onLoadObservable.addOnce(async () => {\r\n try {\r\n this._cachedData = await this.extractTextureContentAsync();\r\n resolve(this._cachedData);\r\n } catch (e) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(e);\r\n }\r\n });\r\n return;\r\n }\r\n const size = texture.getSize();\r\n if (texture.getContent) {\r\n const proceduralTexture = texture as ProceduralTexture;\r\n proceduralTexture\r\n .getContent()\r\n // eslint-disable-next-line github/no-then\r\n ?.then((data) => {\r\n this._cachedData = {\r\n width: size.width,\r\n height: size.height,\r\n data: data as Uint8ClampedArray,\r\n };\r\n resolve(this._cachedData);\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch(reject);\r\n } else {\r\n TextureTools.GetTextureDataAsync(texture, size.width, size.height)\r\n // eslint-disable-next-line github/no-then\r\n .then((data) => {\r\n this._cachedData = {\r\n width: size.width,\r\n height: size.height,\r\n data: new Uint8ClampedArray(data),\r\n };\r\n texture.dispose();\r\n resolve(this._cachedData);\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch(reject);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n if (this._sourceTexture) {\r\n // The same NodeParticleSystemSet can be built into multiple scenes/engines\r\n // (original system scene, editor preview scene).\r\n // Textures are engine-specific, so we need to handle cross-engine cases.\r\n const sourceScene = this._sourceTexture.getScene?.();\r\n const sourceEngine = sourceScene?.getEngine?.();\r\n const targetEngine = state.scene.getEngine();\r\n\r\n if (sourceEngine && sourceEngine !== targetEngine) {\r\n // Cross-engine: recreate texture from URL if available, preserving invertY\r\n const url = (this._sourceTexture as Texture).url || this._url;\r\n if (url) {\r\n const invertY = (this._sourceTexture as Texture).invertY ?? true;\r\n const tex = new Texture(url, state.scene, undefined, invertY);\r\n this._copyTextureProperties(this._sourceTexture, tex);\r\n this._clonedTextures.push(tex);\r\n this.texture._storedValue = tex;\r\n return;\r\n }\r\n // No URL available - use the source texture directly as fallback\r\n // This may not render correctly but avoids breaking completely\r\n this.texture._storedValue = this._sourceTexture;\r\n return;\r\n }\r\n\r\n // Same engine: clone works correctly and preserves all properties\r\n const cloned = this._sourceTexture.clone();\r\n if (cloned) {\r\n this._clonedTextures.push(cloned);\r\n this.texture._storedValue = cloned;\r\n } else {\r\n this.texture._storedValue = this._sourceTexture;\r\n }\r\n return;\r\n }\r\n\r\n if (!this._textureDataUrl && !this._url) {\r\n this.texture._storedValue = null;\r\n return;\r\n }\r\n\r\n if (this._textureDataUrl) {\r\n const tex = new Texture(this._textureDataUrl, state.scene);\r\n this._clonedTextures.push(tex);\r\n this.texture._storedValue = tex;\r\n return;\r\n }\r\n\r\n const tex = new Texture(this._url, state.scene);\r\n this._clonedTextures.push(tex);\r\n this.texture._storedValue = tex;\r\n }\r\n\r\n /**\r\n * Serializes this block\r\n * @returns the serialization object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.url = this.url;\r\n serializationObject.serializedCachedData = this.serializedCachedData;\r\n\r\n if (this.serializedCachedData) {\r\n serializationObject.textureDataUrl = this.textureDataUrl;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Deserializes this block from a serialization object\r\n * @param serializationObject the serialization object\r\n */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.url = serializationObject.url;\r\n this.serializedCachedData = !!serializationObject.serializedCachedData;\r\n\r\n if (serializationObject.textureDataUrl) {\r\n this.textureDataUrl = serializationObject.textureDataUrl;\r\n }\r\n }\r\n\r\n /**\r\n * Disposes the block and its associated resources\r\n */\r\n public override dispose(): void {\r\n // Dispose all cloned textures we created\r\n for (const tex of this._clonedTextures) {\r\n tex.dispose();\r\n }\r\n this._clonedTextures = [];\r\n this.texture._storedValue = null;\r\n // Never dispose _sourceTexture - it's owned by the caller\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Copies texture properties from source to target texture\r\n * @param source - The source texture to copy properties from\r\n * @param target - The target texture to copy properties to\r\n */\r\n private _copyTextureProperties(source: BaseTexture, target: BaseTexture): void {\r\n // BaseTexture properties\r\n target.hasAlpha = source.hasAlpha;\r\n target.level = source.level;\r\n target.coordinatesIndex = source.coordinatesIndex;\r\n target.coordinatesMode = source.coordinatesMode;\r\n target.wrapU = source.wrapU;\r\n target.wrapV = source.wrapV;\r\n target.wrapR = source.wrapR;\r\n target.anisotropicFilteringLevel = source.anisotropicFilteringLevel;\r\n\r\n // Texture-specific properties (if both are Texture instances)\r\n const sourceTexture = source as Texture;\r\n const targetTexture = target as Texture;\r\n if (sourceTexture.uOffset !== undefined && targetTexture.uOffset !== undefined) {\r\n targetTexture.uOffset = sourceTexture.uOffset;\r\n targetTexture.vOffset = sourceTexture.vOffset;\r\n targetTexture.uScale = sourceTexture.uScale;\r\n targetTexture.vScale = sourceTexture.vScale;\r\n targetTexture.uAng = sourceTexture.uAng;\r\n targetTexture.vAng = sourceTexture.vAng;\r\n targetTexture.wAng = sourceTexture.wAng;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleTextureSourceBlock\", ParticleTextureSourceBlock);\r\n"]}
|
|
1
|
+
{"version":3,"file":"particleSourceTextureBlock.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Particles/Node/Blocks/particleSourceTextureBlock.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,+CAAwC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAC;AACvG,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,sCAA+B;AActD;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,iBAAiB;IAiB7D;;OAEG;IACH,IAAW,GAAG;QACV,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,IAAW,GAAG,CAAC,KAAa;QACxB,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,EAAE,CAAC;YACtB,OAAO;QACX,CAAC;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC;QAC1B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED,IAAW,cAAc,CAAC,KAAa;QACnC,IAAI,IAAI,CAAC,eAAe,KAAK,KAAK,EAAE,CAAC;YACjC,OAAO;QACX,CAAC;QAED,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;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B,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAClC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;QAClD,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;QAChD,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC5B,MAAM,CAAC,yBAAyB,GAAG,MAAM,CAAC,yBAAyB,CAAC;QAEpE,8DAA8D;QAC9D,MAAM,aAAa,GAAG,MAAiB,CAAC;QACxC,MAAM,aAAa,GAAG,MAAiB,CAAC;QACxC,IAAI,aAAa,CAAC,OAAO,KAAK,SAAS,IAAI,aAAa,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC7E,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;YAC9C,aAAa,CAAC,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;YAC9C,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;YAC5C,aAAa,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC;YAC5C,aAAa,CAAC,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC;YACxC,aAAa,CAAC,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC;YACxC,aAAa,CAAC,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC;QAC5C,CAAC;IACL,CAAC;CACJ;AAED,aAAa,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import type { NodeParticleConnectionPoint } from \"../nodeParticleBlockConnectionPoint\";\r\nimport type { NodeParticleBuildState } from \"../nodeParticleBuildState\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { BaseTexture } from \"../../../Materials/Textures/baseTexture\";\r\nimport type { ProceduralTexture } from \"../../../Materials/Textures/Procedurals/proceduralTexture\";\r\n\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { RegisterClass } from \"../../../Misc/typeStore\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"../Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { NodeParticleBlock } from \"../nodeParticleBlock\";\r\nimport { TextureTools } from \"core/Misc/textureTools\";\r\n\r\n/**\r\n * Interface used to define texture data\r\n */\r\nexport interface INodeParticleTextureData {\r\n /** Width of the texture in pixels */\r\n width: number;\r\n /** Height of the texture in pixels */\r\n height: number;\r\n /** RGBA pixel data */\r\n data: Uint8ClampedArray;\r\n}\r\n\r\n/**\r\n * Block used to provide a texture for particles in a particle system\r\n */\r\nexport class ParticleTextureSourceBlock extends NodeParticleBlock {\r\n private _url: string = \"\";\r\n private _textureDataUrl: string = \"\";\r\n private _sourceTexture: Nullable<BaseTexture> = null;\r\n private _cachedData: Nullable<INodeParticleTextureData> = null;\r\n private _clonedTextures: BaseTexture[] = [];\r\n\r\n /**\r\n * Gets or sets the strenght of the flow map effect\r\n */\r\n public invertY = true;\r\n\r\n /**\r\n * Indicates if the texture data should be serialized as a base64 string.\r\n */\r\n public serializedCachedData: boolean = false;\r\n\r\n /**\r\n * Gets or sets the URL of the texture to be used by this block.\r\n */\r\n public get url(): string {\r\n return this._url;\r\n }\r\n\r\n public set url(value: string) {\r\n if (this._url === value) {\r\n return;\r\n }\r\n this._cachedData = null;\r\n this._url = value;\r\n this._textureDataUrl = \"\";\r\n this._sourceTexture = null;\r\n }\r\n\r\n /**\r\n * Gets or sets the data URL of the texture to be used by this block.\r\n * This is a base64 encoded string representing the texture data.\r\n */\r\n public get textureDataUrl(): string {\r\n return this._textureDataUrl;\r\n }\r\n\r\n public set textureDataUrl(value: string) {\r\n if (this._textureDataUrl === value) {\r\n return;\r\n }\r\n\r\n this._cachedData = null;\r\n this._textureDataUrl = value;\r\n this._url = \"\";\r\n this._sourceTexture = null;\r\n }\r\n\r\n /**\r\n * Directly sets the texture to be used by this block.\r\n * This value will not be serialized.\r\n */\r\n public set sourceTexture(value: Nullable<BaseTexture>) {\r\n if (this._sourceTexture === value) {\r\n return;\r\n }\r\n this._cachedData = null;\r\n this._sourceTexture = value;\r\n this._url = (value as Texture).url || \"\";\r\n this._textureDataUrl = \"\";\r\n }\r\n\r\n /**\r\n * Create a new ParticleTextureSourceBlock\r\n * @param name defines the block name\r\n */\r\n public constructor(name: string) {\r\n super(name);\r\n\r\n this.registerOutput(\"texture\", NodeParticleBlockConnectionPointTypes.Texture);\r\n }\r\n\r\n /**\r\n * Gets the current class name\r\n * @returns the class name\r\n */\r\n public override getClassName() {\r\n return \"ParticleTextureSourceBlock\";\r\n }\r\n\r\n /**\r\n * Gets the texture output component\r\n */\r\n public get texture(): NodeParticleConnectionPoint {\r\n return this._outputs[0];\r\n }\r\n\r\n /**\r\n * Gets the texture content as a promise\r\n * @returns a promise that resolves to the texture content, including width, height, and pixel data\r\n */\r\n async extractTextureContentAsync() {\r\n if (!this.texture._storedValue && !this._sourceTexture) {\r\n return null;\r\n }\r\n\r\n if (this._cachedData) {\r\n return this._cachedData;\r\n }\r\n\r\n const texture = this.texture._storedValue || this._sourceTexture;\r\n return await new Promise<\r\n Nullable<{\r\n width: number;\r\n height: number;\r\n data: Uint8ClampedArray;\r\n }>\r\n >((resolve, reject) => {\r\n if (!texture.isReady()) {\r\n texture.onLoadObservable.addOnce(async () => {\r\n try {\r\n this._cachedData = await this.extractTextureContentAsync();\r\n resolve(this._cachedData);\r\n } catch (e) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(e);\r\n }\r\n });\r\n return;\r\n }\r\n const size = texture.getSize();\r\n if (texture.getContent) {\r\n const proceduralTexture = texture as ProceduralTexture;\r\n proceduralTexture\r\n .getContent()\r\n // eslint-disable-next-line github/no-then\r\n ?.then((data) => {\r\n this._cachedData = {\r\n width: size.width,\r\n height: size.height,\r\n data: data as Uint8ClampedArray,\r\n };\r\n resolve(this._cachedData);\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch(reject);\r\n } else {\r\n TextureTools.GetTextureDataAsync(texture, size.width, size.height)\r\n // eslint-disable-next-line github/no-then\r\n .then((data) => {\r\n this._cachedData = {\r\n width: size.width,\r\n height: size.height,\r\n data: new Uint8ClampedArray(data),\r\n };\r\n texture.dispose();\r\n resolve(this._cachedData);\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch(reject);\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Builds the block\r\n * @param state defines the current build state\r\n */\r\n public override _build(state: NodeParticleBuildState) {\r\n if (this._sourceTexture) {\r\n // The same NodeParticleSystemSet can be built into multiple scenes/engines\r\n // (original system scene, editor preview scene).\r\n // Textures are engine-specific, so we need to handle cross-engine cases.\r\n const sourceScene = this._sourceTexture.getScene?.();\r\n const sourceEngine = sourceScene?.getEngine?.();\r\n const targetEngine = state.scene.getEngine();\r\n\r\n if (sourceEngine && sourceEngine !== targetEngine) {\r\n // Cross-engine: recreate texture from URL if available, preserving invertY\r\n const url = (this._sourceTexture as Texture).url || this._url;\r\n if (url) {\r\n const invertY = (this._sourceTexture as Texture).invertY ?? this.invertY;\r\n const tex = new Texture(url, state.scene, undefined, invertY);\r\n this._copyTextureProperties(this._sourceTexture, tex);\r\n this._clonedTextures.push(tex);\r\n this.texture._storedValue = tex;\r\n return;\r\n }\r\n // No URL available - use the source texture directly as fallback\r\n // This may not render correctly but avoids breaking completely\r\n this.texture._storedValue = this._sourceTexture;\r\n return;\r\n }\r\n\r\n // Same engine: clone works correctly and preserves all properties\r\n const cloned = this._sourceTexture.clone();\r\n if (cloned) {\r\n this._clonedTextures.push(cloned);\r\n this.texture._storedValue = cloned;\r\n } else {\r\n this.texture._storedValue = this._sourceTexture;\r\n }\r\n return;\r\n }\r\n\r\n if (!this._textureDataUrl && !this._url) {\r\n this.texture._storedValue = null;\r\n return;\r\n }\r\n\r\n if (this._textureDataUrl) {\r\n const tex = new Texture(this._textureDataUrl, state.scene, undefined, this.invertY);\r\n this._clonedTextures.push(tex);\r\n this.texture._storedValue = tex;\r\n return;\r\n }\r\n\r\n const tex = new Texture(this._url, state.scene, undefined, this.invertY);\r\n this._clonedTextures.push(tex);\r\n this.texture._storedValue = tex;\r\n }\r\n\r\n /**\r\n * Serializes this block\r\n * @returns the serialization object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n\r\n serializationObject.url = this.url;\r\n serializationObject.serializedCachedData = this.serializedCachedData;\r\n serializationObject.invertY = this.invertY;\r\n\r\n if (this.serializedCachedData) {\r\n serializationObject.textureDataUrl = this.textureDataUrl;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Deserializes this block from a serialization object\r\n * @param serializationObject the serialization object\r\n */\r\n public override _deserialize(serializationObject: any) {\r\n super._deserialize(serializationObject);\r\n\r\n this.url = serializationObject.url;\r\n this.serializedCachedData = !!serializationObject.serializedCachedData;\r\n this.invertY = !!serializationObject.invertY;\r\n\r\n if (serializationObject.textureDataUrl) {\r\n this.textureDataUrl = serializationObject.textureDataUrl;\r\n }\r\n }\r\n\r\n /**\r\n * Disposes the block and its associated resources\r\n */\r\n public override dispose(): void {\r\n // Dispose all cloned textures we created\r\n for (const tex of this._clonedTextures) {\r\n tex.dispose();\r\n }\r\n this._clonedTextures = [];\r\n this.texture._storedValue = null;\r\n // Never dispose _sourceTexture - it's owned by the caller\r\n super.dispose();\r\n }\r\n\r\n /**\r\n * Copies texture properties from source to target texture\r\n * @param source - The source texture to copy properties from\r\n * @param target - The target texture to copy properties to\r\n */\r\n private _copyTextureProperties(source: BaseTexture, target: BaseTexture): void {\r\n // BaseTexture properties\r\n target.hasAlpha = source.hasAlpha;\r\n target.level = source.level;\r\n target.coordinatesIndex = source.coordinatesIndex;\r\n target.coordinatesMode = source.coordinatesMode;\r\n target.wrapU = source.wrapU;\r\n target.wrapV = source.wrapV;\r\n target.wrapR = source.wrapR;\r\n target.anisotropicFilteringLevel = source.anisotropicFilteringLevel;\r\n\r\n // Texture-specific properties (if both are Texture instances)\r\n const sourceTexture = source as Texture;\r\n const targetTexture = target as Texture;\r\n if (sourceTexture.uOffset !== undefined && targetTexture.uOffset !== undefined) {\r\n targetTexture.uOffset = sourceTexture.uOffset;\r\n targetTexture.vOffset = sourceTexture.vOffset;\r\n targetTexture.uScale = sourceTexture.uScale;\r\n targetTexture.vScale = sourceTexture.vScale;\r\n targetTexture.uAng = sourceTexture.uAng;\r\n targetTexture.vAng = sourceTexture.vAng;\r\n targetTexture.wAng = sourceTexture.wAng;\r\n }\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ParticleTextureSourceBlock\", ParticleTextureSourceBlock);\r\n"]}
|
|
@@ -15,6 +15,8 @@ export interface INodeParticleEditorOptions {
|
|
|
15
15
|
/** Additional configuration for the NPE */
|
|
16
16
|
nodeEditorConfig?: {
|
|
17
17
|
backgroundColor?: Color4;
|
|
18
|
+
/** If true, the node particle system set will be disposed when the editor is closed (default: true) */
|
|
19
|
+
disposeOnClose?: boolean;
|
|
18
20
|
};
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeParticleSystemSet.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleSystemSet.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iCAA6B;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,+CAA2C;AACzE,OAAO,EAAE,UAAU,EAAE,iCAA6B;AAClD,OAAO,EAAE,QAAQ,EAAE,gCAA4B;AAC/C,OAAO,EAAE,UAAU,E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AClC,+BAAS,GAAG,GAAG,KAAK,CAAC,cAAc,KAAK,cAAc,CAAC,OAAO,mDAAmD,AAAxG,CAAyG;AAEhI,sCAAsC;AACxB,gCAAU,GAAG,SAAS,CAAC,UAAU,AAAvB,CAAwB;AA2BzC;IADN,SAAS,EAAE;mDACQ;AAMb;IADN,SAAS,CAAC,SAAS,CAAC;sDACE","sourcesContent":["import { serialize } from \"core/Misc/decorators\";\r\nimport { ParticleSystemSet } from \"../particleSystemSet\";\r\nimport { SystemBlock } from \"./Blocks/systemBlock\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { NodeParticleBuildState } from \"./nodeParticleBuildState\";\r\nimport type { NodeParticleBlock } from \"./nodeParticleBlock\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { GetClass } from \"core/Misc/typeStore\";\r\nimport { WebRequest } from \"core/Misc/webRequest\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport { ParticleInputBlock } from \"./Blocks/particleInputBlock\";\r\nimport { ParticleTextureSourceBlock } from \"./Blocks/particleSourceTextureBlock\";\r\nimport { NodeParticleContextualSources } from \"./Enums/nodeParticleContextualSources\";\r\nimport { UpdatePositionBlock } from \"./Blocks/Update/updatePositionBlock\";\r\nimport { ParticleMathBlock, ParticleMathBlockOperations } from \"./Blocks/particleMathBlock\";\r\nimport type { ParticleTeleportOutBlock } from \"./Blocks/Teleport/particleTeleportOutBlock\";\r\nimport type { ParticleTeleportInBlock } from \"./Blocks/Teleport/particleTeleportInBlock\";\r\nimport { BoxShapeBlock } from \"./Blocks/Emitters/boxShapeBlock\";\r\nimport { CreateParticleBlock } from \"./Blocks/Emitters/createParticleBlock\";\r\nimport type { Color4 } from \"core/Maths/math.color\";\r\nimport type { Nullable } from \"../../types\";\r\n\r\n// declare NODEPARTICLEEDITOR namespace for compilation issue\r\ndeclare let NODEPARTICLEEDITOR: any;\r\ndeclare let BABYLON: any;\r\n\r\n/**\r\n * Interface used to configure the node particle editor\r\n */\r\nexport interface INodeParticleEditorOptions {\r\n /** Define the URL to load node editor script from */\r\n editorURL?: string;\r\n /** Additional configuration for the NPE */\r\n nodeEditorConfig?: {\r\n backgroundColor?: Color4;\r\n };\r\n}\r\n\r\n/**\r\n * Defines a set of particle systems defined as a node graph.\r\n * NPE: #K6F1ZB#1\r\n * PG: #ZT509U#1\r\n */\r\nexport class NodeParticleSystemSet {\r\n private _systemBlocks: SystemBlock[] = [];\r\n private _buildId: number = 0;\r\n\r\n /** Define the Url to load node editor script */\r\n public static EditorURL = `${Tools._DefaultCdnUrl}/v${AbstractEngine.Version}/nodeParticleEditor/babylon.nodeParticleEditor.js`;\r\n\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n /**\r\n * Snippet ID if the material was created from the snippet server\r\n */\r\n public snippetId: string;\r\n\r\n /**\r\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\r\n */\r\n public attachedBlocks: NodeParticleBlock[] = [];\r\n\r\n /**\r\n * Gets or sets data used by visual editor\r\n * @see https://npe.babylonjs.com\r\n */\r\n public editorData: any = null;\r\n\r\n /**\r\n * Observable raised when the particle set is built\r\n */\r\n public onBuildObservable = new Observable<NodeParticleSystemSet>();\r\n\r\n /**\r\n * The name of the set\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * A free comment about the set\r\n */\r\n @serialize(\"comment\")\r\n public comment: string;\r\n\r\n /**\r\n * Gets the system blocks\r\n */\r\n public get systemBlocks(): SystemBlock[] {\r\n return this._systemBlocks;\r\n }\r\n\r\n /**\r\n * Gets the list of input blocks attached to this material\r\n * @returns an array of InputBlocks\r\n */\r\n public get inputBlocks() {\r\n const blocks: ParticleInputBlock[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block.isInput) {\r\n blocks.push(block as ParticleInputBlock);\r\n }\r\n }\r\n\r\n return blocks;\r\n }\r\n\r\n /**\r\n * Get a block by its name\r\n * @param name defines the name of the block to retrieve\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByName(name: string) {\r\n let result = null;\r\n for (const block of this.attachedBlocks) {\r\n if (block.name === name) {\r\n if (!result) {\r\n result = block;\r\n } else {\r\n Tools.Warn(\"More than one block was found with the name `\" + name + \"`\");\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get a block using a predicate\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByPredicate(predicate: (block: NodeParticleBlock) => boolean) {\r\n for (const block of this.attachedBlocks) {\r\n if (predicate(block)) {\r\n return block;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Get an input block using a predicate\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required input block or null if not found\r\n */\r\n public getInputBlockByPredicate(predicate: (block: ParticleInputBlock) => boolean): Nullable<ParticleInputBlock> {\r\n for (const block of this.attachedBlocks) {\r\n if (block.isInput && predicate(block as ParticleInputBlock)) {\r\n return block as ParticleInputBlock;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n /**\r\n * Creates a new set\r\n * @param name defines the name of the set\r\n */\r\n public constructor(name: string) {\r\n this.name = name;\r\n }\r\n\r\n /**\r\n * Gets the current class name of the node particle set e.g. \"NodeParticleSystemSet\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeParticleSystemSet\";\r\n }\r\n\r\n private _initializeBlock(node: NodeParticleBlock, autoConfigure = true) {\r\n if (this.attachedBlocks.indexOf(node) === -1) {\r\n this.attachedBlocks.push(node);\r\n }\r\n\r\n for (const input of node.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n this._initializeBlock(block, autoConfigure);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private BJSNODEPARTICLEEDITOR = this._getGlobalNodeParticleEditor();\r\n\r\n /** Get the editor from bundle or global\r\n * @returns the global NPE\r\n */\r\n private _getGlobalNodeParticleEditor(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof NODEPARTICLEEDITOR !== \"undefined\") {\r\n return NODEPARTICLEEDITOR;\r\n }\r\n\r\n // In case of module let's check the global emitted from the editor entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.NodeParticleEditor !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Creates the node editor window.\r\n * @param additionalConfig Define the configuration of the editor\r\n */\r\n private _createNodeParticleEditor(additionalConfig?: any) {\r\n const nodeEditorConfig: any = {\r\n nodeParticleSet: this,\r\n ...additionalConfig,\r\n };\r\n this.BJSNODEPARTICLEEDITOR.NodeParticleEditor.Show(nodeEditorConfig);\r\n }\r\n\r\n /**\r\n * Launch the node particle editor\r\n * @param config Define the configuration of the editor\r\n * @returns a promise fulfilled when the node editor is visible\r\n */\r\n public async editAsync(config?: INodeParticleEditorOptions): Promise<void> {\r\n return await new Promise((resolve) => {\r\n this.BJSNODEPARTICLEEDITOR = this.BJSNODEPARTICLEEDITOR || this._getGlobalNodeParticleEditor();\r\n if (typeof this.BJSNODEPARTICLEEDITOR == \"undefined\") {\r\n const editorUrl = config && config.editorURL ? config.editorURL : NodeParticleSystemSet.EditorURL;\r\n\r\n // Load editor and add it to the DOM\r\n Tools.LoadBabylonScript(editorUrl, () => {\r\n this.BJSNODEPARTICLEEDITOR = this.BJSNODEPARTICLEEDITOR || this._getGlobalNodeParticleEditor();\r\n this._createNodeParticleEditor(config?.nodeEditorConfig);\r\n resolve();\r\n });\r\n } else {\r\n // Otherwise creates the editor\r\n this._createNodeParticleEditor(config?.nodeEditorConfig);\r\n resolve();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Builds the particle system set from the defined blocks.\r\n * @param scene defines the hosting scene\r\n * @param verbose defines whether to log detailed information during the build process (false by default)\r\n * @returns a promise that resolves to the built particle system set\r\n */\r\n public async buildAsync(scene: Scene, verbose = false): Promise<ParticleSystemSet> {\r\n return await new Promise<ParticleSystemSet>((resolve) => {\r\n const output = new ParticleSystemSet();\r\n\r\n // Initialize all blocks\r\n for (const block of this._systemBlocks) {\r\n this._initializeBlock(block);\r\n }\r\n\r\n // Build the blocks\r\n for (const block of this.systemBlocks) {\r\n const state = new NodeParticleBuildState();\r\n state.buildId = this._buildId++;\r\n state.scene = scene;\r\n state.verbose = verbose;\r\n\r\n const system = block.createSystem(state);\r\n system._source = this;\r\n system._blockReference = block._internalId;\r\n\r\n // Errors\r\n state.emitErrors();\r\n\r\n output.systems.push(system);\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n\r\n resolve(output);\r\n });\r\n }\r\n\r\n /**\r\n * Clear the current node particle set\r\n */\r\n public clear() {\r\n this.attachedBlocks.length = 0;\r\n this._systemBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * Clear the current set and restore it to a default state\r\n */\r\n public setToDefault() {\r\n this.clear();\r\n\r\n this.editorData = null;\r\n\r\n // Main system\r\n const system = new SystemBlock(\"Particle system\");\r\n\r\n // Update position\r\n const updatePositionBlock = new UpdatePositionBlock(\"Update position\");\r\n updatePositionBlock.output.connectTo(system.particle);\r\n\r\n // Contextual inputs\r\n const positionBlock = new ParticleInputBlock(\"Position\");\r\n positionBlock.contextualValue = NodeParticleContextualSources.Position;\r\n const directionBlock = new ParticleInputBlock(\"Scaled direction\");\r\n directionBlock.contextualValue = NodeParticleContextualSources.ScaledDirection;\r\n\r\n // Add\r\n const addBlock = new ParticleMathBlock(\"Add\");\r\n addBlock.operation = ParticleMathBlockOperations.Add;\r\n positionBlock.output.connectTo(addBlock.left);\r\n directionBlock.output.connectTo(addBlock.right);\r\n addBlock.output.connectTo(updatePositionBlock.position);\r\n\r\n // Create particle\r\n const createParticleBlock = new CreateParticleBlock(\"Create particle\");\r\n\r\n // Shape\r\n const emitterShape = new BoxShapeBlock(\"Box shape\");\r\n createParticleBlock.particle.connectTo(emitterShape.particle);\r\n emitterShape.output.connectTo(updatePositionBlock.particle);\r\n\r\n // Texture\r\n const textureBlock = new ParticleTextureSourceBlock(\"Texture\");\r\n textureBlock.texture.connectTo(system.texture);\r\n textureBlock.url = Tools.GetAssetUrl(\"https://assets.babylonjs.com/core/textures/flare.png\");\r\n\r\n this._systemBlocks.push(system);\r\n }\r\n\r\n /**\r\n * Remove a block from the current system set\r\n * @param block defines the block to remove\r\n */\r\n public removeBlock(block: NodeParticleBlock) {\r\n const attachedBlockIndex = this.attachedBlocks.indexOf(block);\r\n if (attachedBlockIndex > -1) {\r\n this.attachedBlocks.splice(attachedBlockIndex, 1);\r\n }\r\n\r\n if (block.isSystem) {\r\n const index = this._systemBlocks.indexOf(block as SystemBlock);\r\n if (index > -1) {\r\n this._systemBlocks.splice(index, 1);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph and load a new one from a serialization object\r\n * @param source defines the JSON representation of the particle set\r\n * @param merge defines whether or not the source must be merged or replace the current content\r\n */\r\n public parseSerializedObject(source: any, merge = false) {\r\n if (!merge) {\r\n this.clear();\r\n }\r\n\r\n const map: { [key: number]: NodeParticleBlock } = {};\r\n\r\n // Create blocks\r\n for (const parsedBlock of source.blocks) {\r\n const blockType = GetClass(parsedBlock.customType);\r\n if (blockType) {\r\n const block: NodeParticleBlock = new blockType();\r\n block._deserialize(parsedBlock);\r\n map[parsedBlock.id] = block;\r\n\r\n this.attachedBlocks.push(block);\r\n\r\n if (block.isSystem) {\r\n this._systemBlocks.push(block as SystemBlock);\r\n }\r\n }\r\n }\r\n\r\n // Reconnect teleportation\r\n for (const block of this.attachedBlocks) {\r\n if (block.isTeleportOut) {\r\n const teleportOut = block as ParticleTeleportOutBlock;\r\n const id = teleportOut._tempEntryPointUniqueId;\r\n if (id) {\r\n const source = map[id] as ParticleTeleportInBlock;\r\n if (source) {\r\n source.attachToEndpoint(teleportOut);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Connections - Starts with input blocks only (except if in \"merge\" mode where we scan all blocks)\r\n for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\r\n const parsedBlock = source.blocks[blockIndex];\r\n const block = map[parsedBlock.id];\r\n\r\n if (!block) {\r\n continue;\r\n }\r\n\r\n if (block.inputs.length && parsedBlock.inputs.some((i: any) => i.targetConnectionName) && !merge) {\r\n continue;\r\n }\r\n this._restoreConnections(block, source, map);\r\n }\r\n\r\n // UI related info\r\n if (source.locations || (source.editorData && source.editorData.locations)) {\r\n const locations: {\r\n blockId: number;\r\n x: number;\r\n y: number;\r\n isCollapsed: boolean;\r\n }[] = source.locations || source.editorData.locations;\r\n\r\n for (const location of locations) {\r\n if (map[location.blockId]) {\r\n location.blockId = map[location.blockId].uniqueId;\r\n }\r\n }\r\n\r\n if (merge && this.editorData && this.editorData.locations) {\r\n locations.concat(this.editorData.locations);\r\n }\r\n\r\n if (source.locations) {\r\n this.editorData = {\r\n locations: locations,\r\n };\r\n } else {\r\n this.editorData = source.editorData;\r\n this.editorData.locations = locations;\r\n }\r\n\r\n const blockMap: { [key: number]: number } = {};\r\n\r\n for (const key in map) {\r\n blockMap[key] = map[key].uniqueId;\r\n }\r\n\r\n this.editorData.map = blockMap;\r\n }\r\n\r\n this.comment = source.comment;\r\n }\r\n\r\n private _restoreConnections(block: NodeParticleBlock, source: any, map: { [key: number]: NodeParticleBlock }) {\r\n for (const outputPoint of block.outputs) {\r\n for (const candidate of source.blocks) {\r\n const target = map[candidate.id];\r\n\r\n if (!target) {\r\n continue;\r\n }\r\n\r\n for (const input of candidate.inputs) {\r\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\r\n const inputPoint = target.getInputByName(input.inputName);\r\n if (!inputPoint || inputPoint.isConnected) {\r\n continue;\r\n }\r\n\r\n outputPoint.connectTo(inputPoint, true);\r\n this._restoreConnections(target, source, map);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Serializes this node particle set in a JSON representation\r\n * @param selectedBlocks defines the list of blocks to save (if null the whole node particle set will be saved)\r\n * @returns the serialized particle system set object\r\n */\r\n public serialize(selectedBlocks?: NodeParticleBlock[]): any {\r\n const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);\r\n serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy\r\n\r\n let blocks: NodeParticleBlock[] = [];\r\n\r\n if (selectedBlocks) {\r\n blocks = selectedBlocks;\r\n } else {\r\n serializationObject.customType = \"BABYLON.NodeParticleSystemSet\";\r\n }\r\n\r\n // Blocks\r\n serializationObject.blocks = [];\r\n\r\n for (const block of blocks) {\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n\r\n if (!selectedBlocks) {\r\n for (const block of this.attachedBlocks) {\r\n if (blocks.indexOf(block) !== -1) {\r\n continue;\r\n }\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current particle system set.\r\n * @param name defines the name to use for the new particle system set\r\n * @returns the cloned particle system set\r\n */\r\n public clone(name: string): NodeParticleSystemSet {\r\n const serializationObject = this.serialize();\r\n\r\n const clone = SerializationHelper.Clone(() => new NodeParticleSystemSet(name), this);\r\n clone.name = name;\r\n clone.snippetId = this.snippetId;\r\n\r\n clone.parseSerializedObject(serializationObject);\r\n clone._buildId = this._buildId;\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Disposes the resources\r\n */\r\n public dispose(): void {\r\n for (const block of this.attachedBlocks) {\r\n block.dispose();\r\n }\r\n\r\n this.attachedBlocks.length = 0;\r\n this.onBuildObservable.clear();\r\n }\r\n\r\n /**\r\n * Creates a new node particle set set to default basic configuration\r\n * @param name defines the name of the particle set\r\n * @returns a new NodeParticleSystemSet\r\n */\r\n public static CreateDefault(name: string) {\r\n const nodeParticleSet = new NodeParticleSystemSet(name);\r\n\r\n nodeParticleSet.setToDefault();\r\n\r\n return nodeParticleSet;\r\n }\r\n\r\n /**\r\n * Creates a node particle set from parsed data\r\n * @param source defines the JSON representation of the particle set\r\n * @returns a new node particle set\r\n */\r\n public static Parse(source: any): NodeParticleSystemSet {\r\n const nodeParticleSet = SerializationHelper.Parse(() => new NodeParticleSystemSet(source.name), source, null);\r\n\r\n nodeParticleSet.parseSerializedObject(source);\r\n\r\n return nodeParticleSet;\r\n }\r\n\r\n /**\r\n * Creates a node particle set from a snippet saved in a remote file\r\n * @param name defines the name of the node particle set to create\r\n * @param url defines the url to load from\r\n * @param nodeParticleSet defines a node particle set to update (instead of creating a new one)\r\n * @returns a promise that will resolve to the new node particle set\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n public static ParseFromFileAsync(name: string, url: string, nodeParticleSet?: NodeParticleSystemSet): Promise<NodeParticleSystemSet> {\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const serializationObject = JSON.parse(request.responseText);\r\n if (!nodeParticleSet) {\r\n nodeParticleSet = SerializationHelper.Parse(() => new NodeParticleSystemSet(name), serializationObject, null);\r\n }\r\n\r\n nodeParticleSet.parseSerializedObject(serializationObject);\r\n\r\n resolve(nodeParticleSet);\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(\"Unable to load the node particle system set\");\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", url);\r\n request.send();\r\n });\r\n }\r\n\r\n /**\r\n * Creates a node particle set from a snippet saved by the node particle editor\r\n * @param snippetId defines the snippet to load\r\n * @param nodeParticleSet defines a node particle set to update (instead of creating a new one)\r\n * @returns a promise that will resolve to the new node particle set\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n public static ParseFromSnippetAsync(snippetId: string, nodeParticleSet?: NodeParticleSystemSet): Promise<NodeParticleSystemSet> {\r\n if (snippetId === \"_BLANK\") {\r\n return Promise.resolve(NodeParticleSystemSet.CreateDefault(\"blank\"));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.nodeParticle);\r\n\r\n if (!nodeParticleSet) {\r\n nodeParticleSet = SerializationHelper.Parse(() => new NodeParticleSystemSet(snippetId), serializationObject, null);\r\n }\r\n\r\n nodeParticleSet.parseSerializedObject(serializationObject);\r\n nodeParticleSet.snippetId = snippetId;\r\n\r\n try {\r\n resolve(nodeParticleSet);\r\n } catch (err) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(err);\r\n }\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nodeParticleSystemSet.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleSystemSet.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iCAA6B;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,+CAA2C;AACzE,OAAO,EAAE,UAAU,EAAE,iCAA6B;AAClD,OAAO,EAAE,QAAQ,EAAE,gCAA4B;AAC/C,OAAO,EAAE,UAAU,EAAE,iCAA6B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GAAG,GAAG,KAAK,CAAC,cAAc,KAAK,cAAc,CAAC,OAAO,mDAAmD,AAAxG,CAAyG;AAEhI,sCAAsC;AACxB,gCAAU,GAAG,SAAS,CAAC,UAAU,AAAvB,CAAwB;AA2BzC;IADN,SAAS,EAAE;mDACQ;AAMb;IADN,SAAS,CAAC,SAAS,CAAC;sDACE","sourcesContent":["import { serialize } from \"core/Misc/decorators\";\r\nimport { ParticleSystemSet } from \"../particleSystemSet\";\r\nimport { SystemBlock } from \"./Blocks/systemBlock\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { NodeParticleBuildState } from \"./nodeParticleBuildState\";\r\nimport type { NodeParticleBlock } from \"./nodeParticleBlock\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { GetClass } from \"core/Misc/typeStore\";\r\nimport { WebRequest } from \"core/Misc/webRequest\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport { ParticleInputBlock } from \"./Blocks/particleInputBlock\";\r\nimport { ParticleTextureSourceBlock } from \"./Blocks/particleSourceTextureBlock\";\r\nimport { NodeParticleContextualSources } from \"./Enums/nodeParticleContextualSources\";\r\nimport { UpdatePositionBlock } from \"./Blocks/Update/updatePositionBlock\";\r\nimport { ParticleMathBlock, ParticleMathBlockOperations } from \"./Blocks/particleMathBlock\";\r\nimport type { ParticleTeleportOutBlock } from \"./Blocks/Teleport/particleTeleportOutBlock\";\r\nimport type { ParticleTeleportInBlock } from \"./Blocks/Teleport/particleTeleportInBlock\";\r\nimport { BoxShapeBlock } from \"./Blocks/Emitters/boxShapeBlock\";\r\nimport { CreateParticleBlock } from \"./Blocks/Emitters/createParticleBlock\";\r\nimport type { Color4 } from \"core/Maths/math.color\";\r\nimport type { Nullable } from \"../../types\";\r\n\r\n// declare NODEPARTICLEEDITOR namespace for compilation issue\r\ndeclare let NODEPARTICLEEDITOR: any;\r\ndeclare let BABYLON: any;\r\n\r\n/**\r\n * Interface used to configure the node particle editor\r\n */\r\nexport interface INodeParticleEditorOptions {\r\n /** Define the URL to load node editor script from */\r\n editorURL?: string;\r\n /** Additional configuration for the NPE */\r\n nodeEditorConfig?: {\r\n backgroundColor?: Color4;\r\n /** If true, the node particle system set will be disposed when the editor is closed (default: true) */\r\n disposeOnClose?: boolean;\r\n };\r\n}\r\n\r\n/**\r\n * Defines a set of particle systems defined as a node graph.\r\n * NPE: #K6F1ZB#1\r\n * PG: #ZT509U#1\r\n */\r\nexport class NodeParticleSystemSet {\r\n private _systemBlocks: SystemBlock[] = [];\r\n private _buildId: number = 0;\r\n\r\n /** Define the Url to load node editor script */\r\n public static EditorURL = `${Tools._DefaultCdnUrl}/v${AbstractEngine.Version}/nodeParticleEditor/babylon.nodeParticleEditor.js`;\r\n\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n /**\r\n * Snippet ID if the material was created from the snippet server\r\n */\r\n public snippetId: string;\r\n\r\n /**\r\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\r\n */\r\n public attachedBlocks: NodeParticleBlock[] = [];\r\n\r\n /**\r\n * Gets or sets data used by visual editor\r\n * @see https://npe.babylonjs.com\r\n */\r\n public editorData: any = null;\r\n\r\n /**\r\n * Observable raised when the particle set is built\r\n */\r\n public onBuildObservable = new Observable<NodeParticleSystemSet>();\r\n\r\n /**\r\n * The name of the set\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * A free comment about the set\r\n */\r\n @serialize(\"comment\")\r\n public comment: string;\r\n\r\n /**\r\n * Gets the system blocks\r\n */\r\n public get systemBlocks(): SystemBlock[] {\r\n return this._systemBlocks;\r\n }\r\n\r\n /**\r\n * Gets the list of input blocks attached to this material\r\n * @returns an array of InputBlocks\r\n */\r\n public get inputBlocks() {\r\n const blocks: ParticleInputBlock[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block.isInput) {\r\n blocks.push(block as ParticleInputBlock);\r\n }\r\n }\r\n\r\n return blocks;\r\n }\r\n\r\n /**\r\n * Get a block by its name\r\n * @param name defines the name of the block to retrieve\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByName(name: string) {\r\n let result = null;\r\n for (const block of this.attachedBlocks) {\r\n if (block.name === name) {\r\n if (!result) {\r\n result = block;\r\n } else {\r\n Tools.Warn(\"More than one block was found with the name `\" + name + \"`\");\r\n return result;\r\n }\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Get a block using a predicate\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required block or null if not found\r\n */\r\n public getBlockByPredicate(predicate: (block: NodeParticleBlock) => boolean) {\r\n for (const block of this.attachedBlocks) {\r\n if (predicate(block)) {\r\n return block;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Get an input block using a predicate\r\n * @param predicate defines the predicate used to find the good candidate\r\n * @returns the required input block or null if not found\r\n */\r\n public getInputBlockByPredicate(predicate: (block: ParticleInputBlock) => boolean): Nullable<ParticleInputBlock> {\r\n for (const block of this.attachedBlocks) {\r\n if (block.isInput && predicate(block as ParticleInputBlock)) {\r\n return block as ParticleInputBlock;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n /**\r\n * Creates a new set\r\n * @param name defines the name of the set\r\n */\r\n public constructor(name: string) {\r\n this.name = name;\r\n }\r\n\r\n /**\r\n * Gets the current class name of the node particle set e.g. \"NodeParticleSystemSet\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeParticleSystemSet\";\r\n }\r\n\r\n private _initializeBlock(node: NodeParticleBlock, autoConfigure = true) {\r\n if (this.attachedBlocks.indexOf(node) === -1) {\r\n this.attachedBlocks.push(node);\r\n }\r\n\r\n for (const input of node.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n this._initializeBlock(block, autoConfigure);\r\n }\r\n }\r\n }\r\n }\r\n\r\n private BJSNODEPARTICLEEDITOR = this._getGlobalNodeParticleEditor();\r\n\r\n /** Get the editor from bundle or global\r\n * @returns the global NPE\r\n */\r\n private _getGlobalNodeParticleEditor(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof NODEPARTICLEEDITOR !== \"undefined\") {\r\n return NODEPARTICLEEDITOR;\r\n }\r\n\r\n // In case of module let's check the global emitted from the editor entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.NodeParticleEditor !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Creates the node editor window.\r\n * @param additionalConfig Define the configuration of the editor\r\n */\r\n private _createNodeParticleEditor(additionalConfig?: any) {\r\n const nodeEditorConfig: any = {\r\n nodeParticleSet: this,\r\n ...additionalConfig,\r\n };\r\n this.BJSNODEPARTICLEEDITOR.NodeParticleEditor.Show(nodeEditorConfig);\r\n }\r\n\r\n /**\r\n * Launch the node particle editor\r\n * @param config Define the configuration of the editor\r\n * @returns a promise fulfilled when the node editor is visible\r\n */\r\n public async editAsync(config?: INodeParticleEditorOptions): Promise<void> {\r\n return await new Promise((resolve) => {\r\n this.BJSNODEPARTICLEEDITOR = this.BJSNODEPARTICLEEDITOR || this._getGlobalNodeParticleEditor();\r\n if (typeof this.BJSNODEPARTICLEEDITOR == \"undefined\") {\r\n const editorUrl = config && config.editorURL ? config.editorURL : NodeParticleSystemSet.EditorURL;\r\n\r\n // Load editor and add it to the DOM\r\n Tools.LoadBabylonScript(editorUrl, () => {\r\n this.BJSNODEPARTICLEEDITOR = this.BJSNODEPARTICLEEDITOR || this._getGlobalNodeParticleEditor();\r\n this._createNodeParticleEditor(config?.nodeEditorConfig);\r\n resolve();\r\n });\r\n } else {\r\n // Otherwise creates the editor\r\n this._createNodeParticleEditor(config?.nodeEditorConfig);\r\n resolve();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Builds the particle system set from the defined blocks.\r\n * @param scene defines the hosting scene\r\n * @param verbose defines whether to log detailed information during the build process (false by default)\r\n * @returns a promise that resolves to the built particle system set\r\n */\r\n public async buildAsync(scene: Scene, verbose = false): Promise<ParticleSystemSet> {\r\n return await new Promise<ParticleSystemSet>((resolve) => {\r\n const output = new ParticleSystemSet();\r\n\r\n // Initialize all blocks\r\n for (const block of this._systemBlocks) {\r\n this._initializeBlock(block);\r\n }\r\n\r\n // Build the blocks\r\n for (const block of this.systemBlocks) {\r\n const state = new NodeParticleBuildState();\r\n state.buildId = this._buildId++;\r\n state.scene = scene;\r\n state.verbose = verbose;\r\n\r\n const system = block.createSystem(state);\r\n system._source = this;\r\n system._blockReference = block._internalId;\r\n\r\n // Errors\r\n state.emitErrors();\r\n\r\n output.systems.push(system);\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n\r\n resolve(output);\r\n });\r\n }\r\n\r\n /**\r\n * Clear the current node particle set\r\n */\r\n public clear() {\r\n this.attachedBlocks.length = 0;\r\n this._systemBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * Clear the current set and restore it to a default state\r\n */\r\n public setToDefault() {\r\n this.clear();\r\n\r\n this.editorData = null;\r\n\r\n // Main system\r\n const system = new SystemBlock(\"Particle system\");\r\n\r\n // Update position\r\n const updatePositionBlock = new UpdatePositionBlock(\"Update position\");\r\n updatePositionBlock.output.connectTo(system.particle);\r\n\r\n // Contextual inputs\r\n const positionBlock = new ParticleInputBlock(\"Position\");\r\n positionBlock.contextualValue = NodeParticleContextualSources.Position;\r\n const directionBlock = new ParticleInputBlock(\"Scaled direction\");\r\n directionBlock.contextualValue = NodeParticleContextualSources.ScaledDirection;\r\n\r\n // Add\r\n const addBlock = new ParticleMathBlock(\"Add\");\r\n addBlock.operation = ParticleMathBlockOperations.Add;\r\n positionBlock.output.connectTo(addBlock.left);\r\n directionBlock.output.connectTo(addBlock.right);\r\n addBlock.output.connectTo(updatePositionBlock.position);\r\n\r\n // Create particle\r\n const createParticleBlock = new CreateParticleBlock(\"Create particle\");\r\n\r\n // Shape\r\n const emitterShape = new BoxShapeBlock(\"Box shape\");\r\n createParticleBlock.particle.connectTo(emitterShape.particle);\r\n emitterShape.output.connectTo(updatePositionBlock.particle);\r\n\r\n // Texture\r\n const textureBlock = new ParticleTextureSourceBlock(\"Texture\");\r\n textureBlock.texture.connectTo(system.texture);\r\n textureBlock.url = Tools.GetAssetUrl(\"https://assets.babylonjs.com/core/textures/flare.png\");\r\n\r\n this._systemBlocks.push(system);\r\n }\r\n\r\n /**\r\n * Remove a block from the current system set\r\n * @param block defines the block to remove\r\n */\r\n public removeBlock(block: NodeParticleBlock) {\r\n const attachedBlockIndex = this.attachedBlocks.indexOf(block);\r\n if (attachedBlockIndex > -1) {\r\n this.attachedBlocks.splice(attachedBlockIndex, 1);\r\n }\r\n\r\n if (block.isSystem) {\r\n const index = this._systemBlocks.indexOf(block as SystemBlock);\r\n if (index > -1) {\r\n this._systemBlocks.splice(index, 1);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph and load a new one from a serialization object\r\n * @param source defines the JSON representation of the particle set\r\n * @param merge defines whether or not the source must be merged or replace the current content\r\n */\r\n public parseSerializedObject(source: any, merge = false) {\r\n if (!merge) {\r\n this.clear();\r\n }\r\n\r\n const map: { [key: number]: NodeParticleBlock } = {};\r\n\r\n // Create blocks\r\n for (const parsedBlock of source.blocks) {\r\n const blockType = GetClass(parsedBlock.customType);\r\n if (blockType) {\r\n const block: NodeParticleBlock = new blockType();\r\n block._deserialize(parsedBlock);\r\n map[parsedBlock.id] = block;\r\n\r\n this.attachedBlocks.push(block);\r\n\r\n if (block.isSystem) {\r\n this._systemBlocks.push(block as SystemBlock);\r\n }\r\n }\r\n }\r\n\r\n // Reconnect teleportation\r\n for (const block of this.attachedBlocks) {\r\n if (block.isTeleportOut) {\r\n const teleportOut = block as ParticleTeleportOutBlock;\r\n const id = teleportOut._tempEntryPointUniqueId;\r\n if (id) {\r\n const source = map[id] as ParticleTeleportInBlock;\r\n if (source) {\r\n source.attachToEndpoint(teleportOut);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Connections - Starts with input blocks only (except if in \"merge\" mode where we scan all blocks)\r\n for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\r\n const parsedBlock = source.blocks[blockIndex];\r\n const block = map[parsedBlock.id];\r\n\r\n if (!block) {\r\n continue;\r\n }\r\n\r\n if (block.inputs.length && parsedBlock.inputs.some((i: any) => i.targetConnectionName) && !merge) {\r\n continue;\r\n }\r\n this._restoreConnections(block, source, map);\r\n }\r\n\r\n // UI related info\r\n if (source.locations || (source.editorData && source.editorData.locations)) {\r\n const locations: {\r\n blockId: number;\r\n x: number;\r\n y: number;\r\n isCollapsed: boolean;\r\n }[] = source.locations || source.editorData.locations;\r\n\r\n for (const location of locations) {\r\n if (map[location.blockId]) {\r\n location.blockId = map[location.blockId].uniqueId;\r\n }\r\n }\r\n\r\n if (merge && this.editorData && this.editorData.locations) {\r\n locations.concat(this.editorData.locations);\r\n }\r\n\r\n if (source.locations) {\r\n this.editorData = {\r\n locations: locations,\r\n };\r\n } else {\r\n this.editorData = source.editorData;\r\n this.editorData.locations = locations;\r\n }\r\n\r\n const blockMap: { [key: number]: number } = {};\r\n\r\n for (const key in map) {\r\n blockMap[key] = map[key].uniqueId;\r\n }\r\n\r\n this.editorData.map = blockMap;\r\n }\r\n\r\n this.comment = source.comment;\r\n }\r\n\r\n private _restoreConnections(block: NodeParticleBlock, source: any, map: { [key: number]: NodeParticleBlock }) {\r\n for (const outputPoint of block.outputs) {\r\n for (const candidate of source.blocks) {\r\n const target = map[candidate.id];\r\n\r\n if (!target) {\r\n continue;\r\n }\r\n\r\n for (const input of candidate.inputs) {\r\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\r\n const inputPoint = target.getInputByName(input.inputName);\r\n if (!inputPoint || inputPoint.isConnected) {\r\n continue;\r\n }\r\n\r\n outputPoint.connectTo(inputPoint, true);\r\n this._restoreConnections(target, source, map);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Serializes this node particle set in a JSON representation\r\n * @param selectedBlocks defines the list of blocks to save (if null the whole node particle set will be saved)\r\n * @returns the serialized particle system set object\r\n */\r\n public serialize(selectedBlocks?: NodeParticleBlock[]): any {\r\n const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);\r\n serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy\r\n\r\n let blocks: NodeParticleBlock[] = [];\r\n\r\n if (selectedBlocks) {\r\n blocks = selectedBlocks;\r\n } else {\r\n serializationObject.customType = \"BABYLON.NodeParticleSystemSet\";\r\n }\r\n\r\n // Blocks\r\n serializationObject.blocks = [];\r\n\r\n for (const block of blocks) {\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n\r\n if (!selectedBlocks) {\r\n for (const block of this.attachedBlocks) {\r\n if (blocks.indexOf(block) !== -1) {\r\n continue;\r\n }\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the current particle system set.\r\n * @param name defines the name to use for the new particle system set\r\n * @returns the cloned particle system set\r\n */\r\n public clone(name: string): NodeParticleSystemSet {\r\n const serializationObject = this.serialize();\r\n\r\n const clone = SerializationHelper.Clone(() => new NodeParticleSystemSet(name), this);\r\n clone.name = name;\r\n clone.snippetId = this.snippetId;\r\n\r\n clone.parseSerializedObject(serializationObject);\r\n clone._buildId = this._buildId;\r\n\r\n return clone;\r\n }\r\n\r\n /**\r\n * Disposes the resources\r\n */\r\n public dispose(): void {\r\n for (const block of this.attachedBlocks) {\r\n block.dispose();\r\n }\r\n\r\n this.attachedBlocks.length = 0;\r\n this.onBuildObservable.clear();\r\n }\r\n\r\n /**\r\n * Creates a new node particle set set to default basic configuration\r\n * @param name defines the name of the particle set\r\n * @returns a new NodeParticleSystemSet\r\n */\r\n public static CreateDefault(name: string) {\r\n const nodeParticleSet = new NodeParticleSystemSet(name);\r\n\r\n nodeParticleSet.setToDefault();\r\n\r\n return nodeParticleSet;\r\n }\r\n\r\n /**\r\n * Creates a node particle set from parsed data\r\n * @param source defines the JSON representation of the particle set\r\n * @returns a new node particle set\r\n */\r\n public static Parse(source: any): NodeParticleSystemSet {\r\n const nodeParticleSet = SerializationHelper.Parse(() => new NodeParticleSystemSet(source.name), source, null);\r\n\r\n nodeParticleSet.parseSerializedObject(source);\r\n\r\n return nodeParticleSet;\r\n }\r\n\r\n /**\r\n * Creates a node particle set from a snippet saved in a remote file\r\n * @param name defines the name of the node particle set to create\r\n * @param url defines the url to load from\r\n * @param nodeParticleSet defines a node particle set to update (instead of creating a new one)\r\n * @returns a promise that will resolve to the new node particle set\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n public static ParseFromFileAsync(name: string, url: string, nodeParticleSet?: NodeParticleSystemSet): Promise<NodeParticleSystemSet> {\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const serializationObject = JSON.parse(request.responseText);\r\n if (!nodeParticleSet) {\r\n nodeParticleSet = SerializationHelper.Parse(() => new NodeParticleSystemSet(name), serializationObject, null);\r\n }\r\n\r\n nodeParticleSet.parseSerializedObject(serializationObject);\r\n\r\n resolve(nodeParticleSet);\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(\"Unable to load the node particle system set\");\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", url);\r\n request.send();\r\n });\r\n }\r\n\r\n /**\r\n * Creates a node particle set from a snippet saved by the node particle editor\r\n * @param snippetId defines the snippet to load\r\n * @param nodeParticleSet defines a node particle set to update (instead of creating a new one)\r\n * @returns a promise that will resolve to the new node particle set\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n public static ParseFromSnippetAsync(snippetId: string, nodeParticleSet?: NodeParticleSystemSet): Promise<NodeParticleSystemSet> {\r\n if (snippetId === \"_BLANK\") {\r\n return Promise.resolve(NodeParticleSystemSet.CreateDefault(\"blank\"));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.nodeParticle);\r\n\r\n if (!nodeParticleSet) {\r\n nodeParticleSet = SerializationHelper.Parse(() => new NodeParticleSystemSet(snippetId), serializationObject, null);\r\n }\r\n\r\n nodeParticleSet.parseSerializedObject(serializationObject);\r\n nodeParticleSet.snippetId = snippetId;\r\n\r\n try {\r\n resolve(nodeParticleSet);\r\n } catch (err) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(err);\r\n }\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -367,6 +367,7 @@ export interface IPhysicsEnginePluginV2 {
|
|
|
367
367
|
applyImpulse(body: PhysicsBody, impulse: Vector3, location: Vector3, instanceIndex?: number): void;
|
|
368
368
|
applyAngularImpulse(body: PhysicsBody, angularImpulse: Vector3, instanceIndex?: number): void;
|
|
369
369
|
applyForce(body: PhysicsBody, force: Vector3, location: Vector3, instanceIndex?: number): void;
|
|
370
|
+
applyTorque(body: PhysicsBody, torque: Vector3, instanceIndex?: number): void;
|
|
370
371
|
setAngularVelocity(body: PhysicsBody, angVel: Vector3, instanceIndex?: number): void;
|
|
371
372
|
getAngularVelocityToRef(body: PhysicsBody, angVel: Vector3, instanceIndex?: number): void;
|
|
372
373
|
getBodyGeometry(body: PhysicsBody): object;
|