@babylonjs/core 7.3.3 → 7.5.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.d.ts +11 -12
- package/Engines/abstractEngine.js +7 -7
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +2 -2
- package/Engines/thinEngine.functions.d.ts +2 -0
- package/Engines/thinEngine.functions.js +1 -1
- package/Engines/thinEngine.functions.js.map +1 -1
- package/Engines/thinEngine.js +9 -10
- package/Engines/thinEngine.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +25 -14
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +1 -2
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterial.js +7 -3
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/Node/Blocks/modBlock.js +7 -1
- package/Materials/Node/Blocks/modBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +2 -4
- package/Materials/Node/nodeMaterial.js +1 -3
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +1 -2
- package/Materials/PBR/pbrBaseMaterial.js +1 -2
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/effect.d.ts +4 -0
- package/Materials/effect.functions.js +2 -0
- package/Materials/effect.functions.js.map +1 -1
- package/Materials/effect.js.map +1 -1
- package/Materials/effect.webgl.functions.js +1 -1
- package/Materials/effect.webgl.functions.js.map +1 -1
- package/Materials/imageProcessingConfiguration.d.ts +5 -0
- package/Materials/imageProcessingConfiguration.defines.d.ts +2 -4
- package/Materials/imageProcessingConfiguration.defines.js +1 -2
- package/Materials/imageProcessingConfiguration.defines.js.map +1 -1
- package/Materials/imageProcessingConfiguration.js +23 -11
- package/Materials/imageProcessingConfiguration.js.map +1 -1
- package/Materials/meshDebugPluginMaterial.js +2 -2
- package/Materials/meshDebugPluginMaterial.js.map +1 -1
- package/Materials/standardMaterial.d.ts +1 -2
- package/Materials/standardMaterial.js +1 -2
- package/Materials/standardMaterial.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +6 -0
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Misc/fileTools.d.ts +6 -0
- package/Misc/fileTools.js +4 -3
- package/Misc/fileTools.js.map +1 -1
- package/Misc/greasedLineTools.js +7 -1
- package/Misc/greasedLineTools.js.map +1 -1
- package/Misc/sceneSerializer.js +9 -1
- package/Misc/sceneSerializer.js.map +1 -1
- package/Misc/textureTools.d.ts +2 -0
- package/Misc/textureTools.js +2 -0
- package/Misc/textureTools.js.map +1 -1
- package/Misc/tools.d.ts +0 -6
- package/Misc/tools.js +0 -9
- package/Misc/tools.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.js +14 -5
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/Rendering/GlobalIllumination/giRSMManager.d.ts +6 -0
- package/Rendering/GlobalIllumination/giRSMManager.js +15 -1
- package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
- package/Rendering/renderingGroup.js +1 -1
- package/Rendering/renderingGroup.js.map +1 -1
- package/Shaders/ShadersInclude/imageProcessingFunctions.js +8 -5
- package/Shaders/ShadersInclude/imageProcessingFunctions.js.map +1 -1
- package/Shaders/lod.fragment.d.ts +5 -0
- package/Shaders/lod.fragment.js +12 -0
- package/Shaders/lod.fragment.js.map +1 -0
- package/Shaders/lodCube.fragment.d.ts +5 -0
- package/Shaders/lodCube.fragment.js +30 -0
- package/Shaders/lodCube.fragment.js.map +1 -0
- package/package.json +1 -1
|
@@ -329,6 +329,12 @@ export class NodeGeometryConnectionPoint {
|
|
|
329
329
|
serializationObject.inputName = this.name;
|
|
330
330
|
serializationObject.targetBlockId = this.connectedPoint.ownerBlock.uniqueId;
|
|
331
331
|
serializationObject.targetConnectionName = this.connectedPoint.name;
|
|
332
|
+
serializationObject.isExposedOnFrame = true;
|
|
333
|
+
serializationObject.exposedPortPosition = this.exposedPortPosition;
|
|
334
|
+
}
|
|
335
|
+
if (this.isExposedOnFrame || this.exposedPortPosition >= 0) {
|
|
336
|
+
serializationObject.isExposedOnFrame = true;
|
|
337
|
+
serializationObject.exposedPortPosition = this.exposedPortPosition;
|
|
332
338
|
}
|
|
333
339
|
return serializationObject;
|
|
334
340
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeGeometryBlockConnectionPoint.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/nodeGeometryBlockConnectionPoint.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,qCAAqC,EAAE,MAAM,0CAA0C,CAAC;AAIjG;;GAEG;AACH,MAAM,CAAN,IAAY,8CAOX;AAPD,WAAY,8CAA8C;IACtD,6BAA6B;IAC7B,+HAAU,CAAA;IACV,qDAAqD;IACrD,2IAAgB,CAAA;IAChB,sEAAsE;IACtE,uIAAc,CAAA;AAClB,CAAC,EAPW,8CAA8C,KAA9C,8CAA8C,QAOzD;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,oCAKX;AALD,WAAY,oCAAoC;IAC5C,YAAY;IACZ,iGAAK,CAAA;IACL,aAAa;IACb,mGAAM,CAAA;AACV,CAAC,EALW,oCAAoC,KAApC,oCAAoC,QAK/C;AAED;;GAEG;AACH,MAAM,OAAO,2BAA2B;IA0BpC,sCAAsC;IACtC,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAoDD;;OAEG;IACH,IAAW,IAAI;QACX,IAAI,IAAI,CAAC,KAAK,KAAK,qCAAqC,CAAC,UAAU,EAAE;YACjE,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;gBAC1B,OAAQ,IAAI,CAAC,WAAkC,CAAC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AC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;IAC3C,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { NodeGeometryBlock } from \"./nodeGeometryBlock\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"./Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { GeometryInputBlock } from \"./Blocks/geometryInputBlock\";\r\nimport type { NodeGeometryBuildState } from \"./nodeGeometryBuildState\";\r\n\r\n/**\r\n * Enum used to define the compatibility state between two connection points\r\n */\r\nexport enum NodeGeometryConnectionPointCompatibilityStates {\r\n /** Points are compatibles */\r\n Compatible,\r\n /** Points are incompatible because of their types */\r\n TypeIncompatible,\r\n /** Points are incompatible because they are in the same hierarchy **/\r\n HierarchyIssue,\r\n}\r\n\r\n/**\r\n * Defines the direction of a connection point\r\n */\r\nexport enum NodeGeometryConnectionPointDirection {\r\n /** Input */\r\n Input,\r\n /** Output */\r\n Output,\r\n}\r\n\r\n/**\r\n * Defines a connection point for a block\r\n */\r\nexport class NodeGeometryConnectionPoint {\r\n /** @internal */\r\n public _ownerBlock: NodeGeometryBlock;\r\n /** @internal */\r\n public _connectedPoint: Nullable<NodeGeometryConnectionPoint> = null;\r\n /** @internal */\r\n public _storedValue: any = null;\r\n /** @internal */\r\n public _storedFunction: Nullable<(state: NodeGeometryBuildState) => any> = null;\r\n\r\n /** @internal */\r\n public _acceptedConnectionPointType: Nullable<NodeGeometryConnectionPoint> = null;\r\n\r\n private _endpoints = new Array<NodeGeometryConnectionPoint>();\r\n private _direction: NodeGeometryConnectionPointDirection;\r\n private _type = NodeGeometryBlockConnectionPointTypes.Geometry;\r\n\r\n /** @internal */\r\n public _linkedConnectionSource: Nullable<NodeGeometryConnectionPoint> = null;\r\n\r\n /** @internal */\r\n public _typeConnectionSource: Nullable<NodeGeometryConnectionPoint> = null;\r\n\r\n /** @internal */\r\n public _defaultConnectionPointType: Nullable<NodeGeometryBlockConnectionPointTypes> = null;\r\n\r\n /** Gets the direction of the point */\r\n public get direction() {\r\n return this._direction;\r\n }\r\n\r\n /**\r\n * Gets or sets the additional types supported by this connection point\r\n */\r\n public acceptedConnectionPointTypes: NodeGeometryBlockConnectionPointTypes[] = [];\r\n\r\n /**\r\n * Gets or sets the additional types excluded by this connection point\r\n */\r\n public excludedConnectionPointTypes: NodeGeometryBlockConnectionPointTypes[] = [];\r\n\r\n /**\r\n * Observable triggered when this point is connected\r\n */\r\n public onConnectionObservable = new Observable<NodeGeometryConnectionPoint>();\r\n\r\n /**\r\n * Observable triggered when this point is disconnected\r\n */\r\n public onDisconnectionObservable = new Observable<NodeGeometryConnectionPoint>();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this connection point is exposed on a frame\r\n */\r\n public isExposedOnFrame: boolean = false;\r\n\r\n /**\r\n * Gets or sets number indicating the position that the port is exposed to on a frame\r\n */\r\n public exposedPortPosition: number = -1;\r\n\r\n /**\r\n * Gets the default value used for this point at creation time\r\n */\r\n public defaultValue: Nullable<any> = null;\r\n\r\n /**\r\n * Gets or sets the default value used for this point if nothing is connected\r\n */\r\n public value: Nullable<any> = null;\r\n\r\n /**\r\n * Gets or sets the min value accepted for this point if nothing is connected\r\n */\r\n public valueMin: Nullable<any> = null;\r\n\r\n /**\r\n * Gets or sets the max value accepted for this point if nothing is connected\r\n */\r\n public valueMax: Nullable<any> = null;\r\n\r\n /**\r\n * Gets or sets the connection point type (default is float)\r\n */\r\n public get type(): NodeGeometryBlockConnectionPointTypes {\r\n if (this._type === NodeGeometryBlockConnectionPointTypes.AutoDetect) {\r\n if (this._ownerBlock.isInput) {\r\n return (this._ownerBlock as GeometryInputBlock).type;\r\n }\r\n\r\n if (this._connectedPoint) {\r\n return this._connectedPoint.type;\r\n }\r\n\r\n if (this._linkedConnectionSource && this._linkedConnectionSource.isConnected) {\r\n return this._linkedConnectionSource.type;\r\n }\r\n }\r\n\r\n if (this._type === NodeGeometryBlockConnectionPointTypes.BasedOnInput) {\r\n if (this._typeConnectionSource) {\r\n if (!this._typeConnectionSource.isConnected && this._defaultConnectionPointType) {\r\n return this._defaultConnectionPointType;\r\n }\r\n return this._typeConnectionSource.type;\r\n } else if (this._defaultConnectionPointType) {\r\n return this._defaultConnectionPointType;\r\n }\r\n }\r\n\r\n return this._type;\r\n }\r\n\r\n public set type(value: NodeGeometryBlockConnectionPointTypes) {\r\n this._type = value;\r\n }\r\n\r\n /**\r\n * Gets or sets the connection point name\r\n */\r\n public name: string;\r\n\r\n /**\r\n * Gets or sets the connection point display name\r\n */\r\n public displayName: string;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this connection point can be omitted\r\n */\r\n public isOptional: boolean;\r\n\r\n /**\r\n * Gets a boolean indicating that the current point is connected to another NodeMaterialBlock\r\n */\r\n public get isConnected(): boolean {\r\n return this.connectedPoint !== null || this.hasEndpoints;\r\n }\r\n\r\n /** Get the other side of the connection (if any) */\r\n public get connectedPoint(): Nullable<NodeGeometryConnectionPoint> {\r\n return this._connectedPoint;\r\n }\r\n\r\n /** Get the block that owns this connection point */\r\n public get ownerBlock(): NodeGeometryBlock {\r\n return this._ownerBlock;\r\n }\r\n\r\n /** Get the block connected on the other side of this connection (if any) */\r\n public get sourceBlock(): Nullable<NodeGeometryBlock> {\r\n if (!this._connectedPoint) {\r\n return null;\r\n }\r\n\r\n return this._connectedPoint.ownerBlock;\r\n }\r\n\r\n /** Get the block connected on the endpoints of this connection (if any) */\r\n public get connectedBlocks(): Array<NodeGeometryBlock> {\r\n if (this._endpoints.length === 0) {\r\n return [];\r\n }\r\n\r\n return this._endpoints.map((e) => e.ownerBlock);\r\n }\r\n\r\n /** Gets the list of connected endpoints */\r\n public get endpoints() {\r\n return this._endpoints;\r\n }\r\n\r\n /** Gets a boolean indicating if that output point is connected to at least one input */\r\n public get hasEndpoints(): boolean {\r\n return this._endpoints && this._endpoints.length > 0;\r\n }\r\n\r\n /** Get the inner type (ie AutoDetect for instance instead of the inferred one) */\r\n public get innerType() {\r\n if (this._linkedConnectionSource && this._linkedConnectionSource.isConnected) {\r\n return this.type;\r\n }\r\n return this._type;\r\n }\r\n\r\n /** @internal */\r\n public _callCount = 0;\r\n\r\n /** @internal */\r\n public _executionCount = 0;\r\n\r\n /** @internal */\r\n public _resetCounters() {\r\n this._callCount = 0;\r\n this._executionCount = 0;\r\n }\r\n\r\n /**\r\n * Gets the number of times this point was called\r\n */\r\n public get callCount() {\r\n return this._callCount;\r\n }\r\n\r\n /**\r\n * Gets the number of times this point was executed\r\n */\r\n public get executionCount() {\r\n return this._executionCount;\r\n }\r\n\r\n /**\r\n * Gets the value represented by this connection point\r\n * @param state current evaluation state\r\n * @returns the connected value or the value if nothing is connected\r\n */\r\n public getConnectedValue(state: NodeGeometryBuildState) {\r\n if (this.isConnected) {\r\n if (this._connectedPoint?._storedFunction) {\r\n this._connectedPoint!._callCount++;\r\n this._connectedPoint!._executionCount++;\r\n return this._connectedPoint!._storedFunction(state);\r\n }\r\n this._connectedPoint!._callCount++;\r\n this._connectedPoint!._executionCount = 1;\r\n return this._connectedPoint!._storedValue;\r\n }\r\n this._callCount++;\r\n this._executionCount = 1;\r\n return this.value;\r\n }\r\n\r\n /**\r\n * Creates a new connection point\r\n * @param name defines the connection point name\r\n * @param ownerBlock defines the block hosting this connection point\r\n * @param direction defines the direction of the connection point\r\n */\r\n public constructor(name: string, ownerBlock: NodeGeometryBlock, direction: NodeGeometryConnectionPointDirection) {\r\n this._ownerBlock = ownerBlock;\r\n this.name = name;\r\n this._direction = direction;\r\n }\r\n\r\n /**\r\n * Gets the current class name e.g. \"NodeMaterialConnectionPoint\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeGeometryConnectionPoint\";\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the current point can be connected to another point\r\n * @param connectionPoint defines the other connection point\r\n * @returns a boolean\r\n */\r\n public canConnectTo(connectionPoint: NodeGeometryConnectionPoint) {\r\n return this.checkCompatibilityState(connectionPoint) === NodeGeometryConnectionPointCompatibilityStates.Compatible;\r\n }\r\n\r\n /**\r\n * Gets a number indicating if the current point can be connected to another point\r\n * @param connectionPoint defines the other connection point\r\n * @returns a number defining the compatibility state\r\n */\r\n public checkCompatibilityState(connectionPoint: NodeGeometryConnectionPoint): NodeGeometryConnectionPointCompatibilityStates {\r\n const ownerBlock = this._ownerBlock;\r\n const otherBlock = connectionPoint.ownerBlock;\r\n\r\n if (this.type !== connectionPoint.type && connectionPoint.innerType !== NodeGeometryBlockConnectionPointTypes.AutoDetect) {\r\n // Accepted types\r\n if (connectionPoint.acceptedConnectionPointTypes && connectionPoint.acceptedConnectionPointTypes.indexOf(this.type) !== -1) {\r\n return NodeGeometryConnectionPointCompatibilityStates.Compatible;\r\n } else {\r\n return NodeGeometryConnectionPointCompatibilityStates.TypeIncompatible;\r\n }\r\n }\r\n\r\n // Excluded\r\n if (connectionPoint.excludedConnectionPointTypes && connectionPoint.excludedConnectionPointTypes.indexOf(this.type) !== -1) {\r\n return NodeGeometryConnectionPointCompatibilityStates.TypeIncompatible;\r\n }\r\n\r\n // Check hierarchy\r\n let targetBlock = otherBlock;\r\n let sourceBlock = ownerBlock;\r\n if (this.direction === NodeGeometryConnectionPointDirection.Input) {\r\n targetBlock = ownerBlock;\r\n sourceBlock = otherBlock;\r\n }\r\n\r\n if (targetBlock.isAnAncestorOf(sourceBlock)) {\r\n return NodeGeometryConnectionPointCompatibilityStates.HierarchyIssue;\r\n }\r\n\r\n return NodeGeometryConnectionPointCompatibilityStates.Compatible;\r\n }\r\n\r\n /**\r\n * Connect this point to another connection point\r\n * @param connectionPoint defines the other connection point\r\n * @param ignoreConstraints defines if the system will ignore connection type constraints (default is false)\r\n * @returns the current connection point\r\n */\r\n public connectTo(connectionPoint: NodeGeometryConnectionPoint, ignoreConstraints = false): NodeGeometryConnectionPoint {\r\n if (!ignoreConstraints && !this.canConnectTo(connectionPoint)) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Cannot connect these two connectors.\";\r\n }\r\n\r\n this._endpoints.push(connectionPoint);\r\n connectionPoint._connectedPoint = this;\r\n\r\n this.onConnectionObservable.notifyObservers(connectionPoint);\r\n connectionPoint.onConnectionObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disconnect this point from one of his endpoint\r\n * @param endpoint defines the other connection point\r\n * @returns the current connection point\r\n */\r\n public disconnectFrom(endpoint: NodeGeometryConnectionPoint): NodeGeometryConnectionPoint {\r\n const index = this._endpoints.indexOf(endpoint);\r\n\r\n if (index === -1) {\r\n return this;\r\n }\r\n\r\n this._endpoints.splice(index, 1);\r\n endpoint._connectedPoint = null;\r\n\r\n this.onDisconnectionObservable.notifyObservers(endpoint);\r\n endpoint.onDisconnectionObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Fill the list of excluded connection point types with all types other than those passed in the parameter\r\n * @param mask Types (ORed values of NodeMaterialBlockConnectionPointTypes) that are allowed, and thus will not be pushed to the excluded list\r\n */\r\n public addExcludedConnectionPointFromAllowedTypes(mask: number): void {\r\n let bitmask = 1;\r\n while (bitmask < NodeGeometryBlockConnectionPointTypes.All) {\r\n if (!(mask & bitmask)) {\r\n this.excludedConnectionPointTypes.push(bitmask);\r\n }\r\n bitmask = bitmask << 1;\r\n }\r\n }\r\n\r\n /**\r\n * Serializes this point in a JSON representation\r\n * @param isInput defines if the connection point is an input (default is true)\r\n * @returns the serialized point object\r\n */\r\n public serialize(isInput = true): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.name = this.name;\r\n serializationObject.displayName = this.displayName;\r\n if (this.value !== undefined && this.value !== null) {\r\n if (this.value.asArray) {\r\n serializationObject.valueType = \"BABYLON.\" + this.value.getClassName();\r\n serializationObject.value = this.value.asArray();\r\n } else {\r\n serializationObject.valueType = \"number\";\r\n serializationObject.value = this.value;\r\n }\r\n }\r\n\r\n if (isInput && this.connectedPoint) {\r\n serializationObject.inputName = this.name;\r\n serializationObject.targetBlockId = this.connectedPoint.ownerBlock.uniqueId;\r\n serializationObject.targetConnectionName = this.connectedPoint.name;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public dispose() {\r\n this.onConnectionObservable.clear();\r\n this.onDisconnectionObservable.clear();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nodeGeometryBlockConnectionPoint.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/Node/nodeGeometryBlockConnectionPoint.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,qCAAqC,EAAE,MAAM,0CAA0C,CAAC;AAIjG;;GAEG;AACH,MAAM,CAAN,IAAY,8CAOX;AAPD,WAAY,8CAA8C;IACtD,6BAA6B;IAC7B,+HAAU,CAAA;IACV,qDAAqD;IACrD,2IAAgB,CAAA;IAChB,sEAAsE;IACtE,uIAAc,CAAA;AAClB,CAAC,EAPW,8CAA8C,KAA9C,8CAA8C,QAOzD;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,oCAKX;AALD,WAAY,oCAAoC;IAC5C,YAAY;IACZ,iGAAK,CAAA;IACL,aAAa;IACb,mGAAM,CAAA;AACV,CAAC,EALW,oCAAoC,KAApC,oCAAoC,QAK/C;AAED;;GAEG;AACH,MAAM,OAAO,2BAA2B;IA0BpC,sCAAsC;IACtC,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAoDD;;OAEG;IACH,IAAW,IAAI;QACX,IAAI,IAAI,CAAC,KAAK,KAAK,qCAAqC,CAAC,UAAU,EAAE;YACjE,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;gBAC1B,OAAQ,IAAI,CAAC,WAAkC,CAAC,IAAI,CAAC;aACxD;YAED,IAAI,IAAI,CAAC,eAAe,EAAE;gBACtB,OAAO,IAAI,CAAC,eAAe,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AAC,EAAE;YACxD,mBAAmB,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC5C,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC;SACtE;QAED,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,sBAAsB,CAAC,KAAK,EAAE,CAAC;QACpC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;IAC3C,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { NodeGeometryBlock } from \"./nodeGeometryBlock\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { NodeGeometryBlockConnectionPointTypes } from \"./Enums/nodeGeometryConnectionPointTypes\";\r\nimport type { GeometryInputBlock } from \"./Blocks/geometryInputBlock\";\r\nimport type { NodeGeometryBuildState } from \"./nodeGeometryBuildState\";\r\n\r\n/**\r\n * Enum used to define the compatibility state between two connection points\r\n */\r\nexport enum NodeGeometryConnectionPointCompatibilityStates {\r\n /** Points are compatibles */\r\n Compatible,\r\n /** Points are incompatible because of their types */\r\n TypeIncompatible,\r\n /** Points are incompatible because they are in the same hierarchy **/\r\n HierarchyIssue,\r\n}\r\n\r\n/**\r\n * Defines the direction of a connection point\r\n */\r\nexport enum NodeGeometryConnectionPointDirection {\r\n /** Input */\r\n Input,\r\n /** Output */\r\n Output,\r\n}\r\n\r\n/**\r\n * Defines a connection point for a block\r\n */\r\nexport class NodeGeometryConnectionPoint {\r\n /** @internal */\r\n public _ownerBlock: NodeGeometryBlock;\r\n /** @internal */\r\n public _connectedPoint: Nullable<NodeGeometryConnectionPoint> = null;\r\n /** @internal */\r\n public _storedValue: any = null;\r\n /** @internal */\r\n public _storedFunction: Nullable<(state: NodeGeometryBuildState) => any> = null;\r\n\r\n /** @internal */\r\n public _acceptedConnectionPointType: Nullable<NodeGeometryConnectionPoint> = null;\r\n\r\n private _endpoints = new Array<NodeGeometryConnectionPoint>();\r\n private _direction: NodeGeometryConnectionPointDirection;\r\n private _type = NodeGeometryBlockConnectionPointTypes.Geometry;\r\n\r\n /** @internal */\r\n public _linkedConnectionSource: Nullable<NodeGeometryConnectionPoint> = null;\r\n\r\n /** @internal */\r\n public _typeConnectionSource: Nullable<NodeGeometryConnectionPoint> = null;\r\n\r\n /** @internal */\r\n public _defaultConnectionPointType: Nullable<NodeGeometryBlockConnectionPointTypes> = null;\r\n\r\n /** Gets the direction of the point */\r\n public get direction() {\r\n return this._direction;\r\n }\r\n\r\n /**\r\n * Gets or sets the additional types supported by this connection point\r\n */\r\n public acceptedConnectionPointTypes: NodeGeometryBlockConnectionPointTypes[] = [];\r\n\r\n /**\r\n * Gets or sets the additional types excluded by this connection point\r\n */\r\n public excludedConnectionPointTypes: NodeGeometryBlockConnectionPointTypes[] = [];\r\n\r\n /**\r\n * Observable triggered when this point is connected\r\n */\r\n public onConnectionObservable = new Observable<NodeGeometryConnectionPoint>();\r\n\r\n /**\r\n * Observable triggered when this point is disconnected\r\n */\r\n public onDisconnectionObservable = new Observable<NodeGeometryConnectionPoint>();\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this connection point is exposed on a frame\r\n */\r\n public isExposedOnFrame: boolean = false;\r\n\r\n /**\r\n * Gets or sets number indicating the position that the port is exposed to on a frame\r\n */\r\n public exposedPortPosition: number = -1;\r\n\r\n /**\r\n * Gets the default value used for this point at creation time\r\n */\r\n public defaultValue: Nullable<any> = null;\r\n\r\n /**\r\n * Gets or sets the default value used for this point if nothing is connected\r\n */\r\n public value: Nullable<any> = null;\r\n\r\n /**\r\n * Gets or sets the min value accepted for this point if nothing is connected\r\n */\r\n public valueMin: Nullable<any> = null;\r\n\r\n /**\r\n * Gets or sets the max value accepted for this point if nothing is connected\r\n */\r\n public valueMax: Nullable<any> = null;\r\n\r\n /**\r\n * Gets or sets the connection point type (default is float)\r\n */\r\n public get type(): NodeGeometryBlockConnectionPointTypes {\r\n if (this._type === NodeGeometryBlockConnectionPointTypes.AutoDetect) {\r\n if (this._ownerBlock.isInput) {\r\n return (this._ownerBlock as GeometryInputBlock).type;\r\n }\r\n\r\n if (this._connectedPoint) {\r\n return this._connectedPoint.type;\r\n }\r\n\r\n if (this._linkedConnectionSource && this._linkedConnectionSource.isConnected) {\r\n return this._linkedConnectionSource.type;\r\n }\r\n }\r\n\r\n if (this._type === NodeGeometryBlockConnectionPointTypes.BasedOnInput) {\r\n if (this._typeConnectionSource) {\r\n if (!this._typeConnectionSource.isConnected && this._defaultConnectionPointType) {\r\n return this._defaultConnectionPointType;\r\n }\r\n return this._typeConnectionSource.type;\r\n } else if (this._defaultConnectionPointType) {\r\n return this._defaultConnectionPointType;\r\n }\r\n }\r\n\r\n return this._type;\r\n }\r\n\r\n public set type(value: NodeGeometryBlockConnectionPointTypes) {\r\n this._type = value;\r\n }\r\n\r\n /**\r\n * Gets or sets the connection point name\r\n */\r\n public name: string;\r\n\r\n /**\r\n * Gets or sets the connection point display name\r\n */\r\n public displayName: string;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that this connection point can be omitted\r\n */\r\n public isOptional: boolean;\r\n\r\n /**\r\n * Gets a boolean indicating that the current point is connected to another NodeMaterialBlock\r\n */\r\n public get isConnected(): boolean {\r\n return this.connectedPoint !== null || this.hasEndpoints;\r\n }\r\n\r\n /** Get the other side of the connection (if any) */\r\n public get connectedPoint(): Nullable<NodeGeometryConnectionPoint> {\r\n return this._connectedPoint;\r\n }\r\n\r\n /** Get the block that owns this connection point */\r\n public get ownerBlock(): NodeGeometryBlock {\r\n return this._ownerBlock;\r\n }\r\n\r\n /** Get the block connected on the other side of this connection (if any) */\r\n public get sourceBlock(): Nullable<NodeGeometryBlock> {\r\n if (!this._connectedPoint) {\r\n return null;\r\n }\r\n\r\n return this._connectedPoint.ownerBlock;\r\n }\r\n\r\n /** Get the block connected on the endpoints of this connection (if any) */\r\n public get connectedBlocks(): Array<NodeGeometryBlock> {\r\n if (this._endpoints.length === 0) {\r\n return [];\r\n }\r\n\r\n return this._endpoints.map((e) => e.ownerBlock);\r\n }\r\n\r\n /** Gets the list of connected endpoints */\r\n public get endpoints() {\r\n return this._endpoints;\r\n }\r\n\r\n /** Gets a boolean indicating if that output point is connected to at least one input */\r\n public get hasEndpoints(): boolean {\r\n return this._endpoints && this._endpoints.length > 0;\r\n }\r\n\r\n /** Get the inner type (ie AutoDetect for instance instead of the inferred one) */\r\n public get innerType() {\r\n if (this._linkedConnectionSource && this._linkedConnectionSource.isConnected) {\r\n return this.type;\r\n }\r\n return this._type;\r\n }\r\n\r\n /** @internal */\r\n public _callCount = 0;\r\n\r\n /** @internal */\r\n public _executionCount = 0;\r\n\r\n /** @internal */\r\n public _resetCounters() {\r\n this._callCount = 0;\r\n this._executionCount = 0;\r\n }\r\n\r\n /**\r\n * Gets the number of times this point was called\r\n */\r\n public get callCount() {\r\n return this._callCount;\r\n }\r\n\r\n /**\r\n * Gets the number of times this point was executed\r\n */\r\n public get executionCount() {\r\n return this._executionCount;\r\n }\r\n\r\n /**\r\n * Gets the value represented by this connection point\r\n * @param state current evaluation state\r\n * @returns the connected value or the value if nothing is connected\r\n */\r\n public getConnectedValue(state: NodeGeometryBuildState) {\r\n if (this.isConnected) {\r\n if (this._connectedPoint?._storedFunction) {\r\n this._connectedPoint!._callCount++;\r\n this._connectedPoint!._executionCount++;\r\n return this._connectedPoint!._storedFunction(state);\r\n }\r\n this._connectedPoint!._callCount++;\r\n this._connectedPoint!._executionCount = 1;\r\n return this._connectedPoint!._storedValue;\r\n }\r\n this._callCount++;\r\n this._executionCount = 1;\r\n return this.value;\r\n }\r\n\r\n /**\r\n * Creates a new connection point\r\n * @param name defines the connection point name\r\n * @param ownerBlock defines the block hosting this connection point\r\n * @param direction defines the direction of the connection point\r\n */\r\n public constructor(name: string, ownerBlock: NodeGeometryBlock, direction: NodeGeometryConnectionPointDirection) {\r\n this._ownerBlock = ownerBlock;\r\n this.name = name;\r\n this._direction = direction;\r\n }\r\n\r\n /**\r\n * Gets the current class name e.g. \"NodeMaterialConnectionPoint\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeGeometryConnectionPoint\";\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the current point can be connected to another point\r\n * @param connectionPoint defines the other connection point\r\n * @returns a boolean\r\n */\r\n public canConnectTo(connectionPoint: NodeGeometryConnectionPoint) {\r\n return this.checkCompatibilityState(connectionPoint) === NodeGeometryConnectionPointCompatibilityStates.Compatible;\r\n }\r\n\r\n /**\r\n * Gets a number indicating if the current point can be connected to another point\r\n * @param connectionPoint defines the other connection point\r\n * @returns a number defining the compatibility state\r\n */\r\n public checkCompatibilityState(connectionPoint: NodeGeometryConnectionPoint): NodeGeometryConnectionPointCompatibilityStates {\r\n const ownerBlock = this._ownerBlock;\r\n const otherBlock = connectionPoint.ownerBlock;\r\n\r\n if (this.type !== connectionPoint.type && connectionPoint.innerType !== NodeGeometryBlockConnectionPointTypes.AutoDetect) {\r\n // Accepted types\r\n if (connectionPoint.acceptedConnectionPointTypes && connectionPoint.acceptedConnectionPointTypes.indexOf(this.type) !== -1) {\r\n return NodeGeometryConnectionPointCompatibilityStates.Compatible;\r\n } else {\r\n return NodeGeometryConnectionPointCompatibilityStates.TypeIncompatible;\r\n }\r\n }\r\n\r\n // Excluded\r\n if (connectionPoint.excludedConnectionPointTypes && connectionPoint.excludedConnectionPointTypes.indexOf(this.type) !== -1) {\r\n return NodeGeometryConnectionPointCompatibilityStates.TypeIncompatible;\r\n }\r\n\r\n // Check hierarchy\r\n let targetBlock = otherBlock;\r\n let sourceBlock = ownerBlock;\r\n if (this.direction === NodeGeometryConnectionPointDirection.Input) {\r\n targetBlock = ownerBlock;\r\n sourceBlock = otherBlock;\r\n }\r\n\r\n if (targetBlock.isAnAncestorOf(sourceBlock)) {\r\n return NodeGeometryConnectionPointCompatibilityStates.HierarchyIssue;\r\n }\r\n\r\n return NodeGeometryConnectionPointCompatibilityStates.Compatible;\r\n }\r\n\r\n /**\r\n * Connect this point to another connection point\r\n * @param connectionPoint defines the other connection point\r\n * @param ignoreConstraints defines if the system will ignore connection type constraints (default is false)\r\n * @returns the current connection point\r\n */\r\n public connectTo(connectionPoint: NodeGeometryConnectionPoint, ignoreConstraints = false): NodeGeometryConnectionPoint {\r\n if (!ignoreConstraints && !this.canConnectTo(connectionPoint)) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Cannot connect these two connectors.\";\r\n }\r\n\r\n this._endpoints.push(connectionPoint);\r\n connectionPoint._connectedPoint = this;\r\n\r\n this.onConnectionObservable.notifyObservers(connectionPoint);\r\n connectionPoint.onConnectionObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Disconnect this point from one of his endpoint\r\n * @param endpoint defines the other connection point\r\n * @returns the current connection point\r\n */\r\n public disconnectFrom(endpoint: NodeGeometryConnectionPoint): NodeGeometryConnectionPoint {\r\n const index = this._endpoints.indexOf(endpoint);\r\n\r\n if (index === -1) {\r\n return this;\r\n }\r\n\r\n this._endpoints.splice(index, 1);\r\n endpoint._connectedPoint = null;\r\n\r\n this.onDisconnectionObservable.notifyObservers(endpoint);\r\n endpoint.onDisconnectionObservable.notifyObservers(this);\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Fill the list of excluded connection point types with all types other than those passed in the parameter\r\n * @param mask Types (ORed values of NodeMaterialBlockConnectionPointTypes) that are allowed, and thus will not be pushed to the excluded list\r\n */\r\n public addExcludedConnectionPointFromAllowedTypes(mask: number): void {\r\n let bitmask = 1;\r\n while (bitmask < NodeGeometryBlockConnectionPointTypes.All) {\r\n if (!(mask & bitmask)) {\r\n this.excludedConnectionPointTypes.push(bitmask);\r\n }\r\n bitmask = bitmask << 1;\r\n }\r\n }\r\n\r\n /**\r\n * Serializes this point in a JSON representation\r\n * @param isInput defines if the connection point is an input (default is true)\r\n * @returns the serialized point object\r\n */\r\n public serialize(isInput = true): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.name = this.name;\r\n serializationObject.displayName = this.displayName;\r\n if (this.value !== undefined && this.value !== null) {\r\n if (this.value.asArray) {\r\n serializationObject.valueType = \"BABYLON.\" + this.value.getClassName();\r\n serializationObject.value = this.value.asArray();\r\n } else {\r\n serializationObject.valueType = \"number\";\r\n serializationObject.value = this.value;\r\n }\r\n }\r\n\r\n if (isInput && this.connectedPoint) {\r\n serializationObject.inputName = this.name;\r\n serializationObject.targetBlockId = this.connectedPoint.ownerBlock.uniqueId;\r\n serializationObject.targetConnectionName = this.connectedPoint.name;\r\n serializationObject.isExposedOnFrame = true;\r\n serializationObject.exposedPortPosition = this.exposedPortPosition;\r\n }\r\n\r\n if (this.isExposedOnFrame || this.exposedPortPosition >= 0) {\r\n serializationObject.isExposedOnFrame = true;\r\n serializationObject.exposedPortPosition = this.exposedPortPosition;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Release resources\r\n */\r\n public dispose() {\r\n this.onConnectionObservable.clear();\r\n this.onDisconnectionObservable.clear();\r\n }\r\n}\r\n"]}
|
package/Misc/fileTools.d.ts
CHANGED
|
@@ -45,6 +45,12 @@ export declare const FileToolsOptions: {
|
|
|
45
45
|
ScriptBaseUrl: string;
|
|
46
46
|
ScriptPreprocessUrl: (url: string) => string;
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* Removes unwanted characters from an url
|
|
50
|
+
* @param url defines the url to clean
|
|
51
|
+
* @returns the cleaned url
|
|
52
|
+
*/
|
|
53
|
+
export declare let CleanUrl: (url: string) => string;
|
|
48
54
|
/**
|
|
49
55
|
* Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.
|
|
50
56
|
* @param url define the url we are trying
|
package/Misc/fileTools.js
CHANGED
|
@@ -104,7 +104,8 @@ export const FileToolsOptions = {
|
|
|
104
104
|
* @param url defines the url to clean
|
|
105
105
|
* @returns the cleaned url
|
|
106
106
|
*/
|
|
107
|
-
|
|
107
|
+
// eslint-disable-next-line prefer-const
|
|
108
|
+
export let CleanUrl = (url) => {
|
|
108
109
|
url = url.replace(/#/gm, "%23");
|
|
109
110
|
return url;
|
|
110
111
|
};
|
|
@@ -163,7 +164,7 @@ export const LoadImage = (input, onLoad, onError, offlineProvider, mimeType = ""
|
|
|
163
164
|
usingObjectURL = true;
|
|
164
165
|
}
|
|
165
166
|
else {
|
|
166
|
-
url =
|
|
167
|
+
url = CleanUrl(input);
|
|
167
168
|
url = FileToolsOptions.PreprocessUrl(input);
|
|
168
169
|
}
|
|
169
170
|
const onErrorHandler = (exception) => {
|
|
@@ -407,7 +408,7 @@ export const LoadFile = (fileOrUrl, onSuccess, onProgress, offlineProvider, useA
|
|
|
407
408
|
* @internal
|
|
408
409
|
*/
|
|
409
410
|
export const RequestFile = (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError, onOpened) => {
|
|
410
|
-
url =
|
|
411
|
+
url = CleanUrl(url);
|
|
411
412
|
url = FileToolsOptions.PreprocessUrl(url);
|
|
412
413
|
const loadUrl = FileToolsOptions.BaseUrl + url;
|
|
413
414
|
let aborted = false;
|
package/Misc/fileTools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileTools.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/fileTools.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAItD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uC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CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { WebRequest } from \"./webRequest\";\r\nimport { IsWindowObjectExist } from \"./domManagement\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { IOfflineProvider } from \"../Offline/IOfflineProvider\";\r\nimport type { IFileRequest } from \"./fileRequest\";\r\nimport { Observable } from \"./observable\";\r\nimport { FilesInputStore } from \"./filesInputStore\";\r\nimport { RetryStrategy } from \"./retryStrategy\";\r\nimport { BaseError, ErrorCodes, RuntimeError } from \"./error\";\r\nimport { DecodeBase64ToBinary, DecodeBase64ToString, EncodeArrayBufferToBase64 } from \"./stringTools\";\r\nimport { _functionContainer } from \"../Engines/Processors/shaderProcessor\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { Logger } from \"./logger\";\r\nimport { TimingTools } from \"./timingTools\";\r\nimport type { INative } from \"../Engines/Native/nativeInterfaces\";\r\nimport { EngineFunctionContext } from \"core/Engines/abstractEngine.functions\";\r\nimport { AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\nconst Base64DataUrlRegEx = new RegExp(/^data:([^,]+\\/[^,]+)?;base64,/i);\r\ndeclare const _native: INative;\r\n\r\n/** @ignore */\r\nexport class LoadFileError extends RuntimeError {\r\n public request?: WebRequest;\r\n public file?: File;\r\n\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param object defines the optional web request\r\n */\r\n constructor(message: string, object?: WebRequest | File) {\r\n super(message, ErrorCodes.LoadFileError);\r\n\r\n this.name = \"LoadFileError\";\r\n BaseError._setPrototypeOf(this, LoadFileError.prototype);\r\n\r\n if (object instanceof WebRequest) {\r\n this.request = object;\r\n } else {\r\n this.file = object;\r\n }\r\n }\r\n}\r\n\r\n/** @ignore */\r\nexport class RequestFileError extends RuntimeError {\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param request defines the optional web request\r\n */\r\n constructor(\r\n message: string,\r\n public request: WebRequest\r\n ) {\r\n super(message, ErrorCodes.RequestFileError);\r\n this.name = \"RequestFileError\";\r\n BaseError._setPrototypeOf(this, RequestFileError.prototype);\r\n }\r\n}\r\n\r\n/** @ignore */\r\nexport class ReadFileError extends RuntimeError {\r\n /**\r\n * Creates a new ReadFileError\r\n * @param message defines the message of the error\r\n * @param file defines the optional file\r\n */\r\n constructor(\r\n message: string,\r\n public file: File\r\n ) {\r\n super(message, ErrorCodes.ReadFileError);\r\n this.name = \"ReadFileError\";\r\n BaseError._setPrototypeOf(this, ReadFileError.prototype);\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport const FileToolsOptions: {\r\n DefaultRetryStrategy: (url: string, request: WebRequest, retryIndex: number) => number;\r\n BaseUrl: string;\r\n CorsBehavior: string | ((url: string | string[]) => string);\r\n PreprocessUrl: (url: string) => string;\r\n ScriptBaseUrl: string;\r\n ScriptPreprocessUrl: (url: string) => string;\r\n} = {\r\n /**\r\n * Gets or sets the retry strategy to apply when an error happens while loading an asset.\r\n * When defining this function, return the wait time before trying again or return -1 to\r\n * stop retrying and error out.\r\n */\r\n DefaultRetryStrategy: RetryStrategy.ExponentialBackoff(),\r\n\r\n /**\r\n * Gets or sets the base URL to use to load assets\r\n */\r\n BaseUrl: \"\",\r\n\r\n /**\r\n * Default behaviour for cors in the application.\r\n * It can be a string if the expected behavior is identical in the entire app.\r\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\r\n */\r\n CorsBehavior: \"anonymous\",\r\n\r\n /**\r\n * Gets or sets a function used to pre-process url before using them to load assets\r\n * @param url\r\n * @returns the processed url\r\n */\r\n PreprocessUrl: (url: string) => url,\r\n\r\n /**\r\n * Gets or sets the base URL to use to load scripts\r\n * Used for both JS and WASM\r\n */\r\n ScriptBaseUrl: \"\",\r\n /**\r\n * Gets or sets a function used to pre-process script url before using them to load.\r\n * Used for both JS and WASM\r\n * @param url defines the url to process\r\n * @returns the processed url\r\n */\r\n ScriptPreprocessUrl: (url: string) => url,\r\n};\r\n\r\n/**\r\n * Removes unwanted characters from an url\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\nconst _CleanUrl = (url: string): string => {\r\n url = url.replace(/#/gm, \"%23\");\r\n return url;\r\n};\r\n\r\n/**\r\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\r\n * @param url define the url we are trying\r\n * @param element define the dom element where to configure the cors policy\r\n * @internal\r\n */\r\nexport const SetCorsBehavior = (url: string | string[], element: { crossOrigin: string | null }): void => {\r\n if (url && url.indexOf(\"data:\") === 0) {\r\n return;\r\n }\r\n\r\n if (FileToolsOptions.CorsBehavior) {\r\n if (typeof FileToolsOptions.CorsBehavior === \"string\" || FileToolsOptions.CorsBehavior instanceof String) {\r\n element.crossOrigin = <string>FileToolsOptions.CorsBehavior;\r\n } else {\r\n const result = FileToolsOptions.CorsBehavior(url);\r\n if (result) {\r\n element.crossOrigin = result;\r\n }\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @param mimeType optional mime type\r\n * @param imageBitmapOptions\r\n * @returns the HTMLImageElement of the loaded image\r\n * @internal\r\n */\r\nexport const LoadImage = (\r\n input: string | ArrayBuffer | ArrayBufferView | Blob,\r\n onLoad: (img: HTMLImageElement | ImageBitmap) => void,\r\n onError: (message?: string, exception?: any) => void,\r\n offlineProvider: Nullable<IOfflineProvider>,\r\n mimeType: string = \"\",\r\n imageBitmapOptions?: ImageBitmapOptions\r\n): Nullable<HTMLImageElement> => {\r\n const engine = EngineStore.LastCreatedEngine;\r\n if (typeof HTMLImageElement === \"undefined\" && !engine?._features.forceBitmapOverHTMLImageElement) {\r\n onError(\"LoadImage is only supported in web or BabylonNative environments.\");\r\n return null;\r\n }\r\n\r\n let url: string;\r\n let usingObjectURL = false;\r\n\r\n if (input instanceof ArrayBuffer || ArrayBuffer.isView(input)) {\r\n if (typeof Blob !== \"undefined\" && typeof URL !== \"undefined\") {\r\n url = URL.createObjectURL(new Blob([input], { type: mimeType }));\r\n usingObjectURL = true;\r\n } else {\r\n url = `data:${mimeType};base64,` + EncodeArrayBufferToBase64(input);\r\n }\r\n } else if (input instanceof Blob) {\r\n url = URL.createObjectURL(input);\r\n usingObjectURL = true;\r\n } else {\r\n url = _CleanUrl(input);\r\n url = FileToolsOptions.PreprocessUrl(input);\r\n }\r\n\r\n const onErrorHandler = (exception: any) => {\r\n if (onError) {\r\n const inputText = url || input.toString();\r\n onError(`Error while trying to load image: ${inputText.indexOf(\"http\") === 0 || inputText.length <= 128 ? inputText : inputText.slice(0, 128) + \"...\"}`, exception);\r\n }\r\n };\r\n\r\n if (engine?._features.forceBitmapOverHTMLImageElement) {\r\n LoadFile(\r\n url,\r\n (data) => {\r\n engine!\r\n .createImageBitmap(new Blob([data], { type: mimeType }), { premultiplyAlpha: \"none\", ...imageBitmapOptions })\r\n .then((imgBmp) => {\r\n onLoad(imgBmp);\r\n if (usingObjectURL) {\r\n URL.revokeObjectURL(url);\r\n }\r\n })\r\n .catch((reason) => {\r\n if (onError) {\r\n onError(\"Error while trying to load image: \" + input, reason);\r\n }\r\n });\r\n },\r\n undefined,\r\n offlineProvider || undefined,\r\n true,\r\n (request, exception) => {\r\n onErrorHandler(exception);\r\n }\r\n );\r\n\r\n return null;\r\n }\r\n\r\n const img = new Image();\r\n SetCorsBehavior(url, img);\r\n\r\n const handlersList: { target: any; name: string; handler: any }[] = [];\r\n\r\n const loadHandlersList = () => {\r\n handlersList.forEach((handler) => {\r\n handler.target.addEventListener(handler.name, handler.handler);\r\n });\r\n };\r\n\r\n const unloadHandlersList = () => {\r\n handlersList.forEach((handler) => {\r\n handler.target.removeEventListener(handler.name, handler.handler);\r\n });\r\n handlersList.length = 0;\r\n };\r\n\r\n const loadHandler = () => {\r\n unloadHandlersList();\r\n\r\n onLoad(img);\r\n\r\n // Must revoke the URL after calling onLoad to avoid security exceptions in\r\n // certain scenarios (e.g. when hosted in vscode).\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n\r\n const errorHandler = (err: any) => {\r\n unloadHandlersList();\r\n\r\n onErrorHandler(err);\r\n\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n\r\n const cspHandler = (err: any) => {\r\n if (err.blockedURI !== img.src) {\r\n return;\r\n }\r\n\r\n unloadHandlersList();\r\n const cspException = new Error(`CSP violation of policy ${err.effectiveDirective} ${err.blockedURI}. Current policy is ${err.originalPolicy}`);\r\n\r\n EngineStore.UseFallbackTexture = false;\r\n onErrorHandler(cspException);\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n img.src = \"\";\r\n };\r\n\r\n handlersList.push({ target: img, name: \"load\", handler: loadHandler });\r\n handlersList.push({ target: img, name: \"error\", handler: errorHandler });\r\n handlersList.push({ target: document, name: \"securitypolicyviolation\", handler: cspHandler });\r\n\r\n loadHandlersList();\r\n\r\n const fromBlob = url.substring(0, 5) === \"blob:\";\r\n const fromData = url.substring(0, 5) === \"data:\";\r\n const noOfflineSupport = () => {\r\n if (fromBlob || fromData || !WebRequest.IsCustomRequestAvailable) {\r\n img.src = url;\r\n } else {\r\n LoadFile(\r\n url,\r\n (data, _, contentType) => {\r\n const type = !mimeType && contentType ? contentType : mimeType;\r\n const blob = new Blob([data], { type });\r\n const url = URL.createObjectURL(blob);\r\n usingObjectURL = true;\r\n img.src = url;\r\n },\r\n undefined,\r\n offlineProvider || undefined,\r\n true,\r\n (_request, exception) => {\r\n onErrorHandler(exception);\r\n }\r\n );\r\n }\r\n };\r\n\r\n const loadFromOfflineSupport = () => {\r\n if (offlineProvider) {\r\n offlineProvider.loadImage(url, img);\r\n }\r\n };\r\n\r\n if (!fromBlob && !fromData && offlineProvider && offlineProvider.enableTexturesOffline) {\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\r\n } else {\r\n if (url.indexOf(\"file:\") !== -1) {\r\n const textureName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (FilesInputStore.FilesToLoad[textureName] && typeof URL !== \"undefined\") {\r\n try {\r\n let blobURL;\r\n try {\r\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\r\n } catch (ex) {\r\n // Chrome doesn't support oneTimeOnly parameter\r\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\r\n }\r\n img.src = blobURL;\r\n usingObjectURL = true;\r\n } catch (e) {\r\n img.src = \"\";\r\n }\r\n return img;\r\n }\r\n }\r\n\r\n noOfflineSupport();\r\n }\r\n\r\n return img;\r\n};\r\n\r\n/**\r\n * Reads a file from a File object\r\n * @param file defines the file to load\r\n * @param onSuccess defines the callback to call when data is loaded\r\n * @param onProgress defines the callback to call during loading process\r\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\r\n * @param onError defines the callback to call when an error occurs\r\n * @returns a file request object\r\n * @internal\r\n */\r\nexport const ReadFile = (\r\n file: File,\r\n onSuccess: (data: any) => void,\r\n onProgress?: (ev: ProgressEvent) => any,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: ReadFileError) => void\r\n): IFileRequest => {\r\n const reader = new FileReader();\r\n const fileRequest: IFileRequest = {\r\n onCompleteObservable: new Observable<IFileRequest>(),\r\n abort: () => reader.abort(),\r\n };\r\n\r\n reader.onloadend = () => fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n if (onError) {\r\n reader.onerror = () => {\r\n onError(new ReadFileError(`Unable to read ${file.name}`, file));\r\n };\r\n }\r\n reader.onload = (e) => {\r\n //target doesn't have result from ts 1.3\r\n onSuccess((<any>e.target)[\"result\"]);\r\n };\r\n if (onProgress) {\r\n reader.onprogress = onProgress;\r\n }\r\n if (!useArrayBuffer) {\r\n // Asynchronous read\r\n reader.readAsText(file);\r\n } else {\r\n reader.readAsArrayBuffer(file);\r\n }\r\n\r\n return fileRequest;\r\n};\r\n\r\n/**\r\n * Loads a file from a url, a data url, or a file url\r\n * @param fileOrUrl file, url, data url, or file url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param onOpened\r\n * @returns a file request object\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const LoadFile = (\r\n fileOrUrl: File | string,\r\n onSuccess: (data: string | ArrayBuffer, responseURL?: string, contentType?: Nullable<string>) => void,\r\n onProgress?: (ev: ProgressEvent) => void,\r\n offlineProvider?: IOfflineProvider,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n): IFileRequest => {\r\n if ((fileOrUrl as File).name) {\r\n return ReadFile(\r\n fileOrUrl as File,\r\n onSuccess,\r\n onProgress,\r\n useArrayBuffer,\r\n onError\r\n ? (error: ReadFileError) => {\r\n onError(undefined, error);\r\n }\r\n : undefined\r\n );\r\n }\r\n\r\n const url = fileOrUrl as string;\r\n\r\n // If file and file input are set\r\n if (url.indexOf(\"file:\") !== -1) {\r\n let fileName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (fileName.indexOf(\"./\") === 0) {\r\n fileName = fileName.substring(2);\r\n }\r\n const file = FilesInputStore.FilesToLoad[fileName];\r\n if (file) {\r\n return ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError ? (error) => onError(undefined, new LoadFileError(error.message, error.file)) : undefined);\r\n }\r\n }\r\n\r\n // For a Base64 Data URL\r\n const { match, type } = TestBase64DataUrl(url);\r\n if (match) {\r\n const fileRequest: IFileRequest = {\r\n onCompleteObservable: new Observable<IFileRequest>(),\r\n abort: () => () => {},\r\n };\r\n\r\n try {\r\n const data = useArrayBuffer ? DecodeBase64UrlToBinary(url) : DecodeBase64UrlToString(url);\r\n onSuccess(data, undefined, type);\r\n } catch (error) {\r\n if (onError) {\r\n onError(undefined, error);\r\n } else {\r\n Logger.Error(error.message || \"Failed to parse the Data URL\");\r\n }\r\n }\r\n\r\n TimingTools.SetImmediate(() => {\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n });\r\n\r\n return fileRequest;\r\n }\r\n\r\n return RequestFile(\r\n url,\r\n (data, request) => {\r\n onSuccess(data, request?.responseURL, request?.getResponseHeader(\"content-type\"));\r\n },\r\n onProgress,\r\n offlineProvider,\r\n useArrayBuffer,\r\n onError\r\n ? (error) => {\r\n onError(error.request, new LoadFileError(error.message, error.request));\r\n }\r\n : undefined,\r\n onOpened\r\n );\r\n};\r\n\r\n/**\r\n * Loads a file from a url\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param onOpened callback called when the web request is opened\r\n * @returns a file request object\r\n * @internal\r\n */\r\nexport const RequestFile = (\r\n url: string,\r\n onSuccess?: (data: string | ArrayBuffer, request?: WebRequest) => void,\r\n onProgress?: (event: ProgressEvent) => void,\r\n offlineProvider?: IOfflineProvider,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: RequestFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n): IFileRequest => {\r\n url = _CleanUrl(url);\r\n url = FileToolsOptions.PreprocessUrl(url);\r\n\r\n const loadUrl = FileToolsOptions.BaseUrl + url;\r\n\r\n let aborted = false;\r\n const fileRequest: IFileRequest = {\r\n onCompleteObservable: new Observable<IFileRequest>(),\r\n abort: () => (aborted = true),\r\n };\r\n\r\n const requestFile = () => {\r\n let request: Nullable<WebRequest> = new WebRequest();\r\n let retryHandle: Nullable<ReturnType<typeof setTimeout>> = null;\r\n let onReadyStateChange: Nullable<() => void>;\r\n\r\n const unbindEvents = () => {\r\n if (!request) {\r\n return;\r\n }\r\n\r\n if (onProgress) {\r\n request.removeEventListener(\"progress\", onProgress);\r\n }\r\n if (onReadyStateChange) {\r\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\r\n }\r\n request.removeEventListener(\"loadend\", onLoadEnd!);\r\n };\r\n\r\n let onLoadEnd: Nullable<() => void> = () => {\r\n unbindEvents();\r\n\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n fileRequest.onCompleteObservable.clear();\r\n\r\n onProgress = undefined;\r\n onReadyStateChange = null;\r\n onLoadEnd = null;\r\n onError = undefined;\r\n onOpened = undefined;\r\n onSuccess = undefined;\r\n };\r\n\r\n fileRequest.abort = () => {\r\n aborted = true;\r\n\r\n if (onLoadEnd) {\r\n onLoadEnd();\r\n }\r\n\r\n if (request && request.readyState !== (XMLHttpRequest.DONE || 4)) {\r\n request.abort();\r\n }\r\n\r\n if (retryHandle !== null) {\r\n clearTimeout(retryHandle);\r\n retryHandle = null;\r\n }\r\n\r\n request = null;\r\n };\r\n\r\n const handleError = (error: any) => {\r\n const message = error.message || \"Unknown error\";\r\n if (onError && request) {\r\n onError(new RequestFileError(message, request));\r\n } else {\r\n Logger.Error(message);\r\n }\r\n };\r\n\r\n const retryLoop = (retryIndex: number) => {\r\n if (!request) {\r\n return;\r\n }\r\n request.open(\"GET\", loadUrl);\r\n\r\n if (onOpened) {\r\n try {\r\n onOpened(request);\r\n } catch (e) {\r\n handleError(e);\r\n return;\r\n }\r\n }\r\n\r\n if (useArrayBuffer) {\r\n request.responseType = \"arraybuffer\";\r\n }\r\n\r\n if (onProgress) {\r\n request.addEventListener(\"progress\", onProgress);\r\n }\r\n\r\n if (onLoadEnd) {\r\n request.addEventListener(\"loadend\", onLoadEnd);\r\n }\r\n\r\n onReadyStateChange = () => {\r\n if (aborted || !request) {\r\n return;\r\n }\r\n\r\n // In case of undefined state in some browsers.\r\n if (request.readyState === (XMLHttpRequest.DONE || 4)) {\r\n // Some browsers have issues where onreadystatechange can be called multiple times with the same value.\r\n if (onReadyStateChange) {\r\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\r\n }\r\n\r\n if ((request.status >= 200 && request.status < 300) || (request.status === 0 && (!IsWindowObjectExist() || IsFileURL()))) {\r\n try {\r\n if (onSuccess) {\r\n onSuccess(useArrayBuffer ? request.response : request.responseText, request);\r\n }\r\n } catch (e) {\r\n handleError(e);\r\n }\r\n return;\r\n }\r\n\r\n const retryStrategy = FileToolsOptions.DefaultRetryStrategy;\r\n if (retryStrategy) {\r\n const waitTime = retryStrategy(loadUrl, request, retryIndex);\r\n if (waitTime !== -1) {\r\n // Prevent the request from completing for retry.\r\n unbindEvents();\r\n\r\n request = new WebRequest();\r\n retryHandle = setTimeout(() => retryLoop(retryIndex + 1), waitTime);\r\n return;\r\n }\r\n }\r\n\r\n const error = new RequestFileError(\"Error status: \" + request.status + \" \" + request.statusText + \" - Unable to load \" + loadUrl, request);\r\n if (onError) {\r\n onError(error);\r\n }\r\n }\r\n };\r\n\r\n request.addEventListener(\"readystatechange\", onReadyStateChange);\r\n\r\n request.send();\r\n };\r\n\r\n retryLoop(0);\r\n };\r\n\r\n // Caching all files\r\n if (offlineProvider && offlineProvider.enableSceneOffline) {\r\n const noOfflineSupport = (request?: any) => {\r\n if (request && request.status > 400) {\r\n if (onError) {\r\n onError(request);\r\n }\r\n } else {\r\n requestFile();\r\n }\r\n };\r\n\r\n const loadFromOfflineSupport = () => {\r\n // TODO: database needs to support aborting and should return a IFileRequest\r\n\r\n if (offlineProvider) {\r\n offlineProvider.loadFile(\r\n FileToolsOptions.BaseUrl + url,\r\n (data) => {\r\n if (!aborted && onSuccess) {\r\n onSuccess(data);\r\n }\r\n\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n },\r\n onProgress\r\n ? (event) => {\r\n if (!aborted && onProgress) {\r\n onProgress(event);\r\n }\r\n }\r\n : undefined,\r\n noOfflineSupport,\r\n useArrayBuffer\r\n );\r\n }\r\n };\r\n\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\r\n } else {\r\n requestFile();\r\n }\r\n\r\n return fileRequest;\r\n};\r\n\r\n/**\r\n * Checks if the loaded document was accessed via `file:`-Protocol.\r\n * @returns boolean\r\n * @internal\r\n */\r\nexport const IsFileURL = (): boolean => {\r\n return typeof location !== \"undefined\" && location.protocol === \"file:\";\r\n};\r\n\r\n/**\r\n * Test if the given uri is a valid base64 data url\r\n * @param uri The uri to test\r\n * @returns True if the uri is a base64 data url or false otherwise\r\n * @internal\r\n */\r\nexport const IsBase64DataUrl = (uri: string): boolean => {\r\n return Base64DataUrlRegEx.test(uri);\r\n};\r\n\r\nexport const TestBase64DataUrl = (uri: string): { match: boolean; type: string } => {\r\n const results = Base64DataUrlRegEx.exec(uri);\r\n if (results === null || results.length === 0) {\r\n return { match: false, type: \"\" };\r\n } else {\r\n const type = results[0].replace(\"data:\", \"\").replace(\"base64,\", \"\");\r\n return { match: true, type };\r\n }\r\n};\r\n\r\n/**\r\n * Decode the given base64 uri.\r\n * @param uri The uri to decode\r\n * @returns The decoded base64 data.\r\n * @internal\r\n */\r\nexport function DecodeBase64UrlToBinary(uri: string): ArrayBuffer {\r\n return DecodeBase64ToBinary(uri.split(\",\")[1]);\r\n}\r\n\r\n/**\r\n * Decode the given base64 uri into a UTF-8 encoded string.\r\n * @param uri The uri to decode\r\n * @returns The decoded base64 data.\r\n * @internal\r\n */\r\nexport const DecodeBase64UrlToString = (uri: string): string => {\r\n return DecodeBase64ToString(uri.split(\",\")[1]);\r\n};\r\n\r\n/**\r\n * This will be executed automatically for UMD and es5.\r\n * If esm dev wants the side effects to execute they will have to run it manually\r\n * Once we build native modules those need to be exported.\r\n * @internal\r\n */\r\nconst initSideEffects = () => {\r\n AbstractEngine._FileToolsLoadImage = LoadImage;\r\n EngineFunctionContext.loadFile = LoadFile;\r\n _functionContainer.loadFile = LoadFile;\r\n};\r\n\r\ninitSideEffects();\r\n\r\n// deprecated\r\n\r\n/**\r\n * FileTools defined as any.\r\n * This should not be imported or used in future releases or in any module in the framework\r\n * @internal\r\n * @deprecated import the needed function from fileTools.ts\r\n */\r\nexport let FileTools: {\r\n DecodeBase64UrlToBinary: (uri: string) => ArrayBuffer;\r\n DecodeBase64UrlToString: (uri: string) => string;\r\n DefaultRetryStrategy: any;\r\n BaseUrl: any;\r\n CorsBehavior: any;\r\n PreprocessUrl: any;\r\n IsBase64DataUrl: (uri: string) => boolean;\r\n IsFileURL: () => boolean;\r\n LoadFile: (\r\n fileOrUrl: string | File,\r\n onSuccess: (data: string | ArrayBuffer, responseURL?: string | undefined) => void,\r\n onProgress?: ((ev: ProgressEvent<EventTarget>) => void) | undefined,\r\n offlineProvider?: IOfflineProvider | undefined,\r\n useArrayBuffer?: boolean | undefined,\r\n onError?: ((request?: WebRequest | undefined, exception?: LoadFileError | undefined) => void) | undefined,\r\n onOpened?: ((request: WebRequest) => void) | undefined\r\n ) => IFileRequest;\r\n LoadImage: (\r\n input: string | ArrayBuffer | Blob | ArrayBufferView,\r\n onLoad: (img: HTMLImageElement | ImageBitmap) => void,\r\n onError: (message?: string | undefined, exception?: any) => void,\r\n offlineProvider: Nullable<IOfflineProvider>,\r\n mimeType?: string | undefined,\r\n imageBitmapOptions?: ImageBitmapOptions | undefined\r\n ) => Nullable<HTMLImageElement>;\r\n ReadFile: (\r\n file: File,\r\n onSuccess: (data: any) => void,\r\n onProgress?: ((ev: ProgressEvent<EventTarget>) => any) | undefined,\r\n useArrayBuffer?: boolean | undefined,\r\n onError?: ((error: ReadFileError) => void) | undefined\r\n ) => IFileRequest;\r\n RequestFile: (\r\n url: string,\r\n onSuccess: (data: string | ArrayBuffer, request?: WebRequest | undefined) => void,\r\n onProgress?: ((event: ProgressEvent<EventTarget>) => void) | undefined,\r\n offlineProvider?: IOfflineProvider | undefined,\r\n useArrayBuffer?: boolean | undefined,\r\n onError?: ((error: RequestFileError) => void) | undefined,\r\n onOpened?: ((request: WebRequest) => void) | undefined\r\n ) => IFileRequest;\r\n SetCorsBehavior: (url: string | string[], element: { crossOrigin: string | null }) => void;\r\n};\r\n/**\r\n * @param DecodeBase64UrlToBinary\r\n * @param DecodeBase64UrlToString\r\n * @param FileToolsOptions\r\n * @internal\r\n */\r\nexport const _injectLTSFileTools = (\r\n DecodeBase64UrlToBinary: (uri: string) => ArrayBuffer,\r\n DecodeBase64UrlToString: (uri: string) => string,\r\n FileToolsOptions: { DefaultRetryStrategy: any; BaseUrl: any; CorsBehavior: any; PreprocessUrl: any },\r\n IsBase64DataUrl: (uri: string) => boolean,\r\n IsFileURL: () => boolean,\r\n LoadFile: (\r\n fileOrUrl: string | File,\r\n onSuccess: (data: string | ArrayBuffer, responseURL?: string | undefined) => void,\r\n onProgress?: ((ev: ProgressEvent<EventTarget>) => void) | undefined,\r\n offlineProvider?: IOfflineProvider | undefined,\r\n useArrayBuffer?: boolean | undefined,\r\n onError?: ((request?: WebRequest | undefined, exception?: LoadFileError | undefined) => void) | undefined,\r\n onOpened?: ((request: WebRequest) => void) | undefined\r\n ) => IFileRequest,\r\n LoadImage: (\r\n input: string | ArrayBuffer | ArrayBufferView | Blob,\r\n onLoad: (img: HTMLImageElement | ImageBitmap) => void,\r\n onError: (message?: string | undefined, exception?: any) => void,\r\n offlineProvider: Nullable<IOfflineProvider>,\r\n mimeType?: string,\r\n imageBitmapOptions?: ImageBitmapOptions | undefined\r\n ) => Nullable<HTMLImageElement>,\r\n ReadFile: (\r\n file: File,\r\n onSuccess: (data: any) => void,\r\n onProgress?: ((ev: ProgressEvent<EventTarget>) => any) | undefined,\r\n useArrayBuffer?: boolean | undefined,\r\n onError?: ((error: ReadFileError) => void) | undefined\r\n ) => IFileRequest,\r\n RequestFile: (\r\n url: string,\r\n onSuccess: (data: string | ArrayBuffer, request?: WebRequest | undefined) => void,\r\n onProgress?: ((event: ProgressEvent<EventTarget>) => void) | undefined,\r\n offlineProvider?: IOfflineProvider | undefined,\r\n useArrayBuffer?: boolean | undefined,\r\n onError?: ((error: RequestFileError) => void) | undefined,\r\n onOpened?: ((request: WebRequest) => void) | undefined\r\n ) => IFileRequest,\r\n SetCorsBehavior: (url: string | string[], element: { crossOrigin: string | null }) => void\r\n) => {\r\n /**\r\n * Backwards compatibility.\r\n * @internal\r\n * @deprecated\r\n */\r\n FileTools = {\r\n DecodeBase64UrlToBinary,\r\n DecodeBase64UrlToString,\r\n DefaultRetryStrategy: FileToolsOptions.DefaultRetryStrategy,\r\n BaseUrl: FileToolsOptions.BaseUrl,\r\n CorsBehavior: FileToolsOptions.CorsBehavior,\r\n PreprocessUrl: FileToolsOptions.PreprocessUrl,\r\n IsBase64DataUrl,\r\n IsFileURL,\r\n LoadFile,\r\n LoadImage,\r\n ReadFile,\r\n RequestFile,\r\n SetCorsBehavior,\r\n };\r\n\r\n Object.defineProperty(FileTools, \"DefaultRetryStrategy\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.DefaultRetryStrategy;\r\n },\r\n set: function (this: null, value: (url: string, request: WebRequest, retryIndex: number) => number) {\r\n FileToolsOptions.DefaultRetryStrategy = value;\r\n },\r\n });\r\n\r\n Object.defineProperty(FileTools, \"BaseUrl\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.BaseUrl;\r\n },\r\n set: function (this: null, value: string) {\r\n FileToolsOptions.BaseUrl = value;\r\n },\r\n });\r\n\r\n Object.defineProperty(FileTools, \"PreprocessUrl\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.PreprocessUrl;\r\n },\r\n set: function (this: null, value: (url: string) => string) {\r\n FileToolsOptions.PreprocessUrl = value;\r\n },\r\n });\r\n\r\n Object.defineProperty(FileTools, \"CorsBehavior\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.CorsBehavior;\r\n },\r\n set: function (this: null, value: string | ((url: string | string[]) => string)) {\r\n FileToolsOptions.CorsBehavior = value;\r\n },\r\n });\r\n};\r\n\r\n_injectLTSFileTools(DecodeBase64UrlToBinary, DecodeBase64UrlToString, FileToolsOptions, IsBase64DataUrl, IsFileURL, LoadFile, LoadImage, ReadFile, RequestFile, SetCorsBehavior);\r\n"]}
|
|
1
|
+
{"version":3,"file":"fileTools.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/fileTools.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAItD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,+CAA8C;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,MAAM,kBAAkB,GAAG,IAAI,MAAM,CAAC,gCAAgC,CAAC,CAAC;AAGxE,cAAc;AACd,MAAM,OAAO,aAAc,SAAQ,YAAY;IAI3C;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAA0B;QACnD,KAAK,CAAC,OAAO,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;QAEzC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,SAAS,CAAC,eAAe,CAAC,IAAI,EAAE,aAAa,C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,gBAAgB,CAAC,OAAO,GAAG,KAAK,CAAC;QACrC,CAAC;KACJ,CAAC,CAAC;IAEH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,eAAe,EAAE;QAC9C,GAAG,EAAE;YACD,OAAO,gBAAgB,CAAC,aAAa,CAAC;QAC1C,CAAC;QACD,GAAG,EAAE,UAAsB,KAA8B;YACrD,gBAAgB,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3C,CAAC;KACJ,CAAC,CAAC;IAEH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,EAAE;QAC7C,GAAG,EAAE;YACD,OAAO,gBAAgB,CAAC,YAAY,CAAC;QACzC,CAAC;QACD,GAAG,EAAE,UAAsB,KAAoD;YAC3E,gBAAgB,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1C,CAAC;KACJ,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,mBAAmB,CAAC,uBAAuB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,eAAe,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { WebRequest } from \"./webRequest\";\r\nimport { IsWindowObjectExist } from \"./domManagement\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { IOfflineProvider } from \"../Offline/IOfflineProvider\";\r\nimport type { IFileRequest } from \"./fileRequest\";\r\nimport { Observable } from \"./observable\";\r\nimport { FilesInputStore } from \"./filesInputStore\";\r\nimport { RetryStrategy } from \"./retryStrategy\";\r\nimport { BaseError, ErrorCodes, RuntimeError } from \"./error\";\r\nimport { DecodeBase64ToBinary, DecodeBase64ToString, EncodeArrayBufferToBase64 } from \"./stringTools\";\r\nimport { _functionContainer } from \"../Engines/Processors/shaderProcessor\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { Logger } from \"./logger\";\r\nimport { TimingTools } from \"./timingTools\";\r\nimport type { INative } from \"../Engines/Native/nativeInterfaces\";\r\nimport { EngineFunctionContext } from \"core/Engines/abstractEngine.functions\";\r\nimport { AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\nconst Base64DataUrlRegEx = new RegExp(/^data:([^,]+\\/[^,]+)?;base64,/i);\r\ndeclare const _native: INative;\r\n\r\n/** @ignore */\r\nexport class LoadFileError extends RuntimeError {\r\n public request?: WebRequest;\r\n public file?: File;\r\n\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param object defines the optional web request\r\n */\r\n constructor(message: string, object?: WebRequest | File) {\r\n super(message, ErrorCodes.LoadFileError);\r\n\r\n this.name = \"LoadFileError\";\r\n BaseError._setPrototypeOf(this, LoadFileError.prototype);\r\n\r\n if (object instanceof WebRequest) {\r\n this.request = object;\r\n } else {\r\n this.file = object;\r\n }\r\n }\r\n}\r\n\r\n/** @ignore */\r\nexport class RequestFileError extends RuntimeError {\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param request defines the optional web request\r\n */\r\n constructor(\r\n message: string,\r\n public request: WebRequest\r\n ) {\r\n super(message, ErrorCodes.RequestFileError);\r\n this.name = \"RequestFileError\";\r\n BaseError._setPrototypeOf(this, RequestFileError.prototype);\r\n }\r\n}\r\n\r\n/** @ignore */\r\nexport class ReadFileError extends RuntimeError {\r\n /**\r\n * Creates a new ReadFileError\r\n * @param message defines the message of the error\r\n * @param file defines the optional file\r\n */\r\n constructor(\r\n message: string,\r\n public file: File\r\n ) {\r\n super(message, ErrorCodes.ReadFileError);\r\n this.name = \"ReadFileError\";\r\n BaseError._setPrototypeOf(this, ReadFileError.prototype);\r\n }\r\n}\r\n/**\r\n * @internal\r\n */\r\nexport const FileToolsOptions: {\r\n DefaultRetryStrategy: (url: string, request: WebRequest, retryIndex: number) => number;\r\n BaseUrl: string;\r\n CorsBehavior: string | ((url: string | string[]) => string);\r\n PreprocessUrl: (url: string) => string;\r\n ScriptBaseUrl: string;\r\n ScriptPreprocessUrl: (url: string) => string;\r\n} = {\r\n /**\r\n * Gets or sets the retry strategy to apply when an error happens while loading an asset.\r\n * When defining this function, return the wait time before trying again or return -1 to\r\n * stop retrying and error out.\r\n */\r\n DefaultRetryStrategy: RetryStrategy.ExponentialBackoff(),\r\n\r\n /**\r\n * Gets or sets the base URL to use to load assets\r\n */\r\n BaseUrl: \"\",\r\n\r\n /**\r\n * Default behaviour for cors in the application.\r\n * It can be a string if the expected behavior is identical in the entire app.\r\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\r\n */\r\n CorsBehavior: \"anonymous\",\r\n\r\n /**\r\n * Gets or sets a function used to pre-process url before using them to load assets\r\n * @param url\r\n * @returns the processed url\r\n */\r\n PreprocessUrl: (url: string) => url,\r\n\r\n /**\r\n * Gets or sets the base URL to use to load scripts\r\n * Used for both JS and WASM\r\n */\r\n ScriptBaseUrl: \"\",\r\n /**\r\n * Gets or sets a function used to pre-process script url before using them to load.\r\n * Used for both JS and WASM\r\n * @param url defines the url to process\r\n * @returns the processed url\r\n */\r\n ScriptPreprocessUrl: (url: string) => url,\r\n};\r\n\r\n/**\r\n * Removes unwanted characters from an url\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\n// eslint-disable-next-line prefer-const\r\nexport let CleanUrl = (url: string): string => {\r\n url = url.replace(/#/gm, \"%23\");\r\n return url;\r\n};\r\n\r\n/**\r\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\r\n * @param url define the url we are trying\r\n * @param element define the dom element where to configure the cors policy\r\n * @internal\r\n */\r\nexport const SetCorsBehavior = (url: string | string[], element: { crossOrigin: string | null }): void => {\r\n if (url && url.indexOf(\"data:\") === 0) {\r\n return;\r\n }\r\n\r\n if (FileToolsOptions.CorsBehavior) {\r\n if (typeof FileToolsOptions.CorsBehavior === \"string\" || FileToolsOptions.CorsBehavior instanceof String) {\r\n element.crossOrigin = <string>FileToolsOptions.CorsBehavior;\r\n } else {\r\n const result = FileToolsOptions.CorsBehavior(url);\r\n if (result) {\r\n element.crossOrigin = result;\r\n }\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @param mimeType optional mime type\r\n * @param imageBitmapOptions\r\n * @returns the HTMLImageElement of the loaded image\r\n * @internal\r\n */\r\nexport const LoadImage = (\r\n input: string | ArrayBuffer | ArrayBufferView | Blob,\r\n onLoad: (img: HTMLImageElement | ImageBitmap) => void,\r\n onError: (message?: string, exception?: any) => void,\r\n offlineProvider: Nullable<IOfflineProvider>,\r\n mimeType: string = \"\",\r\n imageBitmapOptions?: ImageBitmapOptions\r\n): Nullable<HTMLImageElement> => {\r\n const engine = EngineStore.LastCreatedEngine;\r\n if (typeof HTMLImageElement === \"undefined\" && !engine?._features.forceBitmapOverHTMLImageElement) {\r\n onError(\"LoadImage is only supported in web or BabylonNative environments.\");\r\n return null;\r\n }\r\n\r\n let url: string;\r\n let usingObjectURL = false;\r\n\r\n if (input instanceof ArrayBuffer || ArrayBuffer.isView(input)) {\r\n if (typeof Blob !== \"undefined\" && typeof URL !== \"undefined\") {\r\n url = URL.createObjectURL(new Blob([input], { type: mimeType }));\r\n usingObjectURL = true;\r\n } else {\r\n url = `data:${mimeType};base64,` + EncodeArrayBufferToBase64(input);\r\n }\r\n } else if (input instanceof Blob) {\r\n url = URL.createObjectURL(input);\r\n usingObjectURL = true;\r\n } else {\r\n url = CleanUrl(input);\r\n url = FileToolsOptions.PreprocessUrl(input);\r\n }\r\n\r\n const onErrorHandler = (exception: any) => {\r\n if (onError) {\r\n const inputText = url || input.toString();\r\n onError(`Error while trying to load image: ${inputText.indexOf(\"http\") === 0 || inputText.length <= 128 ? inputText : inputText.slice(0, 128) + \"...\"}`, exception);\r\n }\r\n };\r\n\r\n if (engine?._features.forceBitmapOverHTMLImageElement) {\r\n LoadFile(\r\n url,\r\n (data) => {\r\n engine!\r\n .createImageBitmap(new Blob([data], { type: mimeType }), { premultiplyAlpha: \"none\", ...imageBitmapOptions })\r\n .then((imgBmp) => {\r\n onLoad(imgBmp);\r\n if (usingObjectURL) {\r\n URL.revokeObjectURL(url);\r\n }\r\n })\r\n .catch((reason) => {\r\n if (onError) {\r\n onError(\"Error while trying to load image: \" + input, reason);\r\n }\r\n });\r\n },\r\n undefined,\r\n offlineProvider || undefined,\r\n true,\r\n (request, exception) => {\r\n onErrorHandler(exception);\r\n }\r\n );\r\n\r\n return null;\r\n }\r\n\r\n const img = new Image();\r\n SetCorsBehavior(url, img);\r\n\r\n const handlersList: { target: any; name: string; handler: any }[] = [];\r\n\r\n const loadHandlersList = () => {\r\n handlersList.forEach((handler) => {\r\n handler.target.addEventListener(handler.name, handler.handler);\r\n });\r\n };\r\n\r\n const unloadHandlersList = () => {\r\n handlersList.forEach((handler) => {\r\n handler.target.removeEventListener(handler.name, handler.handler);\r\n });\r\n handlersList.length = 0;\r\n };\r\n\r\n const loadHandler = () => {\r\n unloadHandlersList();\r\n\r\n onLoad(img);\r\n\r\n // Must revoke the URL after calling onLoad to avoid security exceptions in\r\n // certain scenarios (e.g. when hosted in vscode).\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n\r\n const errorHandler = (err: any) => {\r\n unloadHandlersList();\r\n\r\n onErrorHandler(err);\r\n\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n\r\n const cspHandler = (err: any) => {\r\n if (err.blockedURI !== img.src) {\r\n return;\r\n }\r\n\r\n unloadHandlersList();\r\n const cspException = new Error(`CSP violation of policy ${err.effectiveDirective} ${err.blockedURI}. Current policy is ${err.originalPolicy}`);\r\n\r\n EngineStore.UseFallbackTexture = false;\r\n onErrorHandler(cspException);\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n img.src = \"\";\r\n };\r\n\r\n handlersList.push({ target: img, name: \"load\", handler: loadHandler });\r\n handlersList.push({ target: img, name: \"error\", handler: errorHandler });\r\n handlersList.push({ target: document, name: \"securitypolicyviolation\", handler: cspHandler });\r\n\r\n loadHandlersList();\r\n\r\n const fromBlob = url.substring(0, 5) === \"blob:\";\r\n const fromData = url.substring(0, 5) === \"data:\";\r\n const noOfflineSupport = () => {\r\n if (fromBlob || fromData || !WebRequest.IsCustomRequestAvailable) {\r\n img.src = url;\r\n } else {\r\n LoadFile(\r\n url,\r\n (data, _, contentType) => {\r\n const type = !mimeType && contentType ? contentType : mimeType;\r\n const blob = new Blob([data], { type });\r\n const url = URL.createObjectURL(blob);\r\n usingObjectURL = true;\r\n img.src = url;\r\n },\r\n undefined,\r\n offlineProvider || undefined,\r\n true,\r\n (_request, exception) => {\r\n onErrorHandler(exception);\r\n }\r\n );\r\n }\r\n };\r\n\r\n const loadFromOfflineSupport = () => {\r\n if (offlineProvider) {\r\n offlineProvider.loadImage(url, img);\r\n }\r\n };\r\n\r\n if (!fromBlob && !fromData && offlineProvider && offlineProvider.enableTexturesOffline) {\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\r\n } else {\r\n if (url.indexOf(\"file:\") !== -1) {\r\n const textureName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (FilesInputStore.FilesToLoad[textureName] && typeof URL !== \"undefined\") {\r\n try {\r\n let blobURL;\r\n try {\r\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\r\n } catch (ex) {\r\n // Chrome doesn't support oneTimeOnly parameter\r\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\r\n }\r\n img.src = blobURL;\r\n usingObjectURL = true;\r\n } catch (e) {\r\n img.src = \"\";\r\n }\r\n return img;\r\n }\r\n }\r\n\r\n noOfflineSupport();\r\n }\r\n\r\n return img;\r\n};\r\n\r\n/**\r\n * Reads a file from a File object\r\n * @param file defines the file to load\r\n * @param onSuccess defines the callback to call when data is loaded\r\n * @param onProgress defines the callback to call during loading process\r\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\r\n * @param onError defines the callback to call when an error occurs\r\n * @returns a file request object\r\n * @internal\r\n */\r\nexport const ReadFile = (\r\n file: File,\r\n onSuccess: (data: any) => void,\r\n onProgress?: (ev: ProgressEvent) => any,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: ReadFileError) => void\r\n): IFileRequest => {\r\n const reader = new FileReader();\r\n const fileRequest: IFileRequest = {\r\n onCompleteObservable: new Observable<IFileRequest>(),\r\n abort: () => reader.abort(),\r\n };\r\n\r\n reader.onloadend = () => fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n if (onError) {\r\n reader.onerror = () => {\r\n onError(new ReadFileError(`Unable to read ${file.name}`, file));\r\n };\r\n }\r\n reader.onload = (e) => {\r\n //target doesn't have result from ts 1.3\r\n onSuccess((<any>e.target)[\"result\"]);\r\n };\r\n if (onProgress) {\r\n reader.onprogress = onProgress;\r\n }\r\n if (!useArrayBuffer) {\r\n // Asynchronous read\r\n reader.readAsText(file);\r\n } else {\r\n reader.readAsArrayBuffer(file);\r\n }\r\n\r\n return fileRequest;\r\n};\r\n\r\n/**\r\n * Loads a file from a url, a data url, or a file url\r\n * @param fileOrUrl file, url, data url, or file url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param onOpened\r\n * @returns a file request object\r\n * @internal\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const LoadFile = (\r\n fileOrUrl: File | string,\r\n onSuccess: (data: string | ArrayBuffer, responseURL?: string, contentType?: Nullable<string>) => void,\r\n onProgress?: (ev: ProgressEvent) => void,\r\n offlineProvider?: IOfflineProvider,\r\n useArrayBuffer?: boolean,\r\n onError?: (request?: WebRequest, exception?: LoadFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n): IFileRequest => {\r\n if ((fileOrUrl as File).name) {\r\n return ReadFile(\r\n fileOrUrl as File,\r\n onSuccess,\r\n onProgress,\r\n useArrayBuffer,\r\n onError\r\n ? (error: ReadFileError) => {\r\n onError(undefined, error);\r\n }\r\n : undefined\r\n );\r\n }\r\n\r\n const url = fileOrUrl as string;\r\n\r\n // If file and file input are set\r\n if (url.indexOf(\"file:\") !== -1) {\r\n let fileName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (fileName.indexOf(\"./\") === 0) {\r\n fileName = fileName.substring(2);\r\n }\r\n const file = FilesInputStore.FilesToLoad[fileName];\r\n if (file) {\r\n return ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError ? (error) => onError(undefined, new LoadFileError(error.message, error.file)) : undefined);\r\n }\r\n }\r\n\r\n // For a Base64 Data URL\r\n const { match, type } = TestBase64DataUrl(url);\r\n if (match) {\r\n const fileRequest: IFileRequest = {\r\n onCompleteObservable: new Observable<IFileRequest>(),\r\n abort: () => () => {},\r\n };\r\n\r\n try {\r\n const data = useArrayBuffer ? DecodeBase64UrlToBinary(url) : DecodeBase64UrlToString(url);\r\n onSuccess(data, undefined, type);\r\n } catch (error) {\r\n if (onError) {\r\n onError(undefined, error);\r\n } else {\r\n Logger.Error(error.message || \"Failed to parse the Data URL\");\r\n }\r\n }\r\n\r\n TimingTools.SetImmediate(() => {\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n });\r\n\r\n return fileRequest;\r\n }\r\n\r\n return RequestFile(\r\n url,\r\n (data, request) => {\r\n onSuccess(data, request?.responseURL, request?.getResponseHeader(\"content-type\"));\r\n },\r\n onProgress,\r\n offlineProvider,\r\n useArrayBuffer,\r\n onError\r\n ? (error) => {\r\n onError(error.request, new LoadFileError(error.message, error.request));\r\n }\r\n : undefined,\r\n onOpened\r\n );\r\n};\r\n\r\n/**\r\n * Loads a file from a url\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param onOpened callback called when the web request is opened\r\n * @returns a file request object\r\n * @internal\r\n */\r\nexport const RequestFile = (\r\n url: string,\r\n onSuccess?: (data: string | ArrayBuffer, request?: WebRequest) => void,\r\n onProgress?: (event: ProgressEvent) => void,\r\n offlineProvider?: IOfflineProvider,\r\n useArrayBuffer?: boolean,\r\n onError?: (error: RequestFileError) => void,\r\n onOpened?: (request: WebRequest) => void\r\n): IFileRequest => {\r\n url = CleanUrl(url);\r\n url = FileToolsOptions.PreprocessUrl(url);\r\n\r\n const loadUrl = FileToolsOptions.BaseUrl + url;\r\n\r\n let aborted = false;\r\n const fileRequest: IFileRequest = {\r\n onCompleteObservable: new Observable<IFileRequest>(),\r\n abort: () => (aborted = true),\r\n };\r\n\r\n const requestFile = () => {\r\n let request: Nullable<WebRequest> = new WebRequest();\r\n let retryHandle: Nullable<ReturnType<typeof setTimeout>> = null;\r\n let onReadyStateChange: Nullable<() => void>;\r\n\r\n const unbindEvents = () => {\r\n if (!request) {\r\n return;\r\n }\r\n\r\n if (onProgress) {\r\n request.removeEventListener(\"progress\", onProgress);\r\n }\r\n if (onReadyStateChange) {\r\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\r\n }\r\n request.removeEventListener(\"loadend\", onLoadEnd!);\r\n };\r\n\r\n let onLoadEnd: Nullable<() => void> = () => {\r\n unbindEvents();\r\n\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n fileRequest.onCompleteObservable.clear();\r\n\r\n onProgress = undefined;\r\n onReadyStateChange = null;\r\n onLoadEnd = null;\r\n onError = undefined;\r\n onOpened = undefined;\r\n onSuccess = undefined;\r\n };\r\n\r\n fileRequest.abort = () => {\r\n aborted = true;\r\n\r\n if (onLoadEnd) {\r\n onLoadEnd();\r\n }\r\n\r\n if (request && request.readyState !== (XMLHttpRequest.DONE || 4)) {\r\n request.abort();\r\n }\r\n\r\n if (retryHandle !== null) {\r\n clearTimeout(retryHandle);\r\n retryHandle = null;\r\n }\r\n\r\n request = null;\r\n };\r\n\r\n const handleError = (error: any) => {\r\n const message = error.message || \"Unknown error\";\r\n if (onError && request) {\r\n onError(new RequestFileError(message, request));\r\n } else {\r\n Logger.Error(message);\r\n }\r\n };\r\n\r\n const retryLoop = (retryIndex: number) => {\r\n if (!request) {\r\n return;\r\n }\r\n request.open(\"GET\", loadUrl);\r\n\r\n if (onOpened) {\r\n try {\r\n onOpened(request);\r\n } catch (e) {\r\n handleError(e);\r\n return;\r\n }\r\n }\r\n\r\n if (useArrayBuffer) {\r\n request.responseType = \"arraybuffer\";\r\n }\r\n\r\n if (onProgress) {\r\n request.addEventListener(\"progress\", onProgress);\r\n }\r\n\r\n if (onLoadEnd) {\r\n request.addEventListener(\"loadend\", onLoadEnd);\r\n }\r\n\r\n onReadyStateChange = () => {\r\n if (aborted || !request) {\r\n return;\r\n }\r\n\r\n // In case of undefined state in some browsers.\r\n if (request.readyState === (XMLHttpRequest.DONE || 4)) {\r\n // Some browsers have issues where onreadystatechange can be called multiple times with the same value.\r\n if (onReadyStateChange) {\r\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\r\n }\r\n\r\n if ((request.status >= 200 && request.status < 300) || (request.status === 0 && (!IsWindowObjectExist() || IsFileURL()))) {\r\n try {\r\n if (onSuccess) {\r\n onSuccess(useArrayBuffer ? request.response : request.responseText, request);\r\n }\r\n } catch (e) {\r\n handleError(e);\r\n }\r\n return;\r\n }\r\n\r\n const retryStrategy = FileToolsOptions.DefaultRetryStrategy;\r\n if (retryStrategy) {\r\n const waitTime = retryStrategy(loadUrl, request, retryIndex);\r\n if (waitTime !== -1) {\r\n // Prevent the request from completing for retry.\r\n unbindEvents();\r\n\r\n request = new WebRequest();\r\n retryHandle = setTimeout(() => retryLoop(retryIndex + 1), waitTime);\r\n return;\r\n }\r\n }\r\n\r\n const error = new RequestFileError(\"Error status: \" + request.status + \" \" + request.statusText + \" - Unable to load \" + loadUrl, request);\r\n if (onError) {\r\n onError(error);\r\n }\r\n }\r\n };\r\n\r\n request.addEventListener(\"readystatechange\", onReadyStateChange);\r\n\r\n request.send();\r\n };\r\n\r\n retryLoop(0);\r\n };\r\n\r\n // Caching all files\r\n if (offlineProvider && offlineProvider.enableSceneOffline) {\r\n const noOfflineSupport = (request?: any) => {\r\n if (request && request.status > 400) {\r\n if (onError) {\r\n onError(request);\r\n }\r\n } else {\r\n requestFile();\r\n }\r\n };\r\n\r\n const loadFromOfflineSupport = () => {\r\n // TODO: database needs to support aborting and should return a IFileRequest\r\n\r\n if (offlineProvider) {\r\n offlineProvider.loadFile(\r\n FileToolsOptions.BaseUrl + url,\r\n (data) => {\r\n if (!aborted && onSuccess) {\r\n onSuccess(data);\r\n }\r\n\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n },\r\n onProgress\r\n ? (event) => {\r\n if (!aborted && onProgress) {\r\n onProgress(event);\r\n }\r\n }\r\n : undefined,\r\n noOfflineSupport,\r\n useArrayBuffer\r\n );\r\n }\r\n };\r\n\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\r\n } else {\r\n requestFile();\r\n }\r\n\r\n return fileRequest;\r\n};\r\n\r\n/**\r\n * Checks if the loaded document was accessed via `file:`-Protocol.\r\n * @returns boolean\r\n * @internal\r\n */\r\nexport const IsFileURL = (): boolean => {\r\n return typeof location !== \"undefined\" && location.protocol === \"file:\";\r\n};\r\n\r\n/**\r\n * Test if the given uri is a valid base64 data url\r\n * @param uri The uri to test\r\n * @returns True if the uri is a base64 data url or false otherwise\r\n * @internal\r\n */\r\nexport const IsBase64DataUrl = (uri: string): boolean => {\r\n return Base64DataUrlRegEx.test(uri);\r\n};\r\n\r\nexport const TestBase64DataUrl = (uri: string): { match: boolean; type: string } => {\r\n const results = Base64DataUrlRegEx.exec(uri);\r\n if (results === null || results.length === 0) {\r\n return { match: false, type: \"\" };\r\n } else {\r\n const type = results[0].replace(\"data:\", \"\").replace(\"base64,\", \"\");\r\n return { match: true, type };\r\n }\r\n};\r\n\r\n/**\r\n * Decode the given base64 uri.\r\n * @param uri The uri to decode\r\n * @returns The decoded base64 data.\r\n * @internal\r\n */\r\nexport function DecodeBase64UrlToBinary(uri: string): ArrayBuffer {\r\n return DecodeBase64ToBinary(uri.split(\",\")[1]);\r\n}\r\n\r\n/**\r\n * Decode the given base64 uri into a UTF-8 encoded string.\r\n * @param uri The uri to decode\r\n * @returns The decoded base64 data.\r\n * @internal\r\n */\r\nexport const DecodeBase64UrlToString = (uri: string): string => {\r\n return DecodeBase64ToString(uri.split(\",\")[1]);\r\n};\r\n\r\n/**\r\n * This will be executed automatically for UMD and es5.\r\n * If esm dev wants the side effects to execute they will have to run it manually\r\n * Once we build native modules those need to be exported.\r\n * @internal\r\n */\r\nconst initSideEffects = () => {\r\n AbstractEngine._FileToolsLoadImage = LoadImage;\r\n EngineFunctionContext.loadFile = LoadFile;\r\n _functionContainer.loadFile = LoadFile;\r\n};\r\n\r\ninitSideEffects();\r\n\r\n// deprecated\r\n\r\n/**\r\n * FileTools defined as any.\r\n * This should not be imported or used in future releases or in any module in the framework\r\n * @internal\r\n * @deprecated import the needed function from fileTools.ts\r\n */\r\nexport let FileTools: {\r\n DecodeBase64UrlToBinary: (uri: string) => ArrayBuffer;\r\n DecodeBase64UrlToString: (uri: string) => string;\r\n DefaultRetryStrategy: any;\r\n BaseUrl: any;\r\n CorsBehavior: any;\r\n PreprocessUrl: any;\r\n IsBase64DataUrl: (uri: string) => boolean;\r\n IsFileURL: () => boolean;\r\n LoadFile: (\r\n fileOrUrl: string | File,\r\n onSuccess: (data: string | ArrayBuffer, responseURL?: string | undefined) => void,\r\n onProgress?: ((ev: ProgressEvent<EventTarget>) => void) | undefined,\r\n offlineProvider?: IOfflineProvider | undefined,\r\n useArrayBuffer?: boolean | undefined,\r\n onError?: ((request?: WebRequest | undefined, exception?: LoadFileError | undefined) => void) | undefined,\r\n onOpened?: ((request: WebRequest) => void) | undefined\r\n ) => IFileRequest;\r\n LoadImage: (\r\n input: string | ArrayBuffer | Blob | ArrayBufferView,\r\n onLoad: (img: HTMLImageElement | ImageBitmap) => void,\r\n onError: (message?: string | undefined, exception?: any) => void,\r\n offlineProvider: Nullable<IOfflineProvider>,\r\n mimeType?: string | undefined,\r\n imageBitmapOptions?: ImageBitmapOptions | undefined\r\n ) => Nullable<HTMLImageElement>;\r\n ReadFile: (\r\n file: File,\r\n onSuccess: (data: any) => void,\r\n onProgress?: ((ev: ProgressEvent<EventTarget>) => any) | undefined,\r\n useArrayBuffer?: boolean | undefined,\r\n onError?: ((error: ReadFileError) => void) | undefined\r\n ) => IFileRequest;\r\n RequestFile: (\r\n url: string,\r\n onSuccess: (data: string | ArrayBuffer, request?: WebRequest | undefined) => void,\r\n onProgress?: ((event: ProgressEvent<EventTarget>) => void) | undefined,\r\n offlineProvider?: IOfflineProvider | undefined,\r\n useArrayBuffer?: boolean | undefined,\r\n onError?: ((error: RequestFileError) => void) | undefined,\r\n onOpened?: ((request: WebRequest) => void) | undefined\r\n ) => IFileRequest;\r\n SetCorsBehavior: (url: string | string[], element: { crossOrigin: string | null }) => void;\r\n};\r\n/**\r\n * @param DecodeBase64UrlToBinary\r\n * @param DecodeBase64UrlToString\r\n * @param FileToolsOptions\r\n * @internal\r\n */\r\nexport const _injectLTSFileTools = (\r\n DecodeBase64UrlToBinary: (uri: string) => ArrayBuffer,\r\n DecodeBase64UrlToString: (uri: string) => string,\r\n FileToolsOptions: { DefaultRetryStrategy: any; BaseUrl: any; CorsBehavior: any; PreprocessUrl: any },\r\n IsBase64DataUrl: (uri: string) => boolean,\r\n IsFileURL: () => boolean,\r\n LoadFile: (\r\n fileOrUrl: string | File,\r\n onSuccess: (data: string | ArrayBuffer, responseURL?: string | undefined) => void,\r\n onProgress?: ((ev: ProgressEvent<EventTarget>) => void) | undefined,\r\n offlineProvider?: IOfflineProvider | undefined,\r\n useArrayBuffer?: boolean | undefined,\r\n onError?: ((request?: WebRequest | undefined, exception?: LoadFileError | undefined) => void) | undefined,\r\n onOpened?: ((request: WebRequest) => void) | undefined\r\n ) => IFileRequest,\r\n LoadImage: (\r\n input: string | ArrayBuffer | ArrayBufferView | Blob,\r\n onLoad: (img: HTMLImageElement | ImageBitmap) => void,\r\n onError: (message?: string | undefined, exception?: any) => void,\r\n offlineProvider: Nullable<IOfflineProvider>,\r\n mimeType?: string,\r\n imageBitmapOptions?: ImageBitmapOptions | undefined\r\n ) => Nullable<HTMLImageElement>,\r\n ReadFile: (\r\n file: File,\r\n onSuccess: (data: any) => void,\r\n onProgress?: ((ev: ProgressEvent<EventTarget>) => any) | undefined,\r\n useArrayBuffer?: boolean | undefined,\r\n onError?: ((error: ReadFileError) => void) | undefined\r\n ) => IFileRequest,\r\n RequestFile: (\r\n url: string,\r\n onSuccess: (data: string | ArrayBuffer, request?: WebRequest | undefined) => void,\r\n onProgress?: ((event: ProgressEvent<EventTarget>) => void) | undefined,\r\n offlineProvider?: IOfflineProvider | undefined,\r\n useArrayBuffer?: boolean | undefined,\r\n onError?: ((error: RequestFileError) => void) | undefined,\r\n onOpened?: ((request: WebRequest) => void) | undefined\r\n ) => IFileRequest,\r\n SetCorsBehavior: (url: string | string[], element: { crossOrigin: string | null }) => void\r\n) => {\r\n /**\r\n * Backwards compatibility.\r\n * @internal\r\n * @deprecated\r\n */\r\n FileTools = {\r\n DecodeBase64UrlToBinary,\r\n DecodeBase64UrlToString,\r\n DefaultRetryStrategy: FileToolsOptions.DefaultRetryStrategy,\r\n BaseUrl: FileToolsOptions.BaseUrl,\r\n CorsBehavior: FileToolsOptions.CorsBehavior,\r\n PreprocessUrl: FileToolsOptions.PreprocessUrl,\r\n IsBase64DataUrl,\r\n IsFileURL,\r\n LoadFile,\r\n LoadImage,\r\n ReadFile,\r\n RequestFile,\r\n SetCorsBehavior,\r\n };\r\n\r\n Object.defineProperty(FileTools, \"DefaultRetryStrategy\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.DefaultRetryStrategy;\r\n },\r\n set: function (this: null, value: (url: string, request: WebRequest, retryIndex: number) => number) {\r\n FileToolsOptions.DefaultRetryStrategy = value;\r\n },\r\n });\r\n\r\n Object.defineProperty(FileTools, \"BaseUrl\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.BaseUrl;\r\n },\r\n set: function (this: null, value: string) {\r\n FileToolsOptions.BaseUrl = value;\r\n },\r\n });\r\n\r\n Object.defineProperty(FileTools, \"PreprocessUrl\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.PreprocessUrl;\r\n },\r\n set: function (this: null, value: (url: string) => string) {\r\n FileToolsOptions.PreprocessUrl = value;\r\n },\r\n });\r\n\r\n Object.defineProperty(FileTools, \"CorsBehavior\", {\r\n get: function (this: null) {\r\n return FileToolsOptions.CorsBehavior;\r\n },\r\n set: function (this: null, value: string | ((url: string | string[]) => string)) {\r\n FileToolsOptions.CorsBehavior = value;\r\n },\r\n });\r\n};\r\n\r\n_injectLTSFileTools(DecodeBase64UrlToBinary, DecodeBase64UrlToString, FileToolsOptions, IsBase64DataUrl, IsFileURL, LoadFile, LoadImage, ReadFile, RequestFile, SetCorsBehavior);\r\n"]}
|
package/Misc/greasedLineTools.js
CHANGED
|
@@ -470,8 +470,14 @@ export class GreasedLineTools {
|
|
|
470
470
|
* @returns the colors texture
|
|
471
471
|
*/
|
|
472
472
|
static CreateColorsTexture(name, colors, colorsSampling, scene) {
|
|
473
|
+
const maxTextureSize = scene.getEngine().getCaps().maxTextureSize ?? 1;
|
|
474
|
+
const width = colors.length > maxTextureSize ? maxTextureSize : colors.length;
|
|
475
|
+
const height = Math.ceil(colors.length / maxTextureSize);
|
|
476
|
+
if (height > 1) {
|
|
477
|
+
colors = [...colors, ...Array(width * height - colors.length).fill(colors[0])];
|
|
478
|
+
}
|
|
473
479
|
const colorsArray = GreasedLineTools.Color3toRGBAUint8(colors);
|
|
474
|
-
const colorsTexture = new RawTexture(colorsArray,
|
|
480
|
+
const colorsTexture = new RawTexture(colorsArray, width, height, Engine.TEXTUREFORMAT_RGBA, scene, false, true, colorsSampling);
|
|
475
481
|
colorsTexture.name = name;
|
|
476
482
|
return colorsTexture;
|
|
477
483
|
}
|