@babylonjs/core 6.23.0 → 6.24.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/Animations/animationGroup.d.ts +1 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Behaviors/Cameras/framingBehavior.d.ts +0 -5
- package/Behaviors/Cameras/framingBehavior.js +2 -34
- package/Behaviors/Cameras/framingBehavior.js.map +1 -1
- package/Buffers/buffer.d.ts +64 -1
- package/Buffers/buffer.js +30 -23
- package/Buffers/buffer.js.map +1 -1
- package/Buffers/storageBuffer.d.ts +3 -1
- package/Buffers/storageBuffer.js +4 -2
- package/Buffers/storageBuffer.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.js +1 -1
- package/Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphArcRotateCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphArcRotateCamera.js +1 -1
- package/Cameras/Stereoscopic/anaglyphArcRotateCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphFreeCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphFreeCamera.js +1 -1
- package/Cameras/Stereoscopic/anaglyphFreeCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphGamepadCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphGamepadCamera.js +1 -1
- package/Cameras/Stereoscopic/anaglyphGamepadCamera.js.map +1 -1
- package/Cameras/Stereoscopic/anaglyphUniversalCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/anaglyphUniversalCamera.js +1 -1
- package/Cameras/Stereoscopic/anaglyphUniversalCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicArcRotateCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicFreeCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicFreeCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicFreeCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicGamepadCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicGamepadCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicGamepadCamera.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.d.ts +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.js +1 -1
- package/Cameras/Stereoscopic/stereoscopicUniversalCamera.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationArcRotateCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationArcRotateCamera.js +1 -1
- package/Cameras/VR/vrDeviceOrientationArcRotateCamera.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationFreeCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationFreeCamera.js +1 -1
- package/Cameras/VR/vrDeviceOrientationFreeCamera.js.map +1 -1
- package/Cameras/VR/vrDeviceOrientationGamepadCamera.d.ts +1 -1
- package/Cameras/VR/vrDeviceOrientationGamepadCamera.js +1 -1
- package/Cameras/VR/vrDeviceOrientationGamepadCamera.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +4 -0
- package/Cameras/arcRotateCamera.js +22 -1
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Culling/Octrees/octreeSceneComponent.js +4 -4
- package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
- package/Debug/physicsViewer.js +4 -4
- package/Debug/physicsViewer.js.map +1 -1
- package/Debug/rayHelper.js +1 -1
- package/Debug/rayHelper.js.map +1 -1
- package/Engines/Extensions/engine.storageBuffer.d.ts +2 -1
- package/Engines/Extensions/engine.storageBuffer.js.map +1 -1
- package/Engines/Extensions/engine.uniformBuffer.d.ts +4 -2
- package/Engines/Extensions/engine.uniformBuffer.js +2 -2
- package/Engines/Extensions/engine.uniformBuffer.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.d.ts +2 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js +3 -3
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.uniformBuffer.js +5 -5
- package/Engines/WebGPU/Extensions/engine.uniformBuffer.js.map +1 -1
- package/Engines/WebGPU/webgpuBufferManager.d.ts +3 -2
- package/Engines/WebGPU/webgpuBufferManager.js +16 -3
- package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +2 -0
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +61 -0
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuDrawContext.js +1 -1
- package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
- package/Engines/WebGPU/webgpuPipelineContext.d.ts +3 -0
- package/Engines/WebGPU/webgpuPipelineContext.js +1 -0
- package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuQuerySet.js +3 -3
- package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessor.d.ts +3 -0
- package/Engines/WebGPU/webgpuShaderProcessor.js +5 -0
- package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +11 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +3 -0
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +32 -4
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +5 -3
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTintWASM.js +1 -1
- package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
- package/Engines/engine.d.ts +1 -1
- package/Engines/nativeEngine.d.ts +2 -2
- package/Engines/nativeEngine.js +5 -2
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +7 -3
- package/Engines/thinEngine.js +11 -7
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +9 -4
- package/Engines/webgpuEngine.js +16 -11
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/flowGraph.js +1 -1
- package/FlowGraph/flowGraph.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +1 -1
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.d.ts +4 -0
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js +21 -0
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js.map +1 -1
- package/Materials/Textures/equiRectangularCubeTexture.js +1 -1
- package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +2 -0
- package/Materials/Textures/texture.js +8 -0
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/videoTexture.d.ts +4 -0
- package/Materials/Textures/videoTexture.js +21 -0
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/effect.d.ts +8 -3
- package/Materials/effect.js +25 -19
- package/Materials/effect.js.map +1 -1
- package/Materials/material.js +8 -6
- package/Materials/material.js.map +1 -1
- package/Materials/meshDebugPluginMaterial.js +1 -1
- package/Materials/meshDebugPluginMaterial.js.map +1 -1
- package/Materials/uniformBuffer.d.ts +1 -0
- package/Materials/uniformBuffer.js +9 -2
- package/Materials/uniformBuffer.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.d.ts +66 -0
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +100 -0
- package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateBlock.d.ts +5 -30
- package/Meshes/Node/Blocks/Instances/instantiateBlock.js +2 -52
- package/Meshes/Node/Blocks/Instances/instantiateBlock.js.map +1 -1
- package/Meshes/Node/Blocks/Instances/instantiateLinearBlock.d.ts +31 -0
- package/Meshes/Node/Blocks/Instances/instantiateLinearBlock.js +101 -0
- package/Meshes/Node/Blocks/Instances/instantiateLinearBlock.js.map +1 -0
- package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.d.ts +43 -0
- package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.js +139 -0
- package/Meshes/Node/Blocks/Instances/instantiateRadialBlock.js.map +1 -0
- package/Meshes/Node/index.d.ts +2 -0
- package/Meshes/Node/index.js +2 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/geometry.js +8 -2
- package/Meshes/geometry.js.map +1 -1
- package/Misc/videoRecorder.js +3 -3
- package/Misc/videoRecorder.js.map +1 -1
- package/Physics/physicsHelper.js +3 -3
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +64 -56
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js +4 -4
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/shadowsFragmentFunctions.js +1 -0
- package/Shaders/ShadersInclude/shadowsFragmentFunctions.js.map +1 -1
- package/XR/features/WebXRSpaceWarp.d.ts +2 -0
- package/XR/features/WebXRSpaceWarp.js +6 -1
- package/XR/features/WebXRSpaceWarp.js.map +1 -1
- package/XR/webXRSessionManager.js +1 -1
- package/XR/webXRSessionManager.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +4 -4
- package/scene.js.map +1 -1
package/Meshes/geometry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/geometry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAItE;;GAEG;AACH,MAAM,OAAO,QAAQ;IA0DjB;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,YAAY,CAAC,KAAc;QAClC,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SACtC;aAAM;YACH,IAAI,CAAC,aA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AAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;aAClD;YAED,IAAI,gBAAgB,CAAC,SAAS,EAAE;gBAC5B,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;aACpD;YAED,IAAI,gBAAgB,CAAC,kBAAkB,EAAE;gBACrC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;aAC9D;YAED,IAAI,gBAAgB,CAAC,kBAAkB,EAAE;gBACrC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;aAC9D;YAED,QAAQ,CAAC,qBAAqB,GAAG,UAAU,CAAC,gBAAgB,CAAC;SAChE;aAAM;YACH,UAAU,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;SAC3D;QAED,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAEnC,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ","sourcesContent":["import type { Nullable, FloatArray, DataArray, IndicesArray } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { Vector2 } from \"../Maths/math.vector\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { Engine } from \"../Engines/engine\";\r\nimport type { IGetSetVerticesData } from \"../Meshes/mesh.vertexData\";\r\nimport { VertexData } from \"../Meshes/mesh.vertexData\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { SceneLoaderFlags } from \"../Loading/sceneLoaderFlags\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Tags } from \"../Misc/tags\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport { extractMinAndMax } from \"../Maths/math.functions\";\r\nimport type { AbstractScene } from \"../abstractScene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { CompatibilityOptions } from \"../Compat/compatibilityOptions\";\r\n\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\n\r\n/**\r\n * Class used to store geometry data (vertex buffers + index buffer)\r\n */\r\nexport class Geometry implements IGetSetVerticesData {\r\n // Members\r\n /**\r\n * Gets or sets the ID of the geometry\r\n */\r\n public id: string;\r\n /**\r\n * Gets or sets the unique ID of the geometry\r\n */\r\n public uniqueId: number;\r\n /**\r\n * Gets the delay loading state of the geometry (none by default which means not delayed)\r\n */\r\n public delayLoadState = Constants.DELAYLOADSTATE_NONE;\r\n /**\r\n * Gets the file containing the data to load when running in delay load state\r\n */\r\n public delayLoadingFile: Nullable<string>;\r\n /**\r\n * Callback called when the geometry is updated\r\n */\r\n public onGeometryUpdated: (geometry: Geometry, kind?: string) => void;\r\n\r\n // Private\r\n private _scene: Scene;\r\n private _engine: Engine;\r\n private _meshes: Mesh[];\r\n private _totalVertices = 0;\r\n /** @internal */\r\n public _loadedUniqueId: string;\r\n /** @internal */\r\n public _indices: IndicesArray;\r\n /** @internal */\r\n public _vertexBuffers: { [key: string]: VertexBuffer };\r\n private _isDisposed = false;\r\n private _extend: { minimum: Vector3; maximum: Vector3 };\r\n private _boundingBias: Vector2;\r\n /** @internal */\r\n public _delayInfo: Array<string>;\r\n private _indexBuffer: Nullable<DataBuffer>;\r\n private _indexBufferIsUpdatable = false;\r\n /** @internal */\r\n public _boundingInfo: Nullable<BoundingInfo>;\r\n /** @internal */\r\n public _delayLoadingFunction: Nullable<(any: any, geometry: Geometry) => void>;\r\n /** @internal */\r\n public _softwareSkinningFrameId: number;\r\n private _vertexArrayObjects: { [key: string]: WebGLVertexArrayObject };\r\n private _updatable: boolean;\r\n\r\n // Cache\r\n /** @internal */\r\n public _positions: Nullable<Vector3[]>;\r\n private _positionsCache: Vector3[] = [];\r\n\r\n /** @internal */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n public get boundingBias(): Vector2 {\r\n return this._boundingBias;\r\n }\r\n\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n public set boundingBias(value: Vector2) {\r\n if (this._boundingBias) {\r\n this._boundingBias.copyFrom(value);\r\n } else {\r\n this._boundingBias = value.clone();\r\n }\r\n\r\n this._updateBoundingInfo(true, null);\r\n }\r\n\r\n /**\r\n * Static function used to attach a new empty geometry to a mesh\r\n * @param mesh defines the mesh to attach the geometry to\r\n * @returns the new Geometry\r\n */\r\n public static CreateGeometryForMesh(mesh: Mesh): Geometry {\r\n const geometry = new Geometry(Geometry.RandomId(), mesh.getScene());\r\n\r\n geometry.applyToMesh(mesh);\r\n\r\n return geometry;\r\n }\r\n\r\n /** Get the list of meshes using this geometry */\r\n public get meshes(): Mesh[] {\r\n return this._meshes;\r\n }\r\n\r\n /**\r\n * If set to true (false by default), the bounding info applied to the meshes sharing this geometry will be the bounding info defined at the class level\r\n * and won't be computed based on the vertex positions (which is what we get when useBoundingInfoFromGeometry = false)\r\n */\r\n public useBoundingInfoFromGeometry = false;\r\n\r\n /**\r\n * Creates a new geometry\r\n * @param id defines the unique ID\r\n * @param scene defines the hosting scene\r\n * @param vertexData defines the VertexData used to get geometry data\r\n * @param updatable defines if geometry must be updatable (false by default)\r\n * @param mesh defines the mesh that will be associated with the geometry\r\n */\r\n constructor(id: string, scene?: Scene, vertexData?: VertexData, updatable: boolean = false, mesh: Nullable<Mesh> = null) {\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n if (!this._scene) {\r\n return;\r\n }\r\n this.id = id;\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._engine = this._scene.getEngine();\r\n this._meshes = [];\r\n //Init vertex buffer cache\r\n this._vertexBuffers = {};\r\n this._indices = [];\r\n this._updatable = updatable;\r\n\r\n // vertexData\r\n if (vertexData) {\r\n this.setAllVerticesData(vertexData, updatable);\r\n } else {\r\n this._totalVertices = 0;\r\n }\r\n\r\n if (this._engine.getCaps().vertexArrayObject) {\r\n this._vertexArrayObjects = {};\r\n }\r\n\r\n // applyToMesh\r\n if (mesh) {\r\n this.applyToMesh(mesh);\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current extend of the geometry\r\n */\r\n public get extend(): { minimum: Vector3; maximum: Vector3 } {\r\n return this._extend;\r\n }\r\n\r\n /**\r\n * Gets the hosting scene\r\n * @returns the hosting Scene\r\n */\r\n public getScene(): Scene {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the hosting engine\r\n * @returns the hosting Engine\r\n */\r\n public getEngine(): Engine {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Defines if the geometry is ready to use\r\n * @returns true if the geometry is ready to be used\r\n */\r\n public isReady(): boolean {\r\n return this.delayLoadState === Constants.DELAYLOADSTATE_LOADED || this.delayLoadState === Constants.DELAYLOADSTATE_NONE;\r\n }\r\n\r\n /**\r\n * Gets a value indicating that the geometry should not be serialized\r\n */\r\n public get doNotSerialize(): boolean {\r\n for (let index = 0; index < this._meshes.length; index++) {\r\n if (!this._meshes[index].doNotSerialize) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n if (this._vertexArrayObjects) {\r\n this._vertexArrayObjects = {};\r\n }\r\n\r\n // Index buffer\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, this._updatable);\r\n }\r\n\r\n // Vertex buffers\r\n for (const key in this._vertexBuffers) {\r\n const vertexBuffer = <VertexBuffer>this._vertexBuffers[key];\r\n vertexBuffer._rebuild();\r\n }\r\n }\r\n\r\n /**\r\n * Affects all geometry data in one call\r\n * @param vertexData defines the geometry data\r\n * @param updatable defines if the geometry must be flagged as updatable (false as default)\r\n */\r\n public setAllVerticesData(vertexData: VertexData, updatable?: boolean): void {\r\n vertexData.applyToGeometry(this, updatable);\r\n this._notifyUpdate();\r\n }\r\n\r\n /**\r\n * Set specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the vertex data to use\r\n * @param updatable defines if the vertex must be flagged as updatable (false as default)\r\n * @param stride defines the stride to use (0 by default). This value is deduced from the kind value if not specified\r\n */\r\n public setVerticesData(kind: string, data: FloatArray, updatable: boolean = false, stride?: number): void {\r\n if (updatable && Array.isArray(data)) {\r\n // to avoid converting to Float32Array at each draw call in engine.updateDynamicVertexBuffer, we make the conversion a single time here\r\n data = new Float32Array(data);\r\n }\r\n const buffer = new VertexBuffer(this._engine, data, kind, updatable, this._meshes.length === 0, stride);\r\n this.setVerticesBuffer(buffer);\r\n }\r\n\r\n /**\r\n * Removes a specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n */\r\n public removeVerticesData(kind: string) {\r\n if (this._vertexBuffers[kind]) {\r\n this._vertexBuffers[kind].dispose();\r\n delete this._vertexBuffers[kind];\r\n }\r\n\r\n if (this._vertexArrayObjects) {\r\n this._disposeVertexArrayObjects();\r\n }\r\n }\r\n\r\n /**\r\n * Affect a vertex buffer to the geometry. the vertexBuffer.getKind() function is used to determine where to store the data\r\n * @param buffer defines the vertex buffer to use\r\n * @param totalVertices defines the total number of vertices for position kind (could be null)\r\n * @param disposeExistingBuffer disposes the existing buffer, if any (default: true)\r\n */\r\n public setVerticesBuffer(buffer: VertexBuffer, totalVertices: Nullable<number> = null, disposeExistingBuffer = true): void {\r\n const kind = buffer.getKind();\r\n if (this._vertexBuffers[kind] && disposeExistingBuffer) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n\r\n if (buffer._buffer) {\r\n buffer._buffer._increaseReferences();\r\n }\r\n\r\n this._vertexBuffers[kind] = buffer;\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n\r\n if (kind === VertexBuffer.PositionKind) {\r\n const data = <FloatArray>buffer.getData();\r\n if (totalVertices != null) {\r\n this._totalVertices = totalVertices;\r\n } else {\r\n if (data != null) {\r\n this._totalVertices = data.length / (buffer.type === VertexBuffer.BYTE ? buffer.byteStride : buffer.byteStride / 4);\r\n }\r\n }\r\n\r\n this._updateExtend(data);\r\n this._resetPointsArrayCache();\r\n\r\n for (let index = 0; index < numOfMeshes; index++) {\r\n const mesh = meshes[index];\r\n mesh.buildBoundingInfo(this._extend.minimum, this._extend.maximum);\r\n mesh._createGlobalSubMesh(mesh.isUnIndexed);\r\n mesh.computeWorldMatrix(true);\r\n mesh.synchronizeInstances();\r\n }\r\n }\r\n\r\n this._notifyUpdate(kind);\r\n }\r\n\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will directly update the underlying DataBuffer according to the passed numeric array or Float32Array\r\n * It will do nothing if the buffer is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n public updateVerticesDataDirectly(kind: string, data: DataArray, offset: number, useBytes: boolean = false): void {\r\n const vertexBuffer = this.getVertexBuffer(kind);\r\n\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n\r\n vertexBuffer.updateDirectly(data, offset, useBytes);\r\n this._notifyUpdate(kind);\r\n }\r\n\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will create a new buffer if the current one is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param updateExtends defines if the geometry extends must be recomputed (false by default)\r\n */\r\n public updateVerticesData(kind: string, data: FloatArray, updateExtends: boolean = false): void {\r\n const vertexBuffer = this.getVertexBuffer(kind);\r\n\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n\r\n vertexBuffer.update(data);\r\n\r\n if (kind === VertexBuffer.PositionKind) {\r\n this._updateBoundingInfo(updateExtends, data);\r\n }\r\n this._notifyUpdate(kind);\r\n }\r\n\r\n private _updateBoundingInfo(updateExtends: boolean, data: Nullable<FloatArray>) {\r\n if (updateExtends) {\r\n this._updateExtend(data);\r\n }\r\n\r\n this._resetPointsArrayCache();\r\n\r\n if (updateExtends) {\r\n const meshes = this._meshes;\r\n for (const mesh of meshes) {\r\n if (mesh.hasBoundingInfo) {\r\n mesh.getBoundingInfo().reConstruct(this._extend.minimum, this._extend.maximum);\r\n } else {\r\n mesh.buildBoundingInfo(this._extend.minimum, this._extend.maximum);\r\n }\r\n\r\n const subMeshes = mesh.subMeshes;\r\n for (const subMesh of subMeshes) {\r\n subMesh.refreshBoundingInfo();\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _bind(\r\n effect: Nullable<Effect>,\r\n indexToBind?: Nullable<DataBuffer>,\r\n overrideVertexBuffers?: { [kind: string]: Nullable<VertexBuffer> },\r\n overrideVertexArrayObjects?: { [key: string]: WebGLVertexArrayObject }\r\n ): void {\r\n if (!effect) {\r\n return;\r\n }\r\n\r\n if (indexToBind === undefined) {\r\n indexToBind = this._indexBuffer;\r\n }\r\n const vbs = this.getVertexBuffers();\r\n\r\n if (!vbs) {\r\n return;\r\n }\r\n\r\n if (indexToBind != this._indexBuffer || (!this._vertexArrayObjects && !overrideVertexArrayObjects)) {\r\n this._engine.bindBuffers(vbs, indexToBind, effect, overrideVertexBuffers);\r\n return;\r\n }\r\n\r\n const vaos = overrideVertexArrayObjects ? overrideVertexArrayObjects : this._vertexArrayObjects;\r\n\r\n // Using VAO\r\n if (!vaos[effect.key]) {\r\n vaos[effect.key] = this._engine.recordVertexArrayObject(vbs, indexToBind, effect, overrideVertexBuffers);\r\n }\r\n\r\n this._engine.bindVertexArrayObject(vaos[effect.key], indexToBind);\r\n }\r\n\r\n /**\r\n * Gets total number of vertices\r\n * @returns the total number of vertices\r\n */\r\n public getTotalVertices(): number {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n\r\n return this._totalVertices;\r\n }\r\n\r\n /**\r\n * Gets a specific vertex data attached to this geometry. Float data is constructed if the vertex buffer data cannot be returned directly.\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns a float array containing vertex data\r\n */\r\n public getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): Nullable<FloatArray> {\r\n const vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return null;\r\n }\r\n\r\n return vertexBuffer.getFloatData(this._totalVertices, forceCopy || (copyWhenShared && this._meshes.length !== 1));\r\n }\r\n\r\n /**\r\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if the vertex buffer with the specified kind is updatable\r\n */\r\n public isVertexBufferUpdatable(kind: string): boolean {\r\n const vb = this._vertexBuffers[kind];\r\n\r\n if (!vb) {\r\n return false;\r\n }\r\n\r\n return vb.isUpdatable();\r\n }\r\n\r\n /**\r\n * Gets a specific vertex buffer\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns a VertexBuffer\r\n */\r\n public getVertexBuffer(kind: string): Nullable<VertexBuffer> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers[kind];\r\n }\r\n\r\n /**\r\n * Returns all vertex buffers\r\n * @returns an object holding all vertex buffers indexed by kind\r\n */\r\n public getVertexBuffers(): Nullable<{ [key: string]: VertexBuffer }> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if specific vertex buffer is present\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if data is present\r\n */\r\n public isVerticesDataPresent(kind: string): boolean {\r\n if (!this._vertexBuffers) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._vertexBuffers[kind] !== undefined;\r\n }\r\n\r\n /**\r\n * Gets a list of all attached data kinds (Position, normal, etc...)\r\n * @returns a list of string containing all kinds\r\n */\r\n public getVerticesDataKinds(): string[] {\r\n const result = [];\r\n let kind;\r\n if (!this._vertexBuffers && this._delayInfo) {\r\n for (kind in this._delayInfo) {\r\n result.push(kind);\r\n }\r\n } else {\r\n for (kind in this._vertexBuffers) {\r\n result.push(kind);\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Update index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n */\r\n public updateIndices(indices: IndicesArray, offset?: number, gpuMemoryOnly = false): void {\r\n if (!this._indexBuffer) {\r\n return;\r\n }\r\n\r\n if (!this._indexBufferIsUpdatable) {\r\n this.setIndices(indices, null, true);\r\n } else {\r\n const needToUpdateSubMeshes = indices.length !== this._indices.length;\r\n\r\n if (!gpuMemoryOnly) {\r\n this._indices = indices.slice();\r\n }\r\n this._engine.updateDynamicIndexBuffer(this._indexBuffer, indices, offset);\r\n if (needToUpdateSubMeshes) {\r\n for (const mesh of this._meshes) {\r\n mesh._createGlobalSubMesh(true);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param totalVertices defines the total number of vertices (could be null)\r\n * @param updatable defines if the index buffer must be flagged as updatable (false by default)\r\n */\r\n public setIndices(indices: IndicesArray, totalVertices: Nullable<number> = null, updatable: boolean = false): void {\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n\r\n this._indices = indices;\r\n this._indexBufferIsUpdatable = updatable;\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, updatable);\r\n }\r\n\r\n if (totalVertices != undefined) {\r\n // including null and undefined\r\n this._totalVertices = totalVertices;\r\n }\r\n\r\n for (const mesh of this._meshes) {\r\n mesh._createGlobalSubMesh(true);\r\n mesh.synchronizeInstances();\r\n }\r\n\r\n this._notifyUpdate();\r\n }\r\n\r\n /**\r\n * Return the total number of indices\r\n * @returns the total number of indices\r\n */\r\n public getTotalIndices(): number {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n return this._indices.length;\r\n }\r\n\r\n /**\r\n * Gets the index buffer array\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns the index buffer array\r\n */\r\n public getIndices(copyWhenShared?: boolean, forceCopy?: boolean): Nullable<IndicesArray> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n const orig = this._indices;\r\n if (!forceCopy && (!copyWhenShared || this._meshes.length === 1)) {\r\n return orig;\r\n } else {\r\n return orig.slice();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the index buffer\r\n * @returns the index buffer\r\n */\r\n public getIndexBuffer(): Nullable<DataBuffer> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._indexBuffer;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _releaseVertexArrayObject(effect: Nullable<Effect> = null) {\r\n if (!effect || !this._vertexArrayObjects) {\r\n return;\r\n }\r\n\r\n if (this._vertexArrayObjects[effect.key]) {\r\n this._engine.releaseVertexArrayObject(this._vertexArrayObjects[effect.key]);\r\n delete this._vertexArrayObjects[effect.key];\r\n }\r\n }\r\n\r\n /**\r\n * Release the associated resources for a specific mesh\r\n * @param mesh defines the source mesh\r\n * @param shouldDispose defines if the geometry must be disposed if there is no more mesh pointing to it\r\n */\r\n public releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void {\r\n const meshes = this._meshes;\r\n const index = meshes.indexOf(mesh);\r\n\r\n if (index === -1) {\r\n return;\r\n }\r\n\r\n meshes.splice(index, 1);\r\n\r\n if (this._vertexArrayObjects) {\r\n mesh._invalidateInstanceVertexArrayObject();\r\n }\r\n\r\n mesh._geometry = null;\r\n\r\n if (meshes.length === 0 && shouldDispose) {\r\n this.dispose();\r\n }\r\n }\r\n\r\n /**\r\n * Apply current geometry to a given mesh\r\n * @param mesh defines the mesh to apply geometry to\r\n */\r\n public applyToMesh(mesh: Mesh): void {\r\n if (mesh._geometry === this) {\r\n return;\r\n }\r\n\r\n const previousGeometry = mesh._geometry;\r\n if (previousGeometry) {\r\n previousGeometry.releaseForMesh(mesh);\r\n }\r\n\r\n if (this._vertexArrayObjects) {\r\n mesh._invalidateInstanceVertexArrayObject();\r\n }\r\n\r\n const meshes = this._meshes;\r\n\r\n // must be done before setting vertexBuffers because of mesh._createGlobalSubMesh()\r\n mesh._geometry = this;\r\n mesh._internalAbstractMeshDataInfo._positions = null;\r\n\r\n this._scene.pushGeometry(this);\r\n\r\n meshes.push(mesh);\r\n\r\n if (this.isReady()) {\r\n this._applyToMesh(mesh);\r\n } else if (this._boundingInfo) {\r\n mesh.setBoundingInfo(this._boundingInfo);\r\n }\r\n }\r\n\r\n private _updateExtend(data: Nullable<FloatArray> = null) {\r\n if (this.useBoundingInfoFromGeometry && this._boundingInfo) {\r\n this._extend = {\r\n minimum: this._boundingInfo.minimum.clone(),\r\n maximum: this._boundingInfo.maximum.clone(),\r\n };\r\n } else {\r\n if (!data) {\r\n data = this.getVerticesData(VertexBuffer.PositionKind)!;\r\n // This can happen if the buffer comes from a Hardware Buffer where\r\n // The data have not been uploaded by Babylon. (ex: Compute Shaders and Storage Buffers)\r\n if (!data) {\r\n return;\r\n }\r\n }\r\n\r\n this._extend = extractMinAndMax(data, 0, this._totalVertices, this.boundingBias, 3);\r\n }\r\n }\r\n\r\n private _applyToMesh(mesh: Mesh): void {\r\n const numOfMeshes = this._meshes.length;\r\n\r\n // vertexBuffers\r\n for (const kind in this._vertexBuffers) {\r\n if (numOfMeshes === 1) {\r\n this._vertexBuffers[kind].create();\r\n }\r\n\r\n if (kind === VertexBuffer.PositionKind) {\r\n if (!this._extend) {\r\n this._updateExtend();\r\n }\r\n mesh.buildBoundingInfo(this._extend.minimum, this._extend.maximum);\r\n\r\n mesh._createGlobalSubMesh(mesh.isUnIndexed);\r\n\r\n //bounding info was just created again, world matrix should be applied again.\r\n mesh._updateBoundingInfo();\r\n }\r\n }\r\n\r\n // indexBuffer\r\n if (numOfMeshes === 1 && this._indices && this._indices.length > 0) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, this._updatable);\r\n }\r\n\r\n // morphTargets\r\n mesh._syncGeometryWithMorphTargetManager();\r\n\r\n // instances\r\n mesh.synchronizeInstances();\r\n }\r\n\r\n private _notifyUpdate(kind?: string) {\r\n if (this.onGeometryUpdated) {\r\n this.onGeometryUpdated(this, kind);\r\n }\r\n\r\n if (this._vertexArrayObjects) {\r\n this._disposeVertexArrayObjects();\r\n }\r\n\r\n for (const mesh of this._meshes) {\r\n mesh._markSubMeshesAsAttributesDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Load the geometry if it was flagged as delay loaded\r\n * @param scene defines the hosting scene\r\n * @param onLoaded defines a callback called when the geometry is loaded\r\n */\r\n public load(scene: Scene, onLoaded?: () => void): void {\r\n if (this.delayLoadState === Constants.DELAYLOADSTATE_LOADING) {\r\n return;\r\n }\r\n\r\n if (this.isReady()) {\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n return;\r\n }\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADING;\r\n\r\n this._queueLoad(scene, onLoaded);\r\n }\r\n\r\n private _queueLoad(scene: Scene, onLoaded?: () => void): void {\r\n if (!this.delayLoadingFile) {\r\n return;\r\n }\r\n\r\n scene.addPendingData(this);\r\n scene._loadFile(\r\n this.delayLoadingFile,\r\n (data) => {\r\n if (!this._delayLoadingFunction) {\r\n return;\r\n }\r\n\r\n this._delayLoadingFunction(JSON.parse(data as string), this);\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n this._delayInfo = [];\r\n\r\n scene.removePendingData(this);\r\n\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n for (let index = 0; index < numOfMeshes; index++) {\r\n this._applyToMesh(meshes[index]);\r\n }\r\n\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n },\r\n undefined,\r\n true\r\n );\r\n }\r\n\r\n /**\r\n * Invert the geometry to move from a right handed system to a left handed one.\r\n */\r\n public toLeftHanded(): void {\r\n // Flip faces\r\n const tIndices = this.getIndices(false);\r\n if (tIndices != null && tIndices.length > 0) {\r\n for (let i = 0; i < tIndices.length; i += 3) {\r\n const tTemp = tIndices[i + 0];\r\n tIndices[i + 0] = tIndices[i + 2];\r\n tIndices[i + 2] = tTemp;\r\n }\r\n this.setIndices(tIndices);\r\n }\r\n\r\n // Negate position.z\r\n const tPositions = this.getVerticesData(VertexBuffer.PositionKind, false);\r\n if (tPositions != null && tPositions.length > 0) {\r\n for (let i = 0; i < tPositions.length; i += 3) {\r\n tPositions[i + 2] = -tPositions[i + 2];\r\n }\r\n this.setVerticesData(VertexBuffer.PositionKind, tPositions, false);\r\n }\r\n\r\n // Negate normal.z\r\n const tNormals = this.getVerticesData(VertexBuffer.NormalKind, false);\r\n if (tNormals != null && tNormals.length > 0) {\r\n for (let i = 0; i < tNormals.length; i += 3) {\r\n tNormals[i + 2] = -tNormals[i + 2];\r\n }\r\n this.setVerticesData(VertexBuffer.NormalKind, tNormals, false);\r\n }\r\n }\r\n\r\n // Cache\r\n /** @internal */\r\n public _resetPointsArrayCache(): void {\r\n this._positions = null;\r\n }\r\n\r\n /** @internal */\r\n public _generatePointsArray(): boolean {\r\n if (this._positions) {\r\n return true;\r\n }\r\n\r\n const data = this.getVerticesData(VertexBuffer.PositionKind);\r\n\r\n if (!data || data.length === 0) {\r\n return false;\r\n }\r\n\r\n for (let index = this._positionsCache.length * 3, arrayIdx = this._positionsCache.length; index < data.length; index += 3, ++arrayIdx) {\r\n this._positionsCache[arrayIdx] = Vector3.FromArray(data, index);\r\n }\r\n\r\n for (let index = 0, arrayIdx = 0; index < data.length; index += 3, ++arrayIdx) {\r\n this._positionsCache[arrayIdx].set(data[0 + index], data[1 + index], data[2 + index]);\r\n }\r\n\r\n // just in case the number of positions was reduced, splice the array\r\n this._positionsCache.length = data.length / 3;\r\n\r\n this._positions = this._positionsCache;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Gets a value indicating if the geometry is disposed\r\n * @returns true if the geometry was disposed\r\n */\r\n public isDisposed(): boolean {\r\n return this._isDisposed;\r\n }\r\n\r\n private _disposeVertexArrayObjects(): void {\r\n if (this._vertexArrayObjects) {\r\n for (const kind in this._vertexArrayObjects) {\r\n this._engine.releaseVertexArrayObject(this._vertexArrayObjects[kind]);\r\n }\r\n this._vertexArrayObjects = {}; // Will trigger a rebuild of the VAO if supported\r\n\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n for (let index = 0; index < numOfMeshes; index++) {\r\n meshes[index]._invalidateInstanceVertexArrayObject();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Free all associated resources\r\n */\r\n public dispose(): void {\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n let index: number;\r\n for (index = 0; index < numOfMeshes; index++) {\r\n this.releaseForMesh(meshes[index]);\r\n }\r\n this._meshes.length = 0;\r\n\r\n this._disposeVertexArrayObjects();\r\n\r\n for (const kind in this._vertexBuffers) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n this._vertexBuffers = {};\r\n this._totalVertices = 0;\r\n\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n this._indexBuffer = null;\r\n this._indices = [];\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NONE;\r\n this.delayLoadingFile = null;\r\n this._delayLoadingFunction = null;\r\n this._delayInfo = [];\r\n\r\n this._boundingInfo = null;\r\n\r\n this._scene.removeGeometry(this);\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.geometries.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.geometries.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n this._isDisposed = true;\r\n }\r\n\r\n /**\r\n * Clone the current geometry into a new geometry\r\n * @param id defines the unique ID of the new geometry\r\n * @returns a new geometry object\r\n */\r\n public copy(id: string): Geometry {\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = [];\r\n\r\n const indices = this.getIndices();\r\n if (indices) {\r\n for (let index = 0; index < indices.length; index++) {\r\n (<number[]>vertexData.indices).push(indices[index]);\r\n }\r\n }\r\n\r\n let updatable = false;\r\n let stopChecking = false;\r\n let kind;\r\n for (kind in this._vertexBuffers) {\r\n // using slice() to make a copy of the array and not just reference it\r\n const data = this.getVerticesData(kind);\r\n\r\n if (data) {\r\n if (data instanceof Float32Array) {\r\n vertexData.set(new Float32Array(<Float32Array>data), kind);\r\n } else {\r\n vertexData.set((<number[]>data).slice(0), kind);\r\n }\r\n if (!stopChecking) {\r\n const vb = this.getVertexBuffer(kind);\r\n\r\n if (vb) {\r\n updatable = vb.isUpdatable();\r\n stopChecking = !updatable;\r\n }\r\n }\r\n }\r\n }\r\n\r\n const geometry = new Geometry(id, this._scene, vertexData, updatable);\r\n\r\n geometry.delayLoadState = this.delayLoadState;\r\n geometry.delayLoadingFile = this.delayLoadingFile;\r\n geometry._delayLoadingFunction = this._delayLoadingFunction;\r\n\r\n for (kind in this._delayInfo) {\r\n geometry._delayInfo = geometry._delayInfo || [];\r\n geometry._delayInfo.push(kind);\r\n }\r\n\r\n // Bounding info\r\n geometry._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);\r\n\r\n return geometry;\r\n }\r\n\r\n /**\r\n * Serialize the current geometry info (and not the vertices data) into a JSON object\r\n * @returns a JSON representation of the current geometry data (without the vertices data)\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.id = this.id;\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.updatable = this._updatable;\r\n\r\n if (Tags && Tags.HasTags(this)) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n private _toNumberArray(origin: Nullable<Float32Array | IndicesArray>): number[] {\r\n if (Array.isArray(origin)) {\r\n return origin;\r\n } else {\r\n return Array.prototype.slice.call(origin);\r\n }\r\n }\r\n\r\n /**\r\n * Release any memory retained by the cached data on the Geometry.\r\n *\r\n * Call this function to reduce memory footprint of the mesh.\r\n * Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)\r\n */\r\n public clearCachedData(): void {\r\n this._indices = [];\r\n this._resetPointsArrayCache();\r\n\r\n for (const vbName in this._vertexBuffers) {\r\n if (!Object.prototype.hasOwnProperty.call(this._vertexBuffers, vbName)) {\r\n continue;\r\n }\r\n this._vertexBuffers[vbName]._buffer._data = null;\r\n }\r\n }\r\n\r\n /**\r\n * Serialize all vertices data into a JSON object\r\n * @returns a JSON representation of the current geometry data\r\n */\r\n public serializeVerticeData(): any {\r\n const serializationObject = this.serialize();\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\r\n serializationObject.positions = this._toNumberArray(this.getVerticesData(VertexBuffer.PositionKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.PositionKind)) {\r\n serializationObject.positions._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n serializationObject.normals = this._toNumberArray(this.getVerticesData(VertexBuffer.NormalKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.NormalKind)) {\r\n serializationObject.normals._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.TangentKind)) {\r\n serializationObject.tangents = this._toNumberArray(this.getVerticesData(VertexBuffer.TangentKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.TangentKind)) {\r\n serializationObject.tangents._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n serializationObject.uvs = this._toNumberArray(this.getVerticesData(VertexBuffer.UVKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UVKind)) {\r\n serializationObject.uvs._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\r\n serializationObject.uvs2 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV2Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV2Kind)) {\r\n serializationObject.uvs2._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV3Kind)) {\r\n serializationObject.uvs3 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV3Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV3Kind)) {\r\n serializationObject.uvs3._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV4Kind)) {\r\n serializationObject.uvs4 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV4Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV4Kind)) {\r\n serializationObject.uvs4._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV5Kind)) {\r\n serializationObject.uvs5 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV5Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV5Kind)) {\r\n serializationObject.uvs5._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV6Kind)) {\r\n serializationObject.uvs6 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV6Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV6Kind)) {\r\n serializationObject.uvs6._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.ColorKind)) {\r\n serializationObject.colors = this._toNumberArray(this.getVerticesData(VertexBuffer.ColorKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.ColorKind)) {\r\n serializationObject.colors._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\r\n serializationObject.matricesIndices = this._toNumberArray(this.getVerticesData(VertexBuffer.MatricesIndicesKind));\r\n serializationObject.matricesIndices._isExpanded = true;\r\n if (this.isVertexBufferUpdatable(VertexBuffer.MatricesIndicesKind)) {\r\n serializationObject.matricesIndices._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\r\n serializationObject.matricesWeights = this._toNumberArray(this.getVerticesData(VertexBuffer.MatricesWeightsKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.MatricesWeightsKind)) {\r\n serializationObject.matricesWeights._updatable = true;\r\n }\r\n }\r\n\r\n serializationObject.indices = this._toNumberArray(this.getIndices());\r\n\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n\r\n /**\r\n * Extracts a clone of a mesh geometry\r\n * @param mesh defines the source mesh\r\n * @param id defines the unique ID of the new geometry object\r\n * @returns the new geometry object\r\n */\r\n public static ExtractFromMesh(mesh: Mesh, id: string): Nullable<Geometry> {\r\n const geometry = mesh._geometry;\r\n\r\n if (!geometry) {\r\n return null;\r\n }\r\n\r\n return geometry.copy(id);\r\n }\r\n\r\n /**\r\n * You should now use Tools.RandomId(), this method is still here for legacy reasons.\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a string containing a new GUID\r\n */\r\n public static RandomId(): string {\r\n return Tools.RandomId();\r\n }\r\n\r\n private static _GetGeometryByLoadedUniqueId(uniqueId: string, scene: Scene) {\r\n for (let index = 0; index < scene.geometries.length; index++) {\r\n if (scene.geometries[index]._loadedUniqueId === uniqueId) {\r\n return scene.geometries[index];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _ImportGeometry(parsedGeometry: any, mesh: Mesh): void {\r\n const scene = mesh.getScene();\r\n\r\n // Geometry\r\n const geometryUniqueId = parsedGeometry.geometryUniqueId;\r\n const geometryId = parsedGeometry.geometryId;\r\n if (geometryUniqueId || geometryId) {\r\n const geometry = geometryUniqueId ? this._GetGeometryByLoadedUniqueId(geometryUniqueId, scene) : scene.getGeometryById(geometryId);\r\n if (geometry) {\r\n geometry.applyToMesh(mesh);\r\n }\r\n } else if (parsedGeometry instanceof ArrayBuffer) {\r\n const binaryInfo = mesh._binaryInfo;\r\n\r\n if (binaryInfo.positionsAttrDesc && binaryInfo.positionsAttrDesc.count > 0) {\r\n const positionsData = new Float32Array(parsedGeometry, binaryInfo.positionsAttrDesc.offset, binaryInfo.positionsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.PositionKind, positionsData, false);\r\n }\r\n\r\n if (binaryInfo.normalsAttrDesc && binaryInfo.normalsAttrDesc.count > 0) {\r\n const normalsData = new Float32Array(parsedGeometry, binaryInfo.normalsAttrDesc.offset, binaryInfo.normalsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.NormalKind, normalsData, false);\r\n }\r\n\r\n if (binaryInfo.tangetsAttrDesc && binaryInfo.tangetsAttrDesc.count > 0) {\r\n const tangentsData = new Float32Array(parsedGeometry, binaryInfo.tangetsAttrDesc.offset, binaryInfo.tangetsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.TangentKind, tangentsData, false);\r\n }\r\n\r\n if (binaryInfo.uvsAttrDesc && binaryInfo.uvsAttrDesc.count > 0) {\r\n const uvsData = new Float32Array(parsedGeometry, binaryInfo.uvsAttrDesc.offset, binaryInfo.uvsAttrDesc.count);\r\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvsData.length; index += 2) {\r\n uvsData[index] = 1 - uvsData[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UVKind, uvsData, false);\r\n }\r\n\r\n if (binaryInfo.uvs2AttrDesc && binaryInfo.uvs2AttrDesc.count > 0) {\r\n const uvs2Data = new Float32Array(parsedGeometry, binaryInfo.uvs2AttrDesc.offset, binaryInfo.uvs2AttrDesc.count);\r\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs2Data.length; index += 2) {\r\n uvs2Data[index] = 1 - uvs2Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV2Kind, uvs2Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs3AttrDesc && binaryInfo.uvs3AttrDesc.count > 0) {\r\n const uvs3Data = new Float32Array(parsedGeometry, binaryInfo.uvs3AttrDesc.offset, binaryInfo.uvs3AttrDesc.count);\r\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs3Data.length; index += 2) {\r\n uvs3Data[index] = 1 - uvs3Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV3Kind, uvs3Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs4AttrDesc && binaryInfo.uvs4AttrDesc.count > 0) {\r\n const uvs4Data = new Float32Array(parsedGeometry, binaryInfo.uvs4AttrDesc.offset, binaryInfo.uvs4AttrDesc.count);\r\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs4Data.length; index += 2) {\r\n uvs4Data[index] = 1 - uvs4Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV4Kind, uvs4Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs5AttrDesc && binaryInfo.uvs5AttrDesc.count > 0) {\r\n const uvs5Data = new Float32Array(parsedGeometry, binaryInfo.uvs5AttrDesc.offset, binaryInfo.uvs5AttrDesc.count);\r\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs5Data.length; index += 2) {\r\n uvs5Data[index] = 1 - uvs5Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV5Kind, uvs5Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs6AttrDesc && binaryInfo.uvs6AttrDesc.count > 0) {\r\n const uvs6Data = new Float32Array(parsedGeometry, binaryInfo.uvs6AttrDesc.offset, binaryInfo.uvs6AttrDesc.count);\r\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs6Data.length; index += 2) {\r\n uvs6Data[index] = 1 - uvs6Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV6Kind, uvs6Data, false);\r\n }\r\n\r\n if (binaryInfo.colorsAttrDesc && binaryInfo.colorsAttrDesc.count > 0) {\r\n const colorsData = new Float32Array(parsedGeometry, binaryInfo.colorsAttrDesc.offset, binaryInfo.colorsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.ColorKind, colorsData, false, binaryInfo.colorsAttrDesc.stride);\r\n }\r\n\r\n if (binaryInfo.matricesIndicesAttrDesc && binaryInfo.matricesIndicesAttrDesc.count > 0) {\r\n const matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesAttrDesc.offset, binaryInfo.matricesIndicesAttrDesc.count);\r\n const floatIndices = [];\r\n for (let i = 0; i < matricesIndicesData.length; i++) {\r\n const index = matricesIndicesData[i];\r\n floatIndices.push(index & 0x000000ff);\r\n floatIndices.push((index & 0x0000ff00) >> 8);\r\n floatIndices.push((index & 0x00ff0000) >> 16);\r\n floatIndices.push((index >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, false);\r\n }\r\n\r\n if (binaryInfo.matricesIndicesExtraAttrDesc && binaryInfo.matricesIndicesExtraAttrDesc.count > 0) {\r\n const matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesExtraAttrDesc.offset, binaryInfo.matricesIndicesExtraAttrDesc.count);\r\n const floatIndices = [];\r\n for (let i = 0; i < matricesIndicesData.length; i++) {\r\n const index = matricesIndicesData[i];\r\n floatIndices.push(index & 0x000000ff);\r\n floatIndices.push((index & 0x0000ff00) >> 8);\r\n floatIndices.push((index & 0x00ff0000) >> 16);\r\n floatIndices.push((index >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, floatIndices, false);\r\n }\r\n\r\n if (binaryInfo.matricesWeightsAttrDesc && binaryInfo.matricesWeightsAttrDesc.count > 0) {\r\n const matricesWeightsData = new Float32Array(parsedGeometry, binaryInfo.matricesWeightsAttrDesc.offset, binaryInfo.matricesWeightsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeightsData, false);\r\n }\r\n\r\n if (binaryInfo.indicesAttrDesc && binaryInfo.indicesAttrDesc.count > 0) {\r\n const indicesData = new Int32Array(parsedGeometry, binaryInfo.indicesAttrDesc.offset, binaryInfo.indicesAttrDesc.count);\r\n mesh.setIndices(indicesData, null);\r\n }\r\n\r\n if (binaryInfo.subMeshesAttrDesc && binaryInfo.subMeshesAttrDesc.count > 0) {\r\n const subMeshesData = new Int32Array(parsedGeometry, binaryInfo.subMeshesAttrDesc.offset, binaryInfo.subMeshesAttrDesc.count * 5);\r\n\r\n mesh.subMeshes = [];\r\n for (let i = 0; i < binaryInfo.subMeshesAttrDesc.count; i++) {\r\n const materialIndex = subMeshesData[i * 5 + 0];\r\n const verticesStart = subMeshesData[i * 5 + 1];\r\n const verticesCount = subMeshesData[i * 5 + 2];\r\n const indexStart = subMeshesData[i * 5 + 3];\r\n const indexCount = subMeshesData[i * 5 + 4];\r\n\r\n SubMesh.AddToMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, <AbstractMesh>mesh);\r\n }\r\n }\r\n } else if (parsedGeometry.positions && parsedGeometry.normals && parsedGeometry.indices) {\r\n mesh.setVerticesData(VertexBuffer.PositionKind, parsedGeometry.positions, parsedGeometry.positions._updatable);\r\n\r\n mesh.setVerticesData(VertexBuffer.NormalKind, parsedGeometry.normals, parsedGeometry.normals._updatable);\r\n\r\n if (parsedGeometry.tangents) {\r\n mesh.setVerticesData(VertexBuffer.TangentKind, parsedGeometry.tangents, parsedGeometry.tangents._updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs) {\r\n mesh.setVerticesData(VertexBuffer.UVKind, parsedGeometry.uvs, parsedGeometry.uvs._updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs2) {\r\n mesh.setVerticesData(VertexBuffer.UV2Kind, parsedGeometry.uvs2, parsedGeometry.uvs2._updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs3) {\r\n mesh.setVerticesData(VertexBuffer.UV3Kind, parsedGeometry.uvs3, parsedGeometry.uvs3._updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs4) {\r\n mesh.setVerticesData(VertexBuffer.UV4Kind, parsedGeometry.uvs4, parsedGeometry.uvs4._updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs5) {\r\n mesh.setVerticesData(VertexBuffer.UV5Kind, parsedGeometry.uvs5, parsedGeometry.uvs5._updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs6) {\r\n mesh.setVerticesData(VertexBuffer.UV6Kind, parsedGeometry.uvs6, parsedGeometry.uvs6._updatable);\r\n }\r\n\r\n if (parsedGeometry.colors) {\r\n mesh.setVerticesData(VertexBuffer.ColorKind, Color4.CheckColors4(parsedGeometry.colors, parsedGeometry.positions.length / 3), parsedGeometry.colors._updatable);\r\n }\r\n\r\n if (parsedGeometry.matricesIndices) {\r\n if (!parsedGeometry.matricesIndices._isExpanded) {\r\n const floatIndices = [];\r\n\r\n for (let i = 0; i < parsedGeometry.matricesIndices.length; i++) {\r\n const matricesIndex = parsedGeometry.matricesIndices[i];\r\n\r\n floatIndices.push(matricesIndex & 0x000000ff);\r\n floatIndices.push((matricesIndex & 0x0000ff00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00ff0000) >> 16);\r\n floatIndices.push((matricesIndex >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, parsedGeometry.matricesIndices._updatable);\r\n } else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, parsedGeometry.matricesIndices, parsedGeometry.matricesIndices._updatable);\r\n }\r\n }\r\n\r\n if (parsedGeometry.matricesIndicesExtra) {\r\n if (!parsedGeometry.matricesIndicesExtra._isExpanded) {\r\n const floatIndices = [];\r\n\r\n for (let i = 0; i < parsedGeometry.matricesIndicesExtra.length; i++) {\r\n const matricesIndex = parsedGeometry.matricesIndicesExtra[i];\r\n\r\n floatIndices.push(matricesIndex & 0x000000ff);\r\n floatIndices.push((matricesIndex & 0x0000ff00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00ff0000) >> 16);\r\n floatIndices.push((matricesIndex >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, floatIndices, parsedGeometry.matricesIndicesExtra._updatable);\r\n } else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, parsedGeometry.matricesIndicesExtra, parsedGeometry.matricesIndicesExtra._updatable);\r\n }\r\n }\r\n\r\n if (parsedGeometry.matricesWeights) {\r\n Geometry._CleanMatricesWeights(parsedGeometry, mesh);\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, parsedGeometry.matricesWeights, parsedGeometry.matricesWeights._updatable);\r\n }\r\n\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsExtraKind, parsedGeometry.matricesWeightsExtra, parsedGeometry.matricesWeights._updatable);\r\n }\r\n\r\n mesh.setIndices(parsedGeometry.indices, null);\r\n }\r\n\r\n // SubMeshes\r\n if (parsedGeometry.subMeshes) {\r\n mesh.subMeshes = [];\r\n for (let subIndex = 0; subIndex < parsedGeometry.subMeshes.length; subIndex++) {\r\n const parsedSubMesh = parsedGeometry.subMeshes[subIndex];\r\n\r\n SubMesh.AddToMesh(\r\n parsedSubMesh.materialIndex,\r\n parsedSubMesh.verticesStart,\r\n parsedSubMesh.verticesCount,\r\n parsedSubMesh.indexStart,\r\n parsedSubMesh.indexCount,\r\n <AbstractMesh>mesh\r\n );\r\n }\r\n }\r\n\r\n // Flat shading\r\n if (mesh._shouldGenerateFlatShading) {\r\n mesh.convertToFlatShadedMesh();\r\n mesh._shouldGenerateFlatShading = false;\r\n }\r\n\r\n // Update\r\n mesh.computeWorldMatrix(true);\r\n\r\n scene.onMeshImportedObservable.notifyObservers(<AbstractMesh>mesh);\r\n }\r\n\r\n private static _CleanMatricesWeights(parsedGeometry: any, mesh: Mesh): void {\r\n const epsilon: number = 1e-3;\r\n if (!SceneLoaderFlags.CleanBoneMatrixWeights) {\r\n return;\r\n }\r\n let noInfluenceBoneIndex = 0.0;\r\n if (parsedGeometry.skeletonId > -1) {\r\n const skeleton = mesh.getScene().getLastSkeletonById(parsedGeometry.skeletonId);\r\n\r\n if (!skeleton) {\r\n return;\r\n }\r\n noInfluenceBoneIndex = skeleton.bones.length;\r\n } else {\r\n return;\r\n }\r\n const matricesIndices = <FloatArray>mesh.getVerticesData(VertexBuffer.MatricesIndicesKind);\r\n const matricesIndicesExtra = <FloatArray>mesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind);\r\n const matricesWeights = parsedGeometry.matricesWeights;\r\n const matricesWeightsExtra = parsedGeometry.matricesWeightsExtra;\r\n const influencers = parsedGeometry.numBoneInfluencer;\r\n const size = matricesWeights.length;\r\n\r\n for (let i = 0; i < size; i += 4) {\r\n let weight = 0.0;\r\n let firstZeroWeight = -1;\r\n for (let j = 0; j < 4; j++) {\r\n const w = matricesWeights[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j;\r\n }\r\n }\r\n if (matricesWeightsExtra) {\r\n for (let j = 0; j < 4; j++) {\r\n const w = matricesWeightsExtra[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j + 4;\r\n }\r\n }\r\n }\r\n if (firstZeroWeight < 0 || firstZeroWeight > influencers - 1) {\r\n firstZeroWeight = influencers - 1;\r\n }\r\n if (weight > epsilon) {\r\n const mweight = 1.0 / weight;\r\n for (let j = 0; j < 4; j++) {\r\n matricesWeights[i + j] *= mweight;\r\n }\r\n if (matricesWeightsExtra) {\r\n for (let j = 0; j < 4; j++) {\r\n matricesWeightsExtra[i + j] *= mweight;\r\n }\r\n }\r\n } else {\r\n if (firstZeroWeight >= 4) {\r\n matricesWeightsExtra[i + firstZeroWeight - 4] = 1.0 - weight;\r\n matricesIndicesExtra[i + firstZeroWeight - 4] = noInfluenceBoneIndex;\r\n } else {\r\n matricesWeights[i + firstZeroWeight] = 1.0 - weight;\r\n matricesIndices[i + firstZeroWeight] = noInfluenceBoneIndex;\r\n }\r\n }\r\n }\r\n\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, matricesIndices);\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, matricesIndicesExtra);\r\n }\r\n }\r\n\r\n /**\r\n * Create a new geometry from persisted data (Using .babylon file format)\r\n * @param parsedVertexData defines the persisted data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url to use to load assets (like delayed data)\r\n * @returns the new geometry object\r\n */\r\n public static Parse(parsedVertexData: any, scene: Scene, rootUrl: string): Nullable<Geometry> {\r\n const geometry = new Geometry(parsedVertexData.id, scene, undefined, parsedVertexData.updatable);\r\n geometry._loadedUniqueId = parsedVertexData.uniqueId;\r\n\r\n if (Tags) {\r\n Tags.AddTagsTo(geometry, parsedVertexData.tags);\r\n }\r\n\r\n if (parsedVertexData.delayLoadingFile) {\r\n geometry.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n geometry.delayLoadingFile = rootUrl + parsedVertexData.delayLoadingFile;\r\n geometry._boundingInfo = new BoundingInfo(Vector3.FromArray(parsedVertexData.boundingBoxMinimum), Vector3.FromArray(parsedVertexData.boundingBoxMaximum));\r\n\r\n geometry._delayInfo = [];\r\n if (parsedVertexData.hasUVs) {\r\n geometry._delayInfo.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs2) {\r\n geometry._delayInfo.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs3) {\r\n geometry._delayInfo.push(VertexBuffer.UV3Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs4) {\r\n geometry._delayInfo.push(VertexBuffer.UV4Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs5) {\r\n geometry._delayInfo.push(VertexBuffer.UV5Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs6) {\r\n geometry._delayInfo.push(VertexBuffer.UV6Kind);\r\n }\r\n\r\n if (parsedVertexData.hasColors) {\r\n geometry._delayInfo.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n if (parsedVertexData.hasMatricesIndices) {\r\n geometry._delayInfo.push(VertexBuffer.MatricesIndicesKind);\r\n }\r\n\r\n if (parsedVertexData.hasMatricesWeights) {\r\n geometry._delayInfo.push(VertexBuffer.MatricesWeightsKind);\r\n }\r\n\r\n geometry._delayLoadingFunction = VertexData.ImportVertexData;\r\n } else {\r\n VertexData.ImportVertexData(parsedVertexData, geometry);\r\n }\r\n\r\n scene.pushGeometry(geometry, true);\r\n\r\n return geometry;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"geometry.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/geometry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAItE;;GAEG;AACH,MAAM,OAAO,QAAQ;IA0DjB;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,YAAY,CAAC,KAAc;QAClC,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;SACtC;aAAM;YACH,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;SACtC;QAED,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAA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I,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;aAClD;YAED,IAAI,gBAAgB,CAAC,SAAS,EAAE;gBAC5B,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;aACpD;YAED,IAAI,gBAAgB,CAAC,kBAAkB,EAAE;gBACrC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;aAC9D;YAED,IAAI,gBAAgB,CAAC,kBAAkB,EAAE;gBACrC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC;aAC9D;YAED,QAAQ,CAAC,qBAAqB,GAAG,UAAU,CAAC,gBAAgB,CAAC;SAChE;aAAM;YACH,UAAU,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;SAC3D;QAED,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAEnC,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ","sourcesContent":["import type { Nullable, FloatArray, DataArray, IndicesArray } from \"../types\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { Vector2 } from \"../Maths/math.vector\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport { Color4 } from \"../Maths/math.color\";\r\nimport type { Engine } from \"../Engines/engine\";\r\nimport type { IGetSetVerticesData } from \"../Meshes/mesh.vertexData\";\r\nimport { VertexData } from \"../Meshes/mesh.vertexData\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { SubMesh } from \"../Meshes/subMesh\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { SceneLoaderFlags } from \"../Loading/sceneLoaderFlags\";\r\nimport { BoundingInfo } from \"../Culling/boundingInfo\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport { Tools } from \"../Misc/tools\";\r\nimport { Tags } from \"../Misc/tags\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\nimport { extractMinAndMax } from \"../Maths/math.functions\";\r\nimport type { AbstractScene } from \"../abstractScene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport { CompatibilityOptions } from \"../Compat/compatibilityOptions\";\r\n\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\n\r\n/**\r\n * Class used to store geometry data (vertex buffers + index buffer)\r\n */\r\nexport class Geometry implements IGetSetVerticesData {\r\n // Members\r\n /**\r\n * Gets or sets the ID of the geometry\r\n */\r\n public id: string;\r\n /**\r\n * Gets or sets the unique ID of the geometry\r\n */\r\n public uniqueId: number;\r\n /**\r\n * Gets the delay loading state of the geometry (none by default which means not delayed)\r\n */\r\n public delayLoadState = Constants.DELAYLOADSTATE_NONE;\r\n /**\r\n * Gets the file containing the data to load when running in delay load state\r\n */\r\n public delayLoadingFile: Nullable<string>;\r\n /**\r\n * Callback called when the geometry is updated\r\n */\r\n public onGeometryUpdated: (geometry: Geometry, kind?: string) => void;\r\n\r\n // Private\r\n private _scene: Scene;\r\n private _engine: Engine;\r\n private _meshes: Mesh[];\r\n private _totalVertices = 0;\r\n /** @internal */\r\n public _loadedUniqueId: string;\r\n /** @internal */\r\n public _indices: IndicesArray;\r\n /** @internal */\r\n public _vertexBuffers: { [key: string]: VertexBuffer };\r\n private _isDisposed = false;\r\n private _extend: { minimum: Vector3; maximum: Vector3 };\r\n private _boundingBias: Vector2;\r\n /** @internal */\r\n public _delayInfo: Array<string>;\r\n private _indexBuffer: Nullable<DataBuffer>;\r\n private _indexBufferIsUpdatable = false;\r\n /** @internal */\r\n public _boundingInfo: Nullable<BoundingInfo>;\r\n /** @internal */\r\n public _delayLoadingFunction: Nullable<(any: any, geometry: Geometry) => void>;\r\n /** @internal */\r\n public _softwareSkinningFrameId: number;\r\n private _vertexArrayObjects: { [key: string]: WebGLVertexArrayObject };\r\n private _updatable: boolean;\r\n\r\n // Cache\r\n /** @internal */\r\n public _positions: Nullable<Vector3[]>;\r\n private _positionsCache: Vector3[] = [];\r\n\r\n /** @internal */\r\n public _parentContainer: Nullable<AbstractScene> = null;\r\n\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n public get boundingBias(): Vector2 {\r\n return this._boundingBias;\r\n }\r\n\r\n /**\r\n * Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y\r\n */\r\n public set boundingBias(value: Vector2) {\r\n if (this._boundingBias) {\r\n this._boundingBias.copyFrom(value);\r\n } else {\r\n this._boundingBias = value.clone();\r\n }\r\n\r\n this._updateBoundingInfo(true, null);\r\n }\r\n\r\n /**\r\n * Static function used to attach a new empty geometry to a mesh\r\n * @param mesh defines the mesh to attach the geometry to\r\n * @returns the new Geometry\r\n */\r\n public static CreateGeometryForMesh(mesh: Mesh): Geometry {\r\n const geometry = new Geometry(Geometry.RandomId(), mesh.getScene());\r\n\r\n geometry.applyToMesh(mesh);\r\n\r\n return geometry;\r\n }\r\n\r\n /** Get the list of meshes using this geometry */\r\n public get meshes(): Mesh[] {\r\n return this._meshes;\r\n }\r\n\r\n /**\r\n * If set to true (false by default), the bounding info applied to the meshes sharing this geometry will be the bounding info defined at the class level\r\n * and won't be computed based on the vertex positions (which is what we get when useBoundingInfoFromGeometry = false)\r\n */\r\n public useBoundingInfoFromGeometry = false;\r\n\r\n /**\r\n * Creates a new geometry\r\n * @param id defines the unique ID\r\n * @param scene defines the hosting scene\r\n * @param vertexData defines the VertexData used to get geometry data\r\n * @param updatable defines if geometry must be updatable (false by default)\r\n * @param mesh defines the mesh that will be associated with the geometry\r\n */\r\n constructor(id: string, scene?: Scene, vertexData?: VertexData, updatable: boolean = false, mesh: Nullable<Mesh> = null) {\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n if (!this._scene) {\r\n return;\r\n }\r\n this.id = id;\r\n this.uniqueId = this._scene.getUniqueId();\r\n this._engine = this._scene.getEngine();\r\n this._meshes = [];\r\n //Init vertex buffer cache\r\n this._vertexBuffers = {};\r\n this._indices = [];\r\n this._updatable = updatable;\r\n\r\n // vertexData\r\n if (vertexData) {\r\n this.setAllVerticesData(vertexData, updatable);\r\n } else {\r\n this._totalVertices = 0;\r\n }\r\n\r\n if (this._engine.getCaps().vertexArrayObject) {\r\n this._vertexArrayObjects = {};\r\n }\r\n\r\n // applyToMesh\r\n if (mesh) {\r\n this.applyToMesh(mesh);\r\n mesh.computeWorldMatrix(true);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the current extend of the geometry\r\n */\r\n public get extend(): { minimum: Vector3; maximum: Vector3 } {\r\n return this._extend;\r\n }\r\n\r\n /**\r\n * Gets the hosting scene\r\n * @returns the hosting Scene\r\n */\r\n public getScene(): Scene {\r\n return this._scene;\r\n }\r\n\r\n /**\r\n * Gets the hosting engine\r\n * @returns the hosting Engine\r\n */\r\n public getEngine(): Engine {\r\n return this._engine;\r\n }\r\n\r\n /**\r\n * Defines if the geometry is ready to use\r\n * @returns true if the geometry is ready to be used\r\n */\r\n public isReady(): boolean {\r\n return this.delayLoadState === Constants.DELAYLOADSTATE_LOADED || this.delayLoadState === Constants.DELAYLOADSTATE_NONE;\r\n }\r\n\r\n /**\r\n * Gets a value indicating that the geometry should not be serialized\r\n */\r\n public get doNotSerialize(): boolean {\r\n for (let index = 0; index < this._meshes.length; index++) {\r\n if (!this._meshes[index].doNotSerialize) {\r\n return false;\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public _rebuild(): void {\r\n if (this._vertexArrayObjects) {\r\n this._vertexArrayObjects = {};\r\n }\r\n\r\n // Index buffer\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, this._updatable);\r\n }\r\n\r\n // Vertex buffers\r\n for (const key in this._vertexBuffers) {\r\n const vertexBuffer = <VertexBuffer>this._vertexBuffers[key];\r\n vertexBuffer._rebuild();\r\n }\r\n }\r\n\r\n /**\r\n * Affects all geometry data in one call\r\n * @param vertexData defines the geometry data\r\n * @param updatable defines if the geometry must be flagged as updatable (false as default)\r\n */\r\n public setAllVerticesData(vertexData: VertexData, updatable?: boolean): void {\r\n vertexData.applyToGeometry(this, updatable);\r\n this._notifyUpdate();\r\n }\r\n\r\n /**\r\n * Set specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the vertex data to use\r\n * @param updatable defines if the vertex must be flagged as updatable (false as default)\r\n * @param stride defines the stride to use (0 by default). This value is deduced from the kind value if not specified\r\n */\r\n public setVerticesData(kind: string, data: FloatArray, updatable: boolean = false, stride?: number): void {\r\n if (updatable && Array.isArray(data)) {\r\n // to avoid converting to Float32Array at each draw call in engine.updateDynamicVertexBuffer, we make the conversion a single time here\r\n data = new Float32Array(data);\r\n }\r\n const buffer = new VertexBuffer(this._engine, data, kind, {\r\n updatable,\r\n postponeInternalCreation: this._meshes.length === 0,\r\n stride,\r\n label: \"Geometry_\" + this.id + \"_\" + kind,\r\n });\r\n this.setVerticesBuffer(buffer);\r\n }\r\n\r\n /**\r\n * Removes a specific vertex data\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n */\r\n public removeVerticesData(kind: string) {\r\n if (this._vertexBuffers[kind]) {\r\n this._vertexBuffers[kind].dispose();\r\n delete this._vertexBuffers[kind];\r\n }\r\n\r\n if (this._vertexArrayObjects) {\r\n this._disposeVertexArrayObjects();\r\n }\r\n }\r\n\r\n /**\r\n * Affect a vertex buffer to the geometry. the vertexBuffer.getKind() function is used to determine where to store the data\r\n * @param buffer defines the vertex buffer to use\r\n * @param totalVertices defines the total number of vertices for position kind (could be null)\r\n * @param disposeExistingBuffer disposes the existing buffer, if any (default: true)\r\n */\r\n public setVerticesBuffer(buffer: VertexBuffer, totalVertices: Nullable<number> = null, disposeExistingBuffer = true): void {\r\n const kind = buffer.getKind();\r\n if (this._vertexBuffers[kind] && disposeExistingBuffer) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n\r\n if (buffer._buffer) {\r\n buffer._buffer._increaseReferences();\r\n }\r\n\r\n this._vertexBuffers[kind] = buffer;\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n\r\n if (kind === VertexBuffer.PositionKind) {\r\n const data = <FloatArray>buffer.getData();\r\n if (totalVertices != null) {\r\n this._totalVertices = totalVertices;\r\n } else {\r\n if (data != null) {\r\n this._totalVertices =\r\n data.length / (buffer.type === VertexBuffer.BYTE || buffer.type === VertexBuffer.UNSIGNED_BYTE ? buffer.byteStride : buffer.byteStride / 4);\r\n }\r\n }\r\n\r\n this._updateExtend(data);\r\n this._resetPointsArrayCache();\r\n\r\n for (let index = 0; index < numOfMeshes; index++) {\r\n const mesh = meshes[index];\r\n mesh.buildBoundingInfo(this._extend.minimum, this._extend.maximum);\r\n mesh._createGlobalSubMesh(mesh.isUnIndexed);\r\n mesh.computeWorldMatrix(true);\r\n mesh.synchronizeInstances();\r\n }\r\n }\r\n\r\n this._notifyUpdate(kind);\r\n }\r\n\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will directly update the underlying DataBuffer according to the passed numeric array or Float32Array\r\n * It will do nothing if the buffer is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param useBytes set to true if the offset is in bytes\r\n */\r\n public updateVerticesDataDirectly(kind: string, data: DataArray, offset: number, useBytes: boolean = false): void {\r\n const vertexBuffer = this.getVertexBuffer(kind);\r\n\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n\r\n vertexBuffer.updateDirectly(data, offset, useBytes);\r\n this._notifyUpdate(kind);\r\n }\r\n\r\n /**\r\n * Update a specific vertex buffer\r\n * This function will create a new buffer if the current one is not updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param data defines the data to use\r\n * @param updateExtends defines if the geometry extends must be recomputed (false by default)\r\n */\r\n public updateVerticesData(kind: string, data: FloatArray, updateExtends: boolean = false): void {\r\n const vertexBuffer = this.getVertexBuffer(kind);\r\n\r\n if (!vertexBuffer) {\r\n return;\r\n }\r\n\r\n vertexBuffer.update(data);\r\n\r\n if (kind === VertexBuffer.PositionKind) {\r\n this._updateBoundingInfo(updateExtends, data);\r\n }\r\n this._notifyUpdate(kind);\r\n }\r\n\r\n private _updateBoundingInfo(updateExtends: boolean, data: Nullable<FloatArray>) {\r\n if (updateExtends) {\r\n this._updateExtend(data);\r\n }\r\n\r\n this._resetPointsArrayCache();\r\n\r\n if (updateExtends) {\r\n const meshes = this._meshes;\r\n for (const mesh of meshes) {\r\n if (mesh.hasBoundingInfo) {\r\n mesh.getBoundingInfo().reConstruct(this._extend.minimum, this._extend.maximum);\r\n } else {\r\n mesh.buildBoundingInfo(this._extend.minimum, this._extend.maximum);\r\n }\r\n\r\n const subMeshes = mesh.subMeshes;\r\n for (const subMesh of subMeshes) {\r\n subMesh.refreshBoundingInfo();\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _bind(\r\n effect: Nullable<Effect>,\r\n indexToBind?: Nullable<DataBuffer>,\r\n overrideVertexBuffers?: { [kind: string]: Nullable<VertexBuffer> },\r\n overrideVertexArrayObjects?: { [key: string]: WebGLVertexArrayObject }\r\n ): void {\r\n if (!effect) {\r\n return;\r\n }\r\n\r\n if (indexToBind === undefined) {\r\n indexToBind = this._indexBuffer;\r\n }\r\n const vbs = this.getVertexBuffers();\r\n\r\n if (!vbs) {\r\n return;\r\n }\r\n\r\n if (indexToBind != this._indexBuffer || (!this._vertexArrayObjects && !overrideVertexArrayObjects)) {\r\n this._engine.bindBuffers(vbs, indexToBind, effect, overrideVertexBuffers);\r\n return;\r\n }\r\n\r\n const vaos = overrideVertexArrayObjects ? overrideVertexArrayObjects : this._vertexArrayObjects;\r\n\r\n // Using VAO\r\n if (!vaos[effect.key]) {\r\n vaos[effect.key] = this._engine.recordVertexArrayObject(vbs, indexToBind, effect, overrideVertexBuffers);\r\n }\r\n\r\n this._engine.bindVertexArrayObject(vaos[effect.key], indexToBind);\r\n }\r\n\r\n /**\r\n * Gets total number of vertices\r\n * @returns the total number of vertices\r\n */\r\n public getTotalVertices(): number {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n\r\n return this._totalVertices;\r\n }\r\n\r\n /**\r\n * Gets a specific vertex data attached to this geometry. Float data is constructed if the vertex buffer data cannot be returned directly.\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns a float array containing vertex data\r\n */\r\n public getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): Nullable<FloatArray> {\r\n const vertexBuffer = this.getVertexBuffer(kind);\r\n if (!vertexBuffer) {\r\n return null;\r\n }\r\n\r\n return vertexBuffer.getFloatData(this._totalVertices, forceCopy || (copyWhenShared && this._meshes.length !== 1));\r\n }\r\n\r\n /**\r\n * Returns a boolean defining if the vertex data for the requested `kind` is updatable\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if the vertex buffer with the specified kind is updatable\r\n */\r\n public isVertexBufferUpdatable(kind: string): boolean {\r\n const vb = this._vertexBuffers[kind];\r\n\r\n if (!vb) {\r\n return false;\r\n }\r\n\r\n return vb.isUpdatable();\r\n }\r\n\r\n /**\r\n * Gets a specific vertex buffer\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns a VertexBuffer\r\n */\r\n public getVertexBuffer(kind: string): Nullable<VertexBuffer> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers[kind];\r\n }\r\n\r\n /**\r\n * Returns all vertex buffers\r\n * @returns an object holding all vertex buffers indexed by kind\r\n */\r\n public getVertexBuffers(): Nullable<{ [key: string]: VertexBuffer }> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._vertexBuffers;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if specific vertex buffer is present\r\n * @param kind defines the data kind (Position, normal, etc...)\r\n * @returns true if data is present\r\n */\r\n public isVerticesDataPresent(kind: string): boolean {\r\n if (!this._vertexBuffers) {\r\n if (this._delayInfo) {\r\n return this._delayInfo.indexOf(kind) !== -1;\r\n }\r\n return false;\r\n }\r\n return this._vertexBuffers[kind] !== undefined;\r\n }\r\n\r\n /**\r\n * Gets a list of all attached data kinds (Position, normal, etc...)\r\n * @returns a list of string containing all kinds\r\n */\r\n public getVerticesDataKinds(): string[] {\r\n const result = [];\r\n let kind;\r\n if (!this._vertexBuffers && this._delayInfo) {\r\n for (kind in this._delayInfo) {\r\n result.push(kind);\r\n }\r\n } else {\r\n for (kind in this._vertexBuffers) {\r\n result.push(kind);\r\n }\r\n }\r\n\r\n return result;\r\n }\r\n\r\n /**\r\n * Update index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param offset defines the offset in the target buffer where to store the data\r\n * @param gpuMemoryOnly defines a boolean indicating that only the GPU memory must be updated leaving the CPU version of the indices unchanged (false by default)\r\n */\r\n public updateIndices(indices: IndicesArray, offset?: number, gpuMemoryOnly = false): void {\r\n if (!this._indexBuffer) {\r\n return;\r\n }\r\n\r\n if (!this._indexBufferIsUpdatable) {\r\n this.setIndices(indices, null, true);\r\n } else {\r\n const needToUpdateSubMeshes = indices.length !== this._indices.length;\r\n\r\n if (!gpuMemoryOnly) {\r\n this._indices = indices.slice();\r\n }\r\n this._engine.updateDynamicIndexBuffer(this._indexBuffer, indices, offset);\r\n if (needToUpdateSubMeshes) {\r\n for (const mesh of this._meshes) {\r\n mesh._createGlobalSubMesh(true);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Creates a new index buffer\r\n * @param indices defines the indices to store in the index buffer\r\n * @param totalVertices defines the total number of vertices (could be null)\r\n * @param updatable defines if the index buffer must be flagged as updatable (false by default)\r\n */\r\n public setIndices(indices: IndicesArray, totalVertices: Nullable<number> = null, updatable: boolean = false): void {\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n\r\n this._indices = indices;\r\n this._indexBufferIsUpdatable = updatable;\r\n if (this._meshes.length !== 0 && this._indices) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, updatable);\r\n }\r\n\r\n if (totalVertices != undefined) {\r\n // including null and undefined\r\n this._totalVertices = totalVertices;\r\n }\r\n\r\n for (const mesh of this._meshes) {\r\n mesh._createGlobalSubMesh(true);\r\n mesh.synchronizeInstances();\r\n }\r\n\r\n this._notifyUpdate();\r\n }\r\n\r\n /**\r\n * Return the total number of indices\r\n * @returns the total number of indices\r\n */\r\n public getTotalIndices(): number {\r\n if (!this.isReady()) {\r\n return 0;\r\n }\r\n return this._indices.length;\r\n }\r\n\r\n /**\r\n * Gets the index buffer array\r\n * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes\r\n * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it\r\n * @returns the index buffer array\r\n */\r\n public getIndices(copyWhenShared?: boolean, forceCopy?: boolean): Nullable<IndicesArray> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n const orig = this._indices;\r\n if (!forceCopy && (!copyWhenShared || this._meshes.length === 1)) {\r\n return orig;\r\n } else {\r\n return orig.slice();\r\n }\r\n }\r\n\r\n /**\r\n * Gets the index buffer\r\n * @returns the index buffer\r\n */\r\n public getIndexBuffer(): Nullable<DataBuffer> {\r\n if (!this.isReady()) {\r\n return null;\r\n }\r\n return this._indexBuffer;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _releaseVertexArrayObject(effect: Nullable<Effect> = null) {\r\n if (!effect || !this._vertexArrayObjects) {\r\n return;\r\n }\r\n\r\n if (this._vertexArrayObjects[effect.key]) {\r\n this._engine.releaseVertexArrayObject(this._vertexArrayObjects[effect.key]);\r\n delete this._vertexArrayObjects[effect.key];\r\n }\r\n }\r\n\r\n /**\r\n * Release the associated resources for a specific mesh\r\n * @param mesh defines the source mesh\r\n * @param shouldDispose defines if the geometry must be disposed if there is no more mesh pointing to it\r\n */\r\n public releaseForMesh(mesh: Mesh, shouldDispose?: boolean): void {\r\n const meshes = this._meshes;\r\n const index = meshes.indexOf(mesh);\r\n\r\n if (index === -1) {\r\n return;\r\n }\r\n\r\n meshes.splice(index, 1);\r\n\r\n if (this._vertexArrayObjects) {\r\n mesh._invalidateInstanceVertexArrayObject();\r\n }\r\n\r\n mesh._geometry = null;\r\n\r\n if (meshes.length === 0 && shouldDispose) {\r\n this.dispose();\r\n }\r\n }\r\n\r\n /**\r\n * Apply current geometry to a given mesh\r\n * @param mesh defines the mesh to apply geometry to\r\n */\r\n public applyToMesh(mesh: Mesh): void {\r\n if (mesh._geometry === this) {\r\n return;\r\n }\r\n\r\n const previousGeometry = mesh._geometry;\r\n if (previousGeometry) {\r\n previousGeometry.releaseForMesh(mesh);\r\n }\r\n\r\n if (this._vertexArrayObjects) {\r\n mesh._invalidateInstanceVertexArrayObject();\r\n }\r\n\r\n const meshes = this._meshes;\r\n\r\n // must be done before setting vertexBuffers because of mesh._createGlobalSubMesh()\r\n mesh._geometry = this;\r\n mesh._internalAbstractMeshDataInfo._positions = null;\r\n\r\n this._scene.pushGeometry(this);\r\n\r\n meshes.push(mesh);\r\n\r\n if (this.isReady()) {\r\n this._applyToMesh(mesh);\r\n } else if (this._boundingInfo) {\r\n mesh.setBoundingInfo(this._boundingInfo);\r\n }\r\n }\r\n\r\n private _updateExtend(data: Nullable<FloatArray> = null) {\r\n if (this.useBoundingInfoFromGeometry && this._boundingInfo) {\r\n this._extend = {\r\n minimum: this._boundingInfo.minimum.clone(),\r\n maximum: this._boundingInfo.maximum.clone(),\r\n };\r\n } else {\r\n if (!data) {\r\n data = this.getVerticesData(VertexBuffer.PositionKind)!;\r\n // This can happen if the buffer comes from a Hardware Buffer where\r\n // The data have not been uploaded by Babylon. (ex: Compute Shaders and Storage Buffers)\r\n if (!data) {\r\n return;\r\n }\r\n }\r\n\r\n this._extend = extractMinAndMax(data, 0, this._totalVertices, this.boundingBias, 3);\r\n }\r\n }\r\n\r\n private _applyToMesh(mesh: Mesh): void {\r\n const numOfMeshes = this._meshes.length;\r\n\r\n // vertexBuffers\r\n for (const kind in this._vertexBuffers) {\r\n if (numOfMeshes === 1) {\r\n this._vertexBuffers[kind].create();\r\n }\r\n\r\n if (kind === VertexBuffer.PositionKind) {\r\n if (!this._extend) {\r\n this._updateExtend();\r\n }\r\n mesh.buildBoundingInfo(this._extend.minimum, this._extend.maximum);\r\n\r\n mesh._createGlobalSubMesh(mesh.isUnIndexed);\r\n\r\n //bounding info was just created again, world matrix should be applied again.\r\n mesh._updateBoundingInfo();\r\n }\r\n }\r\n\r\n // indexBuffer\r\n if (numOfMeshes === 1 && this._indices && this._indices.length > 0) {\r\n this._indexBuffer = this._engine.createIndexBuffer(this._indices, this._updatable);\r\n }\r\n\r\n // morphTargets\r\n mesh._syncGeometryWithMorphTargetManager();\r\n\r\n // instances\r\n mesh.synchronizeInstances();\r\n }\r\n\r\n private _notifyUpdate(kind?: string) {\r\n if (this.onGeometryUpdated) {\r\n this.onGeometryUpdated(this, kind);\r\n }\r\n\r\n if (this._vertexArrayObjects) {\r\n this._disposeVertexArrayObjects();\r\n }\r\n\r\n for (const mesh of this._meshes) {\r\n mesh._markSubMeshesAsAttributesDirty();\r\n }\r\n }\r\n\r\n /**\r\n * Load the geometry if it was flagged as delay loaded\r\n * @param scene defines the hosting scene\r\n * @param onLoaded defines a callback called when the geometry is loaded\r\n */\r\n public load(scene: Scene, onLoaded?: () => void): void {\r\n if (this.delayLoadState === Constants.DELAYLOADSTATE_LOADING) {\r\n return;\r\n }\r\n\r\n if (this.isReady()) {\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n return;\r\n }\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADING;\r\n\r\n this._queueLoad(scene, onLoaded);\r\n }\r\n\r\n private _queueLoad(scene: Scene, onLoaded?: () => void): void {\r\n if (!this.delayLoadingFile) {\r\n return;\r\n }\r\n\r\n scene.addPendingData(this);\r\n scene._loadFile(\r\n this.delayLoadingFile,\r\n (data) => {\r\n if (!this._delayLoadingFunction) {\r\n return;\r\n }\r\n\r\n this._delayLoadingFunction(JSON.parse(data as string), this);\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_LOADED;\r\n this._delayInfo = [];\r\n\r\n scene.removePendingData(this);\r\n\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n for (let index = 0; index < numOfMeshes; index++) {\r\n this._applyToMesh(meshes[index]);\r\n }\r\n\r\n if (onLoaded) {\r\n onLoaded();\r\n }\r\n },\r\n undefined,\r\n true\r\n );\r\n }\r\n\r\n /**\r\n * Invert the geometry to move from a right handed system to a left handed one.\r\n */\r\n public toLeftHanded(): void {\r\n // Flip faces\r\n const tIndices = this.getIndices(false);\r\n if (tIndices != null && tIndices.length > 0) {\r\n for (let i = 0; i < tIndices.length; i += 3) {\r\n const tTemp = tIndices[i + 0];\r\n tIndices[i + 0] = tIndices[i + 2];\r\n tIndices[i + 2] = tTemp;\r\n }\r\n this.setIndices(tIndices);\r\n }\r\n\r\n // Negate position.z\r\n const tPositions = this.getVerticesData(VertexBuffer.PositionKind, false);\r\n if (tPositions != null && tPositions.length > 0) {\r\n for (let i = 0; i < tPositions.length; i += 3) {\r\n tPositions[i + 2] = -tPositions[i + 2];\r\n }\r\n this.setVerticesData(VertexBuffer.PositionKind, tPositions, false);\r\n }\r\n\r\n // Negate normal.z\r\n const tNormals = this.getVerticesData(VertexBuffer.NormalKind, false);\r\n if (tNormals != null && tNormals.length > 0) {\r\n for (let i = 0; i < tNormals.length; i += 3) {\r\n tNormals[i + 2] = -tNormals[i + 2];\r\n }\r\n this.setVerticesData(VertexBuffer.NormalKind, tNormals, false);\r\n }\r\n }\r\n\r\n // Cache\r\n /** @internal */\r\n public _resetPointsArrayCache(): void {\r\n this._positions = null;\r\n }\r\n\r\n /** @internal */\r\n public _generatePointsArray(): boolean {\r\n if (this._positions) {\r\n return true;\r\n }\r\n\r\n const data = this.getVerticesData(VertexBuffer.PositionKind);\r\n\r\n if (!data || data.length === 0) {\r\n return false;\r\n }\r\n\r\n for (let index = this._positionsCache.length * 3, arrayIdx = this._positionsCache.length; index < data.length; index += 3, ++arrayIdx) {\r\n this._positionsCache[arrayIdx] = Vector3.FromArray(data, index);\r\n }\r\n\r\n for (let index = 0, arrayIdx = 0; index < data.length; index += 3, ++arrayIdx) {\r\n this._positionsCache[arrayIdx].set(data[0 + index], data[1 + index], data[2 + index]);\r\n }\r\n\r\n // just in case the number of positions was reduced, splice the array\r\n this._positionsCache.length = data.length / 3;\r\n\r\n this._positions = this._positionsCache;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Gets a value indicating if the geometry is disposed\r\n * @returns true if the geometry was disposed\r\n */\r\n public isDisposed(): boolean {\r\n return this._isDisposed;\r\n }\r\n\r\n private _disposeVertexArrayObjects(): void {\r\n if (this._vertexArrayObjects) {\r\n for (const kind in this._vertexArrayObjects) {\r\n this._engine.releaseVertexArrayObject(this._vertexArrayObjects[kind]);\r\n }\r\n this._vertexArrayObjects = {}; // Will trigger a rebuild of the VAO if supported\r\n\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n for (let index = 0; index < numOfMeshes; index++) {\r\n meshes[index]._invalidateInstanceVertexArrayObject();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Free all associated resources\r\n */\r\n public dispose(): void {\r\n const meshes = this._meshes;\r\n const numOfMeshes = meshes.length;\r\n let index: number;\r\n for (index = 0; index < numOfMeshes; index++) {\r\n this.releaseForMesh(meshes[index]);\r\n }\r\n this._meshes.length = 0;\r\n\r\n this._disposeVertexArrayObjects();\r\n\r\n for (const kind in this._vertexBuffers) {\r\n this._vertexBuffers[kind].dispose();\r\n }\r\n this._vertexBuffers = {};\r\n this._totalVertices = 0;\r\n\r\n if (this._indexBuffer) {\r\n this._engine._releaseBuffer(this._indexBuffer);\r\n }\r\n this._indexBuffer = null;\r\n this._indices = [];\r\n\r\n this.delayLoadState = Constants.DELAYLOADSTATE_NONE;\r\n this.delayLoadingFile = null;\r\n this._delayLoadingFunction = null;\r\n this._delayInfo = [];\r\n\r\n this._boundingInfo = null;\r\n\r\n this._scene.removeGeometry(this);\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.geometries.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.geometries.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n this._isDisposed = true;\r\n }\r\n\r\n /**\r\n * Clone the current geometry into a new geometry\r\n * @param id defines the unique ID of the new geometry\r\n * @returns a new geometry object\r\n */\r\n public copy(id: string): Geometry {\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = [];\r\n\r\n const indices = this.getIndices();\r\n if (indices) {\r\n for (let index = 0; index < indices.length; index++) {\r\n (<number[]>vertexData.indices).push(indices[index]);\r\n }\r\n }\r\n\r\n let updatable = false;\r\n let stopChecking = false;\r\n let kind;\r\n for (kind in this._vertexBuffers) {\r\n // using slice() to make a copy of the array and not just reference it\r\n const data = this.getVerticesData(kind);\r\n\r\n if (data) {\r\n if (data instanceof Float32Array) {\r\n vertexData.set(new Float32Array(<Float32Array>data), kind);\r\n } else {\r\n vertexData.set((<number[]>data).slice(0), kind);\r\n }\r\n if (!stopChecking) {\r\n const vb = this.getVertexBuffer(kind);\r\n\r\n if (vb) {\r\n updatable = vb.isUpdatable();\r\n stopChecking = !updatable;\r\n }\r\n }\r\n }\r\n }\r\n\r\n const geometry = new Geometry(id, this._scene, vertexData, updatable);\r\n\r\n geometry.delayLoadState = this.delayLoadState;\r\n geometry.delayLoadingFile = this.delayLoadingFile;\r\n geometry._delayLoadingFunction = this._delayLoadingFunction;\r\n\r\n for (kind in this._delayInfo) {\r\n geometry._delayInfo = geometry._delayInfo || [];\r\n geometry._delayInfo.push(kind);\r\n }\r\n\r\n // Bounding info\r\n geometry._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);\r\n\r\n return geometry;\r\n }\r\n\r\n /**\r\n * Serialize the current geometry info (and not the vertices data) into a JSON object\r\n * @returns a JSON representation of the current geometry data (without the vertices data)\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.id = this.id;\r\n serializationObject.uniqueId = this.uniqueId;\r\n serializationObject.updatable = this._updatable;\r\n\r\n if (Tags && Tags.HasTags(this)) {\r\n serializationObject.tags = Tags.GetTags(this);\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n private _toNumberArray(origin: Nullable<Float32Array | IndicesArray>): number[] {\r\n if (Array.isArray(origin)) {\r\n return origin;\r\n } else {\r\n return Array.prototype.slice.call(origin);\r\n }\r\n }\r\n\r\n /**\r\n * Release any memory retained by the cached data on the Geometry.\r\n *\r\n * Call this function to reduce memory footprint of the mesh.\r\n * Vertex buffers will not store CPU data anymore (this will prevent picking, collisions or physics to work correctly)\r\n */\r\n public clearCachedData(): void {\r\n this._indices = [];\r\n this._resetPointsArrayCache();\r\n\r\n for (const vbName in this._vertexBuffers) {\r\n if (!Object.prototype.hasOwnProperty.call(this._vertexBuffers, vbName)) {\r\n continue;\r\n }\r\n this._vertexBuffers[vbName]._buffer._data = null;\r\n }\r\n }\r\n\r\n /**\r\n * Serialize all vertices data into a JSON object\r\n * @returns a JSON representation of the current geometry data\r\n */\r\n public serializeVerticeData(): any {\r\n const serializationObject = this.serialize();\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.PositionKind)) {\r\n serializationObject.positions = this._toNumberArray(this.getVerticesData(VertexBuffer.PositionKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.PositionKind)) {\r\n serializationObject.positions._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {\r\n serializationObject.normals = this._toNumberArray(this.getVerticesData(VertexBuffer.NormalKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.NormalKind)) {\r\n serializationObject.normals._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.TangentKind)) {\r\n serializationObject.tangents = this._toNumberArray(this.getVerticesData(VertexBuffer.TangentKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.TangentKind)) {\r\n serializationObject.tangents._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UVKind)) {\r\n serializationObject.uvs = this._toNumberArray(this.getVerticesData(VertexBuffer.UVKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UVKind)) {\r\n serializationObject.uvs._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV2Kind)) {\r\n serializationObject.uvs2 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV2Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV2Kind)) {\r\n serializationObject.uvs2._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV3Kind)) {\r\n serializationObject.uvs3 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV3Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV3Kind)) {\r\n serializationObject.uvs3._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV4Kind)) {\r\n serializationObject.uvs4 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV4Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV4Kind)) {\r\n serializationObject.uvs4._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV5Kind)) {\r\n serializationObject.uvs5 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV5Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV5Kind)) {\r\n serializationObject.uvs5._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.UV6Kind)) {\r\n serializationObject.uvs6 = this._toNumberArray(this.getVerticesData(VertexBuffer.UV6Kind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.UV6Kind)) {\r\n serializationObject.uvs6._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.ColorKind)) {\r\n serializationObject.colors = this._toNumberArray(this.getVerticesData(VertexBuffer.ColorKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.ColorKind)) {\r\n serializationObject.colors._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {\r\n serializationObject.matricesIndices = this._toNumberArray(this.getVerticesData(VertexBuffer.MatricesIndicesKind));\r\n serializationObject.matricesIndices._isExpanded = true;\r\n if (this.isVertexBufferUpdatable(VertexBuffer.MatricesIndicesKind)) {\r\n serializationObject.matricesIndices._updatable = true;\r\n }\r\n }\r\n\r\n if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {\r\n serializationObject.matricesWeights = this._toNumberArray(this.getVerticesData(VertexBuffer.MatricesWeightsKind));\r\n if (this.isVertexBufferUpdatable(VertexBuffer.MatricesWeightsKind)) {\r\n serializationObject.matricesWeights._updatable = true;\r\n }\r\n }\r\n\r\n serializationObject.indices = this._toNumberArray(this.getIndices());\r\n\r\n return serializationObject;\r\n }\r\n\r\n // Statics\r\n\r\n /**\r\n * Extracts a clone of a mesh geometry\r\n * @param mesh defines the source mesh\r\n * @param id defines the unique ID of the new geometry object\r\n * @returns the new geometry object\r\n */\r\n public static ExtractFromMesh(mesh: Mesh, id: string): Nullable<Geometry> {\r\n const geometry = mesh._geometry;\r\n\r\n if (!geometry) {\r\n return null;\r\n }\r\n\r\n return geometry.copy(id);\r\n }\r\n\r\n /**\r\n * You should now use Tools.RandomId(), this method is still here for legacy reasons.\r\n * Implementation from http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#answer-2117523\r\n * Be aware Math.random() could cause collisions, but:\r\n * \"All but 6 of the 128 bits of the ID are randomly generated, which means that for any two ids, there's a 1 in 2^^122 (or 5.3x10^^36) chance they'll collide\"\r\n * @returns a string containing a new GUID\r\n */\r\n public static RandomId(): string {\r\n return Tools.RandomId();\r\n }\r\n\r\n private static _GetGeometryByLoadedUniqueId(uniqueId: string, scene: Scene) {\r\n for (let index = 0; index < scene.geometries.length; index++) {\r\n if (scene.geometries[index]._loadedUniqueId === uniqueId) {\r\n return scene.geometries[index];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public static _ImportGeometry(parsedGeometry: any, mesh: Mesh): void {\r\n const scene = mesh.getScene();\r\n\r\n // Geometry\r\n const geometryUniqueId = parsedGeometry.geometryUniqueId;\r\n const geometryId = parsedGeometry.geometryId;\r\n if (geometryUniqueId || geometryId) {\r\n const geometry = geometryUniqueId ? this._GetGeometryByLoadedUniqueId(geometryUniqueId, scene) : scene.getGeometryById(geometryId);\r\n if (geometry) {\r\n geometry.applyToMesh(mesh);\r\n }\r\n } else if (parsedGeometry instanceof ArrayBuffer) {\r\n const binaryInfo = mesh._binaryInfo;\r\n\r\n if (binaryInfo.positionsAttrDesc && binaryInfo.positionsAttrDesc.count > 0) {\r\n const positionsData = new Float32Array(parsedGeometry, binaryInfo.positionsAttrDesc.offset, binaryInfo.positionsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.PositionKind, positionsData, false);\r\n }\r\n\r\n if (binaryInfo.normalsAttrDesc && binaryInfo.normalsAttrDesc.count > 0) {\r\n const normalsData = new Float32Array(parsedGeometry, binaryInfo.normalsAttrDesc.offset, binaryInfo.normalsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.NormalKind, normalsData, false);\r\n }\r\n\r\n if (binaryInfo.tangetsAttrDesc && binaryInfo.tangetsAttrDesc.count > 0) {\r\n const tangentsData = new Float32Array(parsedGeometry, binaryInfo.tangetsAttrDesc.offset, binaryInfo.tangetsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.TangentKind, tangentsData, false);\r\n }\r\n\r\n if (binaryInfo.uvsAttrDesc && binaryInfo.uvsAttrDesc.count > 0) {\r\n const uvsData = new Float32Array(parsedGeometry, binaryInfo.uvsAttrDesc.offset, binaryInfo.uvsAttrDesc.count);\r\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvsData.length; index += 2) {\r\n uvsData[index] = 1 - uvsData[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UVKind, uvsData, false);\r\n }\r\n\r\n if (binaryInfo.uvs2AttrDesc && binaryInfo.uvs2AttrDesc.count > 0) {\r\n const uvs2Data = new Float32Array(parsedGeometry, binaryInfo.uvs2AttrDesc.offset, binaryInfo.uvs2AttrDesc.count);\r\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs2Data.length; index += 2) {\r\n uvs2Data[index] = 1 - uvs2Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV2Kind, uvs2Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs3AttrDesc && binaryInfo.uvs3AttrDesc.count > 0) {\r\n const uvs3Data = new Float32Array(parsedGeometry, binaryInfo.uvs3AttrDesc.offset, binaryInfo.uvs3AttrDesc.count);\r\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs3Data.length; index += 2) {\r\n uvs3Data[index] = 1 - uvs3Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV3Kind, uvs3Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs4AttrDesc && binaryInfo.uvs4AttrDesc.count > 0) {\r\n const uvs4Data = new Float32Array(parsedGeometry, binaryInfo.uvs4AttrDesc.offset, binaryInfo.uvs4AttrDesc.count);\r\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs4Data.length; index += 2) {\r\n uvs4Data[index] = 1 - uvs4Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV4Kind, uvs4Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs5AttrDesc && binaryInfo.uvs5AttrDesc.count > 0) {\r\n const uvs5Data = new Float32Array(parsedGeometry, binaryInfo.uvs5AttrDesc.offset, binaryInfo.uvs5AttrDesc.count);\r\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs5Data.length; index += 2) {\r\n uvs5Data[index] = 1 - uvs5Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV5Kind, uvs5Data, false);\r\n }\r\n\r\n if (binaryInfo.uvs6AttrDesc && binaryInfo.uvs6AttrDesc.count > 0) {\r\n const uvs6Data = new Float32Array(parsedGeometry, binaryInfo.uvs6AttrDesc.offset, binaryInfo.uvs6AttrDesc.count);\r\n if (CompatibilityOptions.UseOpenGLOrientationForUV) {\r\n for (let index = 1; index < uvs6Data.length; index += 2) {\r\n uvs6Data[index] = 1 - uvs6Data[index];\r\n }\r\n }\r\n mesh.setVerticesData(VertexBuffer.UV6Kind, uvs6Data, false);\r\n }\r\n\r\n if (binaryInfo.colorsAttrDesc && binaryInfo.colorsAttrDesc.count > 0) {\r\n const colorsData = new Float32Array(parsedGeometry, binaryInfo.colorsAttrDesc.offset, binaryInfo.colorsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.ColorKind, colorsData, false, binaryInfo.colorsAttrDesc.stride);\r\n }\r\n\r\n if (binaryInfo.matricesIndicesAttrDesc && binaryInfo.matricesIndicesAttrDesc.count > 0) {\r\n const matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesAttrDesc.offset, binaryInfo.matricesIndicesAttrDesc.count);\r\n const floatIndices = [];\r\n for (let i = 0; i < matricesIndicesData.length; i++) {\r\n const index = matricesIndicesData[i];\r\n floatIndices.push(index & 0x000000ff);\r\n floatIndices.push((index & 0x0000ff00) >> 8);\r\n floatIndices.push((index & 0x00ff0000) >> 16);\r\n floatIndices.push((index >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, false);\r\n }\r\n\r\n if (binaryInfo.matricesIndicesExtraAttrDesc && binaryInfo.matricesIndicesExtraAttrDesc.count > 0) {\r\n const matricesIndicesData = new Int32Array(parsedGeometry, binaryInfo.matricesIndicesExtraAttrDesc.offset, binaryInfo.matricesIndicesExtraAttrDesc.count);\r\n const floatIndices = [];\r\n for (let i = 0; i < matricesIndicesData.length; i++) {\r\n const index = matricesIndicesData[i];\r\n floatIndices.push(index & 0x000000ff);\r\n floatIndices.push((index & 0x0000ff00) >> 8);\r\n floatIndices.push((index & 0x00ff0000) >> 16);\r\n floatIndices.push((index >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, floatIndices, false);\r\n }\r\n\r\n if (binaryInfo.matricesWeightsAttrDesc && binaryInfo.matricesWeightsAttrDesc.count > 0) {\r\n const matricesWeightsData = new Float32Array(parsedGeometry, binaryInfo.matricesWeightsAttrDesc.offset, binaryInfo.matricesWeightsAttrDesc.count);\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, matricesWeightsData, false);\r\n }\r\n\r\n if (binaryInfo.indicesAttrDesc && binaryInfo.indicesAttrDesc.count > 0) {\r\n const indicesData = new Int32Array(parsedGeometry, binaryInfo.indicesAttrDesc.offset, binaryInfo.indicesAttrDesc.count);\r\n mesh.setIndices(indicesData, null);\r\n }\r\n\r\n if (binaryInfo.subMeshesAttrDesc && binaryInfo.subMeshesAttrDesc.count > 0) {\r\n const subMeshesData = new Int32Array(parsedGeometry, binaryInfo.subMeshesAttrDesc.offset, binaryInfo.subMeshesAttrDesc.count * 5);\r\n\r\n mesh.subMeshes = [];\r\n for (let i = 0; i < binaryInfo.subMeshesAttrDesc.count; i++) {\r\n const materialIndex = subMeshesData[i * 5 + 0];\r\n const verticesStart = subMeshesData[i * 5 + 1];\r\n const verticesCount = subMeshesData[i * 5 + 2];\r\n const indexStart = subMeshesData[i * 5 + 3];\r\n const indexCount = subMeshesData[i * 5 + 4];\r\n\r\n SubMesh.AddToMesh(materialIndex, verticesStart, verticesCount, indexStart, indexCount, <AbstractMesh>mesh);\r\n }\r\n }\r\n } else if (parsedGeometry.positions && parsedGeometry.normals && parsedGeometry.indices) {\r\n mesh.setVerticesData(VertexBuffer.PositionKind, parsedGeometry.positions, parsedGeometry.positions._updatable);\r\n\r\n mesh.setVerticesData(VertexBuffer.NormalKind, parsedGeometry.normals, parsedGeometry.normals._updatable);\r\n\r\n if (parsedGeometry.tangents) {\r\n mesh.setVerticesData(VertexBuffer.TangentKind, parsedGeometry.tangents, parsedGeometry.tangents._updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs) {\r\n mesh.setVerticesData(VertexBuffer.UVKind, parsedGeometry.uvs, parsedGeometry.uvs._updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs2) {\r\n mesh.setVerticesData(VertexBuffer.UV2Kind, parsedGeometry.uvs2, parsedGeometry.uvs2._updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs3) {\r\n mesh.setVerticesData(VertexBuffer.UV3Kind, parsedGeometry.uvs3, parsedGeometry.uvs3._updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs4) {\r\n mesh.setVerticesData(VertexBuffer.UV4Kind, parsedGeometry.uvs4, parsedGeometry.uvs4._updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs5) {\r\n mesh.setVerticesData(VertexBuffer.UV5Kind, parsedGeometry.uvs5, parsedGeometry.uvs5._updatable);\r\n }\r\n\r\n if (parsedGeometry.uvs6) {\r\n mesh.setVerticesData(VertexBuffer.UV6Kind, parsedGeometry.uvs6, parsedGeometry.uvs6._updatable);\r\n }\r\n\r\n if (parsedGeometry.colors) {\r\n mesh.setVerticesData(VertexBuffer.ColorKind, Color4.CheckColors4(parsedGeometry.colors, parsedGeometry.positions.length / 3), parsedGeometry.colors._updatable);\r\n }\r\n\r\n if (parsedGeometry.matricesIndices) {\r\n if (!parsedGeometry.matricesIndices._isExpanded) {\r\n const floatIndices = [];\r\n\r\n for (let i = 0; i < parsedGeometry.matricesIndices.length; i++) {\r\n const matricesIndex = parsedGeometry.matricesIndices[i];\r\n\r\n floatIndices.push(matricesIndex & 0x000000ff);\r\n floatIndices.push((matricesIndex & 0x0000ff00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00ff0000) >> 16);\r\n floatIndices.push((matricesIndex >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, floatIndices, parsedGeometry.matricesIndices._updatable);\r\n } else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, parsedGeometry.matricesIndices, parsedGeometry.matricesIndices._updatable);\r\n }\r\n }\r\n\r\n if (parsedGeometry.matricesIndicesExtra) {\r\n if (!parsedGeometry.matricesIndicesExtra._isExpanded) {\r\n const floatIndices = [];\r\n\r\n for (let i = 0; i < parsedGeometry.matricesIndicesExtra.length; i++) {\r\n const matricesIndex = parsedGeometry.matricesIndicesExtra[i];\r\n\r\n floatIndices.push(matricesIndex & 0x000000ff);\r\n floatIndices.push((matricesIndex & 0x0000ff00) >> 8);\r\n floatIndices.push((matricesIndex & 0x00ff0000) >> 16);\r\n floatIndices.push((matricesIndex >> 24) & 0xff); // & 0xFF to convert to v + 256 if v < 0\r\n }\r\n\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, floatIndices, parsedGeometry.matricesIndicesExtra._updatable);\r\n } else {\r\n delete parsedGeometry.matricesIndices._isExpanded;\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, parsedGeometry.matricesIndicesExtra, parsedGeometry.matricesIndicesExtra._updatable);\r\n }\r\n }\r\n\r\n if (parsedGeometry.matricesWeights) {\r\n Geometry._CleanMatricesWeights(parsedGeometry, mesh);\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsKind, parsedGeometry.matricesWeights, parsedGeometry.matricesWeights._updatable);\r\n }\r\n\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(VertexBuffer.MatricesWeightsExtraKind, parsedGeometry.matricesWeightsExtra, parsedGeometry.matricesWeights._updatable);\r\n }\r\n\r\n mesh.setIndices(parsedGeometry.indices, null);\r\n }\r\n\r\n // SubMeshes\r\n if (parsedGeometry.subMeshes) {\r\n mesh.subMeshes = [];\r\n for (let subIndex = 0; subIndex < parsedGeometry.subMeshes.length; subIndex++) {\r\n const parsedSubMesh = parsedGeometry.subMeshes[subIndex];\r\n\r\n SubMesh.AddToMesh(\r\n parsedSubMesh.materialIndex,\r\n parsedSubMesh.verticesStart,\r\n parsedSubMesh.verticesCount,\r\n parsedSubMesh.indexStart,\r\n parsedSubMesh.indexCount,\r\n <AbstractMesh>mesh\r\n );\r\n }\r\n }\r\n\r\n // Flat shading\r\n if (mesh._shouldGenerateFlatShading) {\r\n mesh.convertToFlatShadedMesh();\r\n mesh._shouldGenerateFlatShading = false;\r\n }\r\n\r\n // Update\r\n mesh.computeWorldMatrix(true);\r\n\r\n scene.onMeshImportedObservable.notifyObservers(<AbstractMesh>mesh);\r\n }\r\n\r\n private static _CleanMatricesWeights(parsedGeometry: any, mesh: Mesh): void {\r\n const epsilon: number = 1e-3;\r\n if (!SceneLoaderFlags.CleanBoneMatrixWeights) {\r\n return;\r\n }\r\n let noInfluenceBoneIndex = 0.0;\r\n if (parsedGeometry.skeletonId > -1) {\r\n const skeleton = mesh.getScene().getLastSkeletonById(parsedGeometry.skeletonId);\r\n\r\n if (!skeleton) {\r\n return;\r\n }\r\n noInfluenceBoneIndex = skeleton.bones.length;\r\n } else {\r\n return;\r\n }\r\n const matricesIndices = <FloatArray>mesh.getVerticesData(VertexBuffer.MatricesIndicesKind);\r\n const matricesIndicesExtra = <FloatArray>mesh.getVerticesData(VertexBuffer.MatricesIndicesExtraKind);\r\n const matricesWeights = parsedGeometry.matricesWeights;\r\n const matricesWeightsExtra = parsedGeometry.matricesWeightsExtra;\r\n const influencers = parsedGeometry.numBoneInfluencer;\r\n const size = matricesWeights.length;\r\n\r\n for (let i = 0; i < size; i += 4) {\r\n let weight = 0.0;\r\n let firstZeroWeight = -1;\r\n for (let j = 0; j < 4; j++) {\r\n const w = matricesWeights[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j;\r\n }\r\n }\r\n if (matricesWeightsExtra) {\r\n for (let j = 0; j < 4; j++) {\r\n const w = matricesWeightsExtra[i + j];\r\n weight += w;\r\n if (w < epsilon && firstZeroWeight < 0) {\r\n firstZeroWeight = j + 4;\r\n }\r\n }\r\n }\r\n if (firstZeroWeight < 0 || firstZeroWeight > influencers - 1) {\r\n firstZeroWeight = influencers - 1;\r\n }\r\n if (weight > epsilon) {\r\n const mweight = 1.0 / weight;\r\n for (let j = 0; j < 4; j++) {\r\n matricesWeights[i + j] *= mweight;\r\n }\r\n if (matricesWeightsExtra) {\r\n for (let j = 0; j < 4; j++) {\r\n matricesWeightsExtra[i + j] *= mweight;\r\n }\r\n }\r\n } else {\r\n if (firstZeroWeight >= 4) {\r\n matricesWeightsExtra[i + firstZeroWeight - 4] = 1.0 - weight;\r\n matricesIndicesExtra[i + firstZeroWeight - 4] = noInfluenceBoneIndex;\r\n } else {\r\n matricesWeights[i + firstZeroWeight] = 1.0 - weight;\r\n matricesIndices[i + firstZeroWeight] = noInfluenceBoneIndex;\r\n }\r\n }\r\n }\r\n\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesKind, matricesIndices);\r\n if (parsedGeometry.matricesWeightsExtra) {\r\n mesh.setVerticesData(VertexBuffer.MatricesIndicesExtraKind, matricesIndicesExtra);\r\n }\r\n }\r\n\r\n /**\r\n * Create a new geometry from persisted data (Using .babylon file format)\r\n * @param parsedVertexData defines the persisted data\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root url to use to load assets (like delayed data)\r\n * @returns the new geometry object\r\n */\r\n public static Parse(parsedVertexData: any, scene: Scene, rootUrl: string): Nullable<Geometry> {\r\n const geometry = new Geometry(parsedVertexData.id, scene, undefined, parsedVertexData.updatable);\r\n geometry._loadedUniqueId = parsedVertexData.uniqueId;\r\n\r\n if (Tags) {\r\n Tags.AddTagsTo(geometry, parsedVertexData.tags);\r\n }\r\n\r\n if (parsedVertexData.delayLoadingFile) {\r\n geometry.delayLoadState = Constants.DELAYLOADSTATE_NOTLOADED;\r\n geometry.delayLoadingFile = rootUrl + parsedVertexData.delayLoadingFile;\r\n geometry._boundingInfo = new BoundingInfo(Vector3.FromArray(parsedVertexData.boundingBoxMinimum), Vector3.FromArray(parsedVertexData.boundingBoxMaximum));\r\n\r\n geometry._delayInfo = [];\r\n if (parsedVertexData.hasUVs) {\r\n geometry._delayInfo.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs2) {\r\n geometry._delayInfo.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs3) {\r\n geometry._delayInfo.push(VertexBuffer.UV3Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs4) {\r\n geometry._delayInfo.push(VertexBuffer.UV4Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs5) {\r\n geometry._delayInfo.push(VertexBuffer.UV5Kind);\r\n }\r\n\r\n if (parsedVertexData.hasUVs6) {\r\n geometry._delayInfo.push(VertexBuffer.UV6Kind);\r\n }\r\n\r\n if (parsedVertexData.hasColors) {\r\n geometry._delayInfo.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n if (parsedVertexData.hasMatricesIndices) {\r\n geometry._delayInfo.push(VertexBuffer.MatricesIndicesKind);\r\n }\r\n\r\n if (parsedVertexData.hasMatricesWeights) {\r\n geometry._delayInfo.push(VertexBuffer.MatricesWeightsKind);\r\n }\r\n\r\n geometry._delayLoadingFunction = VertexData.ImportVertexData;\r\n } else {\r\n VertexData.ImportVertexData(parsedVertexData, geometry);\r\n }\r\n\r\n scene.pushGeometry(geometry, true);\r\n\r\n return geometry;\r\n }\r\n}\r\n"]}
|
package/Misc/videoRecorder.js
CHANGED
|
@@ -44,9 +44,9 @@ export class VideoRecorder {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
this._mediaRecorder = new MediaRecorder(stream, { mimeType: this._options.mimeType });
|
|
47
|
-
this._mediaRecorder.ondataavailable = this._handleDataAvailable
|
|
48
|
-
this._mediaRecorder.onerror = this._handleError
|
|
49
|
-
this._mediaRecorder.onstop = this._handleStop
|
|
47
|
+
this._mediaRecorder.ondataavailable = (evt) => this._handleDataAvailable(evt);
|
|
48
|
+
this._mediaRecorder.onerror = (evt) => this._handleError(evt);
|
|
49
|
+
this._mediaRecorder.onstop = () => this._handleStop();
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* Stops the current recording before the default capture timeout passed in the startRecording function.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"videoRecorder.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/videoRecorder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AA8DhC;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IAOtB;;;;OAIG;IACI,MAAM,CAAC,WAAW,CAAC,MAAc;QACpC,MAAM,MAAM,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAC3C,OAAO,CAAC,CAAC,MAAM,IAAI,OAAa,MAAO,CAAC,aAAa,KAAK,UAAU,CAAC;IACzE,CAAC;IAWD;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IACtD,CAAC;IAED;;;;OAIG;IACH,YAAY,MAAc,EAAE,UAAyC,EAAE;QACnE,IAAI,CAA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AAI,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IAEO,oBAAoB,CAAC,KAAU;QACnC,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,EAAE;YACrB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;SACzC;IACL,CAAC;IAEO,YAAY,CAAC,KAAiB;QAClC,IAAI,CAAC,aAAa,EAAE,CAAC;QAErB,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC7B;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;SAC3B;IACL,CAAC;IAEO,WAAW;QACf,IAAI,CAAC,aAAa,EAAE,CAAC;QAErB,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;SAC9B;QAED,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAExC,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;SAC/C;IACL,CAAC;;AAnKuB,6BAAe,GAAG;IACtC,QAAQ,EAAE,YAAY;IACtB,GAAG,EAAE,EAAE;IACP,gBAAgB,EAAE,IAAI;CACzB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n/* eslint-disable no-var */\r\nimport type { Nullable } from \"../types\";\r\nimport { Tools } from \"./tools\";\r\nimport type { Engine } from \"../Engines/engine\";\r\n\r\ninterface MediaRecorder {\r\n /** Starts recording */\r\n start(timeSlice: number): void;\r\n /** Stops recording */\r\n stop(): void;\r\n\r\n /** Event raised when an error arised. */\r\n onerror: (event: ErrorEvent) => void;\r\n /** Event raised when the recording stops. */\r\n onstop: (event: Event) => void;\r\n /** Event raised when a new chunk of data is available and should be tracked. */\r\n ondataavailable: (event: Event) => void;\r\n}\r\n\r\ninterface MediaRecorderOptions {\r\n /** The mime type you want to use as the recording container for the new MediaRecorder. */\r\n mimeType?: string;\r\n /** The chosen bitrate for the audio component of the media. */\r\n audioBitsPerSecond?: number;\r\n /** The chosen bitrate for the video component of the media. */\r\n videoBitsPerSecond?: number;\r\n /** The chosen bitrate for the audio and video components of the media. This can be specified instead of the above two properties.\r\n * If this is specified along with one or the other of the above properties, this will be used for the one that isn't specified. */\r\n bitsPerSecond?: number;\r\n}\r\n\r\ninterface MediaRecorderConstructor {\r\n /**\r\n * A reference to the prototype.\r\n */\r\n readonly prototype: MediaRecorder;\r\n\r\n /**\r\n * Creates a new MediaRecorder.\r\n * @param stream Defines the stream to record.\r\n * @param options Defines the options for the recorder available in the type MediaRecorderOptions.\r\n */\r\n new (stream: MediaStream, options?: MediaRecorderOptions): MediaRecorder;\r\n}\r\n\r\n/**\r\n * MediaRecorder object available in some browsers.\r\n */\r\ndeclare var MediaRecorder: MediaRecorderConstructor;\r\n\r\n/**\r\n * This represents the different options available for the video capture.\r\n */\r\nexport interface VideoRecorderOptions {\r\n /** Defines the mime type of the video. */\r\n mimeType: string;\r\n /** Defines the FPS the video should be recorded at. */\r\n fps: number;\r\n /** Defines the chunk size for the recording data. */\r\n recordChunckSize: number;\r\n /** The audio tracks to attach to the recording. */\r\n audioTracks?: MediaStreamTrack[];\r\n}\r\n\r\n/**\r\n * This can help with recording videos from BabylonJS.\r\n * This is based on the available WebRTC functionalities of the browser.\r\n *\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToVideo\r\n */\r\nexport class VideoRecorder {\r\n private static readonly _DefaultOptions = {\r\n mimeType: \"video/webm\",\r\n fps: 25,\r\n recordChunckSize: 3000,\r\n };\r\n\r\n /**\r\n * Returns whether or not the VideoRecorder is available in your browser.\r\n * @param engine Defines the Babylon Engine.\r\n * @returns true if supported otherwise false.\r\n */\r\n public static IsSupported(engine: Engine): boolean {\r\n const canvas = engine.getRenderingCanvas();\r\n return !!canvas && typeof (<any>canvas).captureStream === \"function\";\r\n }\r\n\r\n private readonly _options: VideoRecorderOptions;\r\n private _canvas: Nullable<HTMLCanvasElement>;\r\n private _mediaRecorder: Nullable<MediaRecorder>;\r\n\r\n private _recordedChunks: any[];\r\n private _fileName: Nullable<string>;\r\n private _resolve: Nullable<(blob: Blob) => void>;\r\n private _reject: Nullable<(error: any) => void>;\r\n\r\n /**\r\n * True when a recording is already in progress.\r\n */\r\n public get isRecording(): boolean {\r\n return !!this._canvas && this._canvas.isRecording;\r\n }\r\n\r\n /**\r\n * Create a new VideoCapture object which can help converting what you see in Babylon to a video file.\r\n * @param engine Defines the BabylonJS Engine you wish to record.\r\n * @param options Defines options that can be used to customize the capture.\r\n */\r\n constructor(engine: Engine, options: Partial<VideoRecorderOptions> = {}) {\r\n if (!VideoRecorder.IsSupported(engine)) {\r\n throw \"Your browser does not support recording so far.\";\r\n }\r\n\r\n const canvas = engine.getRenderingCanvas();\r\n if (!canvas) {\r\n throw \"The babylon engine must have a canvas to be recorded\";\r\n }\r\n\r\n this._canvas = canvas;\r\n this._canvas.isRecording = false;\r\n\r\n this._options = {\r\n ...VideoRecorder._DefaultOptions,\r\n ...options,\r\n };\r\n\r\n const stream = this._canvas.captureStream(this._options.fps);\r\n if (this._options.audioTracks) {\r\n for (const track of this._options.audioTracks) {\r\n stream.addTrack(track);\r\n }\r\n }\r\n\r\n this._mediaRecorder = new MediaRecorder(stream, { mimeType: this._options.mimeType });\r\n this._mediaRecorder.ondataavailable = this._handleDataAvailable.bind(this);\r\n this._mediaRecorder.onerror = this._handleError.bind(this);\r\n this._mediaRecorder.onstop = this._handleStop.bind(this);\r\n }\r\n\r\n /**\r\n * Stops the current recording before the default capture timeout passed in the startRecording function.\r\n */\r\n public stopRecording(): void {\r\n if (!this._canvas || !this._mediaRecorder) {\r\n return;\r\n }\r\n\r\n if (!this.isRecording) {\r\n return;\r\n }\r\n\r\n this._canvas.isRecording = false;\r\n this._mediaRecorder.stop();\r\n }\r\n\r\n /**\r\n * Starts recording the canvas for a max duration specified in parameters.\r\n * @param fileName Defines the name of the file to be downloaded when the recording stop.\r\n * If null no automatic download will start and you can rely on the promise to get the data back.\r\n * @param maxDuration Defines the maximum recording time in seconds.\r\n * It defaults to 7 seconds. A value of zero will not stop automatically, you would need to call stopRecording manually.\r\n * @returns A promise callback at the end of the recording with the video data in Blob.\r\n */\r\n public startRecording(fileName: Nullable<string> = \"babylonjs.webm\", maxDuration = 7): Promise<Blob> {\r\n if (!this._canvas || !this._mediaRecorder) {\r\n throw \"Recorder has already been disposed\";\r\n }\r\n\r\n if (this.isRecording) {\r\n throw \"Recording already in progress\";\r\n }\r\n\r\n if (maxDuration > 0) {\r\n setTimeout(() => {\r\n this.stopRecording();\r\n }, maxDuration * 1000);\r\n }\r\n\r\n this._fileName = fileName;\r\n this._recordedChunks = [];\r\n this._resolve = null;\r\n this._reject = null;\r\n\r\n this._canvas.isRecording = true;\r\n this._mediaRecorder.start(this._options.recordChunckSize);\r\n\r\n return new Promise<Blob>((resolve, reject) => {\r\n this._resolve = resolve;\r\n this._reject = reject;\r\n });\r\n }\r\n\r\n /**\r\n * Releases internal resources used during the recording.\r\n */\r\n public dispose() {\r\n this._canvas = null;\r\n this._mediaRecorder = null;\r\n\r\n this._recordedChunks = [];\r\n this._fileName = null;\r\n this._resolve = null;\r\n this._reject = null;\r\n }\r\n\r\n private _handleDataAvailable(event: any): void {\r\n if (event.data.size > 0) {\r\n this._recordedChunks.push(event.data);\r\n }\r\n }\r\n\r\n private _handleError(event: ErrorEvent): void {\r\n this.stopRecording();\r\n\r\n if (this._reject) {\r\n this._reject(event.error);\r\n } else {\r\n throw new event.error();\r\n }\r\n }\r\n\r\n private _handleStop(): void {\r\n this.stopRecording();\r\n\r\n const superBuffer = new Blob(this._recordedChunks);\r\n if (this._resolve) {\r\n this._resolve(superBuffer);\r\n }\r\n\r\n window.URL.createObjectURL(superBuffer);\r\n\r\n if (this._fileName) {\r\n Tools.Download(superBuffer, this._fileName);\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"videoRecorder.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/videoRecorder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AA8DhC;;;;;GAKG;AACH,MAAM,OAAO,aAAa;IAOtB;;;;OAIG;IACI,MAAM,CAAC,WAAW,CAAC,MAAc;QACpC,MAAM,MAAM,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAC3C,OAAO,CAAC,CAAC,MAAM,IAAI,OAAa,MAAO,CAAC,aAAa,KAAK,UAAU,CAAC;IACzE,CAAC;IAWD;;OAEG;IACH,IAAW,WAAW;QAClB,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IACtD,CAAC;IAED;;;;OAIG;IACH,YAAY,MAAc,EAAE,UAAyC,EAAE;QACnE,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;YACpC,MAAM,iDAAiD,CAAC;SAC3D;QAED,MAAM,MAAM,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAC;QAC3C,IAAI,CAAC,MAAM,EAAE;YACT,MAAM,sDAAsD,CAAC;SAChE;QAED,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,WAAW,GAAG,KAAK,CAAC;QAEjC,IAAI,CAAC,QAAQ,mCACN,aAAa,CAAC,eAAe,GAC7B,OAAO,CACb,CAAC;QAEF,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,C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AAC,CAAC;SAC7B;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;SAC3B;IACL,CAAC;IAEO,WAAW;QACf,IAAI,CAAC,aAAa,EAAE,CAAC;QAErB,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,IAAI,CAAC,QAAQ,EAAE;YACf,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;SAC9B;QAED,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAExC,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;SAC/C;IACL,CAAC;;AAnKuB,6BAAe,GAAG;IACtC,QAAQ,EAAE,YAAY;IACtB,GAAG,EAAE,EAAE;IACP,gBAAgB,EAAE,IAAI;CACzB,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\n/* eslint-disable no-var */\r\nimport type { Nullable } from \"../types\";\r\nimport { Tools } from \"./tools\";\r\nimport type { Engine } from \"../Engines/engine\";\r\n\r\ninterface MediaRecorder {\r\n /** Starts recording */\r\n start(timeSlice: number): void;\r\n /** Stops recording */\r\n stop(): void;\r\n\r\n /** Event raised when an error arised. */\r\n onerror: (event: ErrorEvent) => void;\r\n /** Event raised when the recording stops. */\r\n onstop: (event: Event) => void;\r\n /** Event raised when a new chunk of data is available and should be tracked. */\r\n ondataavailable: (event: Event) => void;\r\n}\r\n\r\ninterface MediaRecorderOptions {\r\n /** The mime type you want to use as the recording container for the new MediaRecorder. */\r\n mimeType?: string;\r\n /** The chosen bitrate for the audio component of the media. */\r\n audioBitsPerSecond?: number;\r\n /** The chosen bitrate for the video component of the media. */\r\n videoBitsPerSecond?: number;\r\n /** The chosen bitrate for the audio and video components of the media. This can be specified instead of the above two properties.\r\n * If this is specified along with one or the other of the above properties, this will be used for the one that isn't specified. */\r\n bitsPerSecond?: number;\r\n}\r\n\r\ninterface MediaRecorderConstructor {\r\n /**\r\n * A reference to the prototype.\r\n */\r\n readonly prototype: MediaRecorder;\r\n\r\n /**\r\n * Creates a new MediaRecorder.\r\n * @param stream Defines the stream to record.\r\n * @param options Defines the options for the recorder available in the type MediaRecorderOptions.\r\n */\r\n new (stream: MediaStream, options?: MediaRecorderOptions): MediaRecorder;\r\n}\r\n\r\n/**\r\n * MediaRecorder object available in some browsers.\r\n */\r\ndeclare var MediaRecorder: MediaRecorderConstructor;\r\n\r\n/**\r\n * This represents the different options available for the video capture.\r\n */\r\nexport interface VideoRecorderOptions {\r\n /** Defines the mime type of the video. */\r\n mimeType: string;\r\n /** Defines the FPS the video should be recorded at. */\r\n fps: number;\r\n /** Defines the chunk size for the recording data. */\r\n recordChunckSize: number;\r\n /** The audio tracks to attach to the recording. */\r\n audioTracks?: MediaStreamTrack[];\r\n}\r\n\r\n/**\r\n * This can help with recording videos from BabylonJS.\r\n * This is based on the available WebRTC functionalities of the browser.\r\n *\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/scene/renderToVideo\r\n */\r\nexport class VideoRecorder {\r\n private static readonly _DefaultOptions = {\r\n mimeType: \"video/webm\",\r\n fps: 25,\r\n recordChunckSize: 3000,\r\n };\r\n\r\n /**\r\n * Returns whether or not the VideoRecorder is available in your browser.\r\n * @param engine Defines the Babylon Engine.\r\n * @returns true if supported otherwise false.\r\n */\r\n public static IsSupported(engine: Engine): boolean {\r\n const canvas = engine.getRenderingCanvas();\r\n return !!canvas && typeof (<any>canvas).captureStream === \"function\";\r\n }\r\n\r\n private readonly _options: VideoRecorderOptions;\r\n private _canvas: Nullable<HTMLCanvasElement>;\r\n private _mediaRecorder: Nullable<MediaRecorder>;\r\n\r\n private _recordedChunks: any[];\r\n private _fileName: Nullable<string>;\r\n private _resolve: Nullable<(blob: Blob) => void>;\r\n private _reject: Nullable<(error: any) => void>;\r\n\r\n /**\r\n * True when a recording is already in progress.\r\n */\r\n public get isRecording(): boolean {\r\n return !!this._canvas && this._canvas.isRecording;\r\n }\r\n\r\n /**\r\n * Create a new VideoCapture object which can help converting what you see in Babylon to a video file.\r\n * @param engine Defines the BabylonJS Engine you wish to record.\r\n * @param options Defines options that can be used to customize the capture.\r\n */\r\n constructor(engine: Engine, options: Partial<VideoRecorderOptions> = {}) {\r\n if (!VideoRecorder.IsSupported(engine)) {\r\n throw \"Your browser does not support recording so far.\";\r\n }\r\n\r\n const canvas = engine.getRenderingCanvas();\r\n if (!canvas) {\r\n throw \"The babylon engine must have a canvas to be recorded\";\r\n }\r\n\r\n this._canvas = canvas;\r\n this._canvas.isRecording = false;\r\n\r\n this._options = {\r\n ...VideoRecorder._DefaultOptions,\r\n ...options,\r\n };\r\n\r\n const stream = this._canvas.captureStream(this._options.fps);\r\n if (this._options.audioTracks) {\r\n for (const track of this._options.audioTracks) {\r\n stream.addTrack(track);\r\n }\r\n }\r\n\r\n this._mediaRecorder = new MediaRecorder(stream, { mimeType: this._options.mimeType });\r\n this._mediaRecorder.ondataavailable = (evt: Event) => this._handleDataAvailable(evt);\r\n this._mediaRecorder.onerror = (evt: ErrorEvent) => this._handleError(evt);\r\n this._mediaRecorder.onstop = () => this._handleStop();\r\n }\r\n\r\n /**\r\n * Stops the current recording before the default capture timeout passed in the startRecording function.\r\n */\r\n public stopRecording(): void {\r\n if (!this._canvas || !this._mediaRecorder) {\r\n return;\r\n }\r\n\r\n if (!this.isRecording) {\r\n return;\r\n }\r\n\r\n this._canvas.isRecording = false;\r\n this._mediaRecorder.stop();\r\n }\r\n\r\n /**\r\n * Starts recording the canvas for a max duration specified in parameters.\r\n * @param fileName Defines the name of the file to be downloaded when the recording stop.\r\n * If null no automatic download will start and you can rely on the promise to get the data back.\r\n * @param maxDuration Defines the maximum recording time in seconds.\r\n * It defaults to 7 seconds. A value of zero will not stop automatically, you would need to call stopRecording manually.\r\n * @returns A promise callback at the end of the recording with the video data in Blob.\r\n */\r\n public startRecording(fileName: Nullable<string> = \"babylonjs.webm\", maxDuration = 7): Promise<Blob> {\r\n if (!this._canvas || !this._mediaRecorder) {\r\n throw \"Recorder has already been disposed\";\r\n }\r\n\r\n if (this.isRecording) {\r\n throw \"Recording already in progress\";\r\n }\r\n\r\n if (maxDuration > 0) {\r\n setTimeout(() => {\r\n this.stopRecording();\r\n }, maxDuration * 1000);\r\n }\r\n\r\n this._fileName = fileName;\r\n this._recordedChunks = [];\r\n this._resolve = null;\r\n this._reject = null;\r\n\r\n this._canvas.isRecording = true;\r\n this._mediaRecorder.start(this._options.recordChunckSize);\r\n\r\n return new Promise<Blob>((resolve, reject) => {\r\n this._resolve = resolve;\r\n this._reject = reject;\r\n });\r\n }\r\n\r\n /**\r\n * Releases internal resources used during the recording.\r\n */\r\n public dispose() {\r\n this._canvas = null;\r\n this._mediaRecorder = null;\r\n\r\n this._recordedChunks = [];\r\n this._fileName = null;\r\n this._resolve = null;\r\n this._reject = null;\r\n }\r\n\r\n private _handleDataAvailable(event: any): void {\r\n if (event.data.size > 0) {\r\n this._recordedChunks.push(event.data);\r\n }\r\n }\r\n\r\n private _handleError(event: ErrorEvent): void {\r\n this.stopRecording();\r\n\r\n if (this._reject) {\r\n this._reject(event.error);\r\n } else {\r\n throw new event.error();\r\n }\r\n }\r\n\r\n private _handleStop(): void {\r\n this.stopRecording();\r\n\r\n const superBuffer = new Blob(this._recordedChunks);\r\n if (this._resolve) {\r\n this._resolve(superBuffer);\r\n }\r\n\r\n window.URL.createObjectURL(superBuffer);\r\n\r\n if (this._fileName) {\r\n Tools.Download(superBuffer, this._fileName);\r\n }\r\n }\r\n}\r\n"]}
|