@babylonjs/core 5.18.0 → 5.19.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/Debug/debugLayer.d.ts +36 -0
- package/Debug/debugLayer.js.map +1 -1
- package/Engines/Extensions/engine.query.js +5 -1
- package/Engines/Extensions/engine.query.js.map +1 -1
- package/Engines/Extensions/engine.transformFeedback.js +5 -1
- package/Engines/Extensions/engine.transformFeedback.js.map +1 -1
- package/Engines/engine.d.ts +15 -242
- package/Engines/thinEngine.d.ts +1 -1
- package/Engines/thinEngine.js +7 -3
- package/Engines/thinEngine.js.map +1 -1
- package/Gizmos/axisDragGizmo.d.ts +20 -1
- package/Gizmos/axisDragGizmo.js.map +1 -1
- package/Gizmos/axisScaleGizmo.d.ts +26 -1
- package/Gizmos/axisScaleGizmo.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.d.ts +71 -1
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Gizmos/cameraGizmo.d.ts +15 -1
- package/Gizmos/cameraGizmo.js.map +1 -1
- package/Gizmos/gizmoManager.d.ts +8 -8
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Gizmos/lightGizmo.d.ts +13 -1
- package/Gizmos/lightGizmo.js.map +1 -1
- package/Gizmos/planeDragGizmo.d.ts +20 -1
- package/Gizmos/planeDragGizmo.js.map +1 -1
- package/Gizmos/planeRotationGizmo.d.ts +22 -1
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Gizmos/positionGizmo.d.ts +44 -10
- package/Gizmos/positionGizmo.js.map +1 -1
- package/Gizmos/rotationGizmo.d.ts +29 -6
- package/Gizmos/rotationGizmo.js.map +1 -1
- package/Gizmos/scaleGizmo.d.ts +34 -6
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +3 -0
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/index.d.ts +1 -0
- package/Materials/index.js +1 -0
- package/Materials/index.js.map +1 -1
- package/Maths/math.vector.d.ts +16 -1
- package/Maths/math.vector.js +35 -2
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/groundMesh.js +1 -1
- package/Meshes/groundMesh.js.map +1 -1
- package/Misc/assetsManager.d.ts +9 -0
- package/Misc/assetsManager.js +3 -1
- package/Misc/assetsManager.js.map +1 -1
- package/Misc/basis.js +7 -4
- package/Misc/basis.js.map +1 -1
- package/Misc/computePressure.d.ts +9 -3
- package/Misc/computePressure.js +13 -5
- package/Misc/computePressure.js.map +1 -1
- package/Physics/physicsImpostor.js +8 -2
- package/Physics/physicsImpostor.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +5 -3
- package/scene.js.map +1 -1
package/Meshes/groundMesh.js
CHANGED
|
@@ -85,7 +85,7 @@ var GroundMesh = /** @class */ (function (_super) {
|
|
|
85
85
|
Vector3.TransformCoordinatesFromFloatsToRef(x, 0.0, z, invMat, tmpVect); // transform x,z in the mesh local space
|
|
86
86
|
x = tmpVect.x;
|
|
87
87
|
z = tmpVect.z;
|
|
88
|
-
if (x < this._minX || x
|
|
88
|
+
if (x < this._minX || x >= this._maxX || z <= this._minZ || z > this._maxZ) {
|
|
89
89
|
return this.position.y;
|
|
90
90
|
}
|
|
91
91
|
if (!this._heightQuads || this._heightQuads.length == 0) {
|
package/Meshes/groundMesh.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"groundMesh.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Meshes/groundMesh.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,IAAI,CAAC,iBAAiB,GAAG,UAAC,UAAe,EAAE,KAAY;IACnD,OAAO,UAAU,CAAC,KAAK,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maths/math.vector\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\n\r\nMesh._GroundMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GroundMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * Mesh representing the ground\r\n */\r\nexport class GroundMesh extends Mesh {\r\n /** If octree should be generated */\r\n public generateOctree = false;\r\n\r\n private _heightQuads: { slope: Vector2; facet1: Vector4; facet2: Vector4 }[];\r\n\r\n /** @hidden */\r\n public _subdivisionsX: number;\r\n /** @hidden */\r\n public _subdivisionsY: number;\r\n /** @hidden */\r\n public _width: number;\r\n /** @hidden */\r\n public _height: number;\r\n /** @hidden */\r\n public _minX: number;\r\n /** @hidden */\r\n public _maxX: number;\r\n /** @hidden */\r\n public _minZ: number;\r\n /** @hidden */\r\n public _maxZ: number;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n /**\r\n * \"GroundMesh\"\r\n * @returns \"GroundMesh\"\r\n */\r\n public getClassName(): string {\r\n return \"GroundMesh\";\r\n }\r\n\r\n /**\r\n * The minimum of x and y subdivisions\r\n */\r\n public get subdivisions(): number {\r\n return Math.min(this._subdivisionsX, this._subdivisionsY);\r\n }\r\n\r\n /**\r\n * X subdivisions\r\n */\r\n public get subdivisionsX(): number {\r\n return this._subdivisionsX;\r\n }\r\n\r\n /**\r\n * Y subdivisions\r\n */\r\n public get subdivisionsY(): number {\r\n return this._subdivisionsY;\r\n }\r\n\r\n /**\r\n * This function will update an octree to help to select the right submeshes for rendering, picking and collision computations.\r\n * Please note that you must have a decent number of submeshes to get performance improvements when using an octree\r\n * @param chunksCount the number of subdivisions for x and y\r\n * @param octreeBlocksSize (Default: 32)\r\n */\r\n public optimize(chunksCount: number, octreeBlocksSize = 32): void {\r\n this._subdivisionsX = chunksCount;\r\n this._subdivisionsY = chunksCount;\r\n this.subdivide(chunksCount);\r\n\r\n // Call the octree system optimization if it is defined.\r\n const thisAsAny = this as any;\r\n if (thisAsAny.createOrUpdateSubmeshesOctree) {\r\n thisAsAny.createOrUpdateSubmeshesOctree(octreeBlocksSize);\r\n }\r\n }\r\n\r\n /**\r\n * Returns a height (y) value in the World system :\r\n * the ground altitude at the coordinates (x, z) expressed in the World system.\r\n * @param x x coordinate\r\n * @param z z coordinate\r\n * @returns the ground y position if (x, z) are outside the ground surface.\r\n */\r\n public getHeightAtCoordinates(x: number, z: number): number {\r\n const world = this.getWorldMatrix();\r\n const invMat = TmpVectors.Matrix[5];\r\n world.invertToRef(invMat);\r\n const tmpVect = TmpVectors.Vector3[8];\r\n Vector3.TransformCoordinatesFromFloatsToRef(x, 0.0, z, invMat, tmpVect); // transform x,z in the mesh local space\r\n x = tmpVect.x;\r\n z = tmpVect.z;\r\n if (x < this._minX || x > this._maxX || z < this._minZ || z > this._maxZ) {\r\n return this.position.y;\r\n }\r\n if (!this._heightQuads || this._heightQuads.length == 0) {\r\n this._initHeightQuads();\r\n this._computeHeightQuads();\r\n }\r\n const facet = this._getFacetAt(x, z);\r\n const y = -(facet.x * x + facet.z * z + facet.w) / facet.y;\r\n // return y in the World system\r\n Vector3.TransformCoordinatesFromFloatsToRef(0.0, y, 0.0, world, tmpVect);\r\n return tmpVect.y;\r\n }\r\n\r\n /**\r\n * Returns a normalized vector (Vector3) orthogonal to the ground\r\n * at the ground coordinates (x, z) expressed in the World system.\r\n * @param x x coordinate\r\n * @param z z coordinate\r\n * @returns Vector3(0.0, 1.0, 0.0) if (x, z) are outside the ground surface.\r\n */\r\n public getNormalAtCoordinates(x: number, z: number): Vector3 {\r\n const normal = new Vector3(0.0, 1.0, 0.0);\r\n this.getNormalAtCoordinatesToRef(x, z, normal);\r\n return normal;\r\n }\r\n\r\n /**\r\n * Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground\r\n * at the ground coordinates (x, z) expressed in the World system.\r\n * Doesn't update the reference Vector3 if (x, z) are outside the ground surface.\r\n * @param x x coordinate\r\n * @param z z coordinate\r\n * @param ref vector to store the result\r\n * @returns the GroundMesh.\r\n */\r\n public getNormalAtCoordinatesToRef(x: number, z: number, ref: Vector3): GroundMesh {\r\n const world = this.getWorldMatrix();\r\n const tmpMat = TmpVectors.Matrix[5];\r\n world.invertToRef(tmpMat);\r\n const tmpVect = TmpVectors.Vector3[8];\r\n Vector3.TransformCoordinatesFromFloatsToRef(x, 0.0, z, tmpMat, tmpVect); // transform x,z in the mesh local space\r\n x = tmpVect.x;\r\n z = tmpVect.z;\r\n if (x < this._minX || x > this._maxX || z < this._minZ || z > this._maxZ) {\r\n return this;\r\n }\r\n if (!this._heightQuads || this._heightQuads.length == 0) {\r\n this._initHeightQuads();\r\n this._computeHeightQuads();\r\n }\r\n const facet = this._getFacetAt(x, z);\r\n Vector3.TransformNormalFromFloatsToRef(facet.x, facet.y, facet.z, world, ref);\r\n return this;\r\n }\r\n\r\n /**\r\n * Force the heights to be recomputed for getHeightAtCoordinates() or getNormalAtCoordinates()\r\n * if the ground has been updated.\r\n * This can be used in the render loop.\r\n * @returns the GroundMesh.\r\n */\r\n public updateCoordinateHeights(): GroundMesh {\r\n if (!this._heightQuads || this._heightQuads.length == 0) {\r\n this._initHeightQuads();\r\n }\r\n this._computeHeightQuads();\r\n return this;\r\n }\r\n\r\n // Returns the element \"facet\" from the heightQuads array relative to (x, z) local coordinates\r\n private _getFacetAt(x: number, z: number): Vector4 {\r\n // retrieve col and row from x, z coordinates in the ground local system\r\n const col = Math.floor(((x + this._maxX) * this._subdivisionsX) / this._width);\r\n const row = Math.floor((-(z + this._maxZ) * this._subdivisionsY) / this._height + this._subdivisionsY);\r\n const quad = this._heightQuads[row * this._subdivisionsX + col];\r\n let facet;\r\n if (z < quad.slope.x * x + quad.slope.y) {\r\n facet = quad.facet1;\r\n } else {\r\n facet = quad.facet2;\r\n }\r\n return facet;\r\n }\r\n\r\n // Creates and populates the heightMap array with \"facet\" elements :\r\n // a quad is two triangular facets separated by a slope, so a \"facet\" element is 1 slope + 2 facets\r\n // slope : Vector2(c, h) = 2D diagonal line equation setting apart two triangular facets in a quad : z = cx + h\r\n // facet1 : Vector4(a, b, c, d) = first facet 3D plane equation : ax + by + cz + d = 0\r\n // facet2 : Vector4(a, b, c, d) = second facet 3D plane equation : ax + by + cz + d = 0\r\n // Returns the GroundMesh.\r\n private _initHeightQuads(): GroundMesh {\r\n const subdivisionsX = this._subdivisionsX;\r\n const subdivisionsY = this._subdivisionsY;\r\n this._heightQuads = new Array();\r\n for (let row = 0; row < subdivisionsY; row++) {\r\n for (let col = 0; col < subdivisionsX; col++) {\r\n const quad = { slope: Vector2.Zero(), facet1: new Vector4(0.0, 0.0, 0.0, 0.0), facet2: new Vector4(0.0, 0.0, 0.0, 0.0) };\r\n this._heightQuads[row * subdivisionsX + col] = quad;\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n // Compute each quad element values and update the the heightMap array :\r\n // slope : Vector2(c, h) = 2D diagonal line equation setting apart two triangular facets in a quad : z = cx + h\r\n // facet1 : Vector4(a, b, c, d) = first facet 3D plane equation : ax + by + cz + d = 0\r\n // facet2 : Vector4(a, b, c, d) = second facet 3D plane equation : ax + by + cz + d = 0\r\n // Returns the GroundMesh.\r\n private _computeHeightQuads(): GroundMesh {\r\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n\r\n if (!positions) {\r\n return this;\r\n }\r\n\r\n const v1 = TmpVectors.Vector3[3];\r\n const v2 = TmpVectors.Vector3[2];\r\n const v3 = TmpVectors.Vector3[1];\r\n const v4 = TmpVectors.Vector3[0];\r\n const v1v2 = TmpVectors.Vector3[4];\r\n const v1v3 = TmpVectors.Vector3[5];\r\n const v1v4 = TmpVectors.Vector3[6];\r\n const norm1 = TmpVectors.Vector3[7];\r\n const norm2 = TmpVectors.Vector3[8];\r\n let i = 0;\r\n let j = 0;\r\n let k = 0;\r\n let cd = 0; // 2D slope coefficient : z = cd * x + h\r\n let h = 0;\r\n let d1 = 0; // facet plane equation : ax + by + cz + d = 0\r\n let d2 = 0;\r\n\r\n const subdivisionsX = this._subdivisionsX;\r\n const subdivisionsY = this._subdivisionsY;\r\n\r\n for (let row = 0; row < subdivisionsY; row++) {\r\n for (let col = 0; col < subdivisionsX; col++) {\r\n i = col * 3;\r\n j = row * (subdivisionsX + 1) * 3;\r\n k = (row + 1) * (subdivisionsX + 1) * 3;\r\n v1.x = positions[j + i];\r\n v1.y = positions[j + i + 1];\r\n v1.z = positions[j + i + 2];\r\n v2.x = positions[j + i + 3];\r\n v2.y = positions[j + i + 4];\r\n v2.z = positions[j + i + 5];\r\n v3.x = positions[k + i];\r\n v3.y = positions[k + i + 1];\r\n v3.z = positions[k + i + 2];\r\n v4.x = positions[k + i + 3];\r\n v4.y = positions[k + i + 4];\r\n v4.z = positions[k + i + 5];\r\n\r\n // 2D slope V1V4\r\n cd = (v4.z - v1.z) / (v4.x - v1.x);\r\n h = v1.z - cd * v1.x; // v1 belongs to the slope\r\n\r\n // facet equations :\r\n // we compute each facet normal vector\r\n // the equation of the facet plane is : norm.x * x + norm.y * y + norm.z * z + d = 0\r\n // we compute the value d by applying the equation to v1 which belongs to the plane\r\n // then we store the facet equation in a Vector4\r\n v2.subtractToRef(v1, v1v2);\r\n v3.subtractToRef(v1, v1v3);\r\n v4.subtractToRef(v1, v1v4);\r\n Vector3.CrossToRef(v1v4, v1v3, norm1); // caution : CrossToRef uses the Tmp class\r\n Vector3.CrossToRef(v1v2, v1v4, norm2);\r\n norm1.normalize();\r\n norm2.normalize();\r\n d1 = -(norm1.x * v1.x + norm1.y * v1.y + norm1.z * v1.z);\r\n d2 = -(norm2.x * v2.x + norm2.y * v2.y + norm2.z * v2.z);\r\n\r\n const quad = this._heightQuads[row * subdivisionsX + col];\r\n quad.slope.copyFromFloats(cd, h);\r\n quad.facet1.copyFromFloats(norm1.x, norm1.y, norm1.z, d1);\r\n quad.facet2.copyFromFloats(norm2.x, norm2.y, norm2.z, d2);\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Serializes this ground mesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.subdivisionsX = this._subdivisionsX;\r\n serializationObject.subdivisionsY = this._subdivisionsY;\r\n\r\n serializationObject.minX = this._minX;\r\n serializationObject.maxX = this._maxX;\r\n\r\n serializationObject.minZ = this._minZ;\r\n serializationObject.maxZ = this._maxZ;\r\n\r\n serializationObject.width = this._width;\r\n serializationObject.height = this._height;\r\n }\r\n\r\n /**\r\n * Parses a serialized ground mesh\r\n * @param parsedMesh the serialized mesh\r\n * @param scene the scene to create the ground mesh in\r\n * @returns the created ground mesh\r\n */\r\n public static Parse(parsedMesh: any, scene: Scene): GroundMesh {\r\n const result = new GroundMesh(parsedMesh.name, scene);\r\n\r\n result._subdivisionsX = parsedMesh.subdivisionsX || 1;\r\n result._subdivisionsY = parsedMesh.subdivisionsY || 1;\r\n\r\n result._minX = parsedMesh.minX;\r\n result._maxX = parsedMesh.maxX;\r\n\r\n result._minZ = parsedMesh.minZ;\r\n result._maxZ = parsedMesh.maxZ;\r\n\r\n result._width = parsedMesh.width;\r\n result._height = parsedMesh.height;\r\n\r\n return result;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"groundMesh.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Meshes/groundMesh.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,IAAI,CAAC,iBAAiB,GAAG,UAAC,UAAe,EAAE,KAAY;IACnD,OAAO,UAAU,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF;;GAEG;AACH;IAAgC,8BAAI;IAuBhC,oBAAY,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AC;QAExD,mBAAmB,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACtC,mBAAmB,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QAEtC,mBAAmB,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACtC,mBAAmB,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QAEtC,mBAAmB,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QACxC,mBAAmB,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACW,gBAAK,GAAnB,UAAoB,UAAe,EAAE,KAAY;QAC7C,IAAM,MAAM,GAAG,IAAI,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAEtD,MAAM,CAAC,cAAc,GAAG,UAAU,CAAC,aAAa,IAAI,CAAC,CAAC;QACtD,MAAM,CAAC,cAAc,GAAG,UAAU,CAAC,aAAa,IAAI,CAAC,CAAC;QAEtD,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC;QAC/B,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC;QAE/B,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC;QAC/B,MAAM,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC;QAE/B,MAAM,CAAC,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC;QACjC,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC;QAEnC,OAAO,MAAM,CAAC;IAClB,CAAC;IACL,iBAAC;AAAD,CAAC,AAzTD,CAAgC,IAAI,GAyTnC","sourcesContent":["import type { Scene } from \"../scene\";\r\nimport { Vector3, Vector2, TmpVectors, Vector4 } from \"../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../Buffers/buffer\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\n\r\nMesh._GroundMeshParser = (parsedMesh: any, scene: Scene): Mesh => {\r\n return GroundMesh.Parse(parsedMesh, scene);\r\n};\r\n\r\n/**\r\n * Mesh representing the ground\r\n */\r\nexport class GroundMesh extends Mesh {\r\n /** If octree should be generated */\r\n public generateOctree = false;\r\n\r\n private _heightQuads: { slope: Vector2; facet1: Vector4; facet2: Vector4 }[];\r\n\r\n /** @hidden */\r\n public _subdivisionsX: number;\r\n /** @hidden */\r\n public _subdivisionsY: number;\r\n /** @hidden */\r\n public _width: number;\r\n /** @hidden */\r\n public _height: number;\r\n /** @hidden */\r\n public _minX: number;\r\n /** @hidden */\r\n public _maxX: number;\r\n /** @hidden */\r\n public _minZ: number;\r\n /** @hidden */\r\n public _maxZ: number;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n /**\r\n * \"GroundMesh\"\r\n * @returns \"GroundMesh\"\r\n */\r\n public getClassName(): string {\r\n return \"GroundMesh\";\r\n }\r\n\r\n /**\r\n * The minimum of x and y subdivisions\r\n */\r\n public get subdivisions(): number {\r\n return Math.min(this._subdivisionsX, this._subdivisionsY);\r\n }\r\n\r\n /**\r\n * X subdivisions\r\n */\r\n public get subdivisionsX(): number {\r\n return this._subdivisionsX;\r\n }\r\n\r\n /**\r\n * Y subdivisions\r\n */\r\n public get subdivisionsY(): number {\r\n return this._subdivisionsY;\r\n }\r\n\r\n /**\r\n * This function will update an octree to help to select the right submeshes for rendering, picking and collision computations.\r\n * Please note that you must have a decent number of submeshes to get performance improvements when using an octree\r\n * @param chunksCount the number of subdivisions for x and y\r\n * @param octreeBlocksSize (Default: 32)\r\n */\r\n public optimize(chunksCount: number, octreeBlocksSize = 32): void {\r\n this._subdivisionsX = chunksCount;\r\n this._subdivisionsY = chunksCount;\r\n this.subdivide(chunksCount);\r\n\r\n // Call the octree system optimization if it is defined.\r\n const thisAsAny = this as any;\r\n if (thisAsAny.createOrUpdateSubmeshesOctree) {\r\n thisAsAny.createOrUpdateSubmeshesOctree(octreeBlocksSize);\r\n }\r\n }\r\n\r\n /**\r\n * Returns a height (y) value in the World system :\r\n * the ground altitude at the coordinates (x, z) expressed in the World system.\r\n * @param x x coordinate\r\n * @param z z coordinate\r\n * @returns the ground y position if (x, z) are outside the ground surface.\r\n */\r\n public getHeightAtCoordinates(x: number, z: number): number {\r\n const world = this.getWorldMatrix();\r\n const invMat = TmpVectors.Matrix[5];\r\n world.invertToRef(invMat);\r\n const tmpVect = TmpVectors.Vector3[8];\r\n Vector3.TransformCoordinatesFromFloatsToRef(x, 0.0, z, invMat, tmpVect); // transform x,z in the mesh local space\r\n x = tmpVect.x;\r\n z = tmpVect.z;\r\n if (x < this._minX || x >= this._maxX || z <= this._minZ || z > this._maxZ) {\r\n return this.position.y;\r\n }\r\n if (!this._heightQuads || this._heightQuads.length == 0) {\r\n this._initHeightQuads();\r\n this._computeHeightQuads();\r\n }\r\n const facet = this._getFacetAt(x, z);\r\n const y = -(facet.x * x + facet.z * z + facet.w) / facet.y;\r\n // return y in the World system\r\n Vector3.TransformCoordinatesFromFloatsToRef(0.0, y, 0.0, world, tmpVect);\r\n return tmpVect.y;\r\n }\r\n\r\n /**\r\n * Returns a normalized vector (Vector3) orthogonal to the ground\r\n * at the ground coordinates (x, z) expressed in the World system.\r\n * @param x x coordinate\r\n * @param z z coordinate\r\n * @returns Vector3(0.0, 1.0, 0.0) if (x, z) are outside the ground surface.\r\n */\r\n public getNormalAtCoordinates(x: number, z: number): Vector3 {\r\n const normal = new Vector3(0.0, 1.0, 0.0);\r\n this.getNormalAtCoordinatesToRef(x, z, normal);\r\n return normal;\r\n }\r\n\r\n /**\r\n * Updates the Vector3 passed a reference with a normalized vector orthogonal to the ground\r\n * at the ground coordinates (x, z) expressed in the World system.\r\n * Doesn't update the reference Vector3 if (x, z) are outside the ground surface.\r\n * @param x x coordinate\r\n * @param z z coordinate\r\n * @param ref vector to store the result\r\n * @returns the GroundMesh.\r\n */\r\n public getNormalAtCoordinatesToRef(x: number, z: number, ref: Vector3): GroundMesh {\r\n const world = this.getWorldMatrix();\r\n const tmpMat = TmpVectors.Matrix[5];\r\n world.invertToRef(tmpMat);\r\n const tmpVect = TmpVectors.Vector3[8];\r\n Vector3.TransformCoordinatesFromFloatsToRef(x, 0.0, z, tmpMat, tmpVect); // transform x,z in the mesh local space\r\n x = tmpVect.x;\r\n z = tmpVect.z;\r\n if (x < this._minX || x > this._maxX || z < this._minZ || z > this._maxZ) {\r\n return this;\r\n }\r\n if (!this._heightQuads || this._heightQuads.length == 0) {\r\n this._initHeightQuads();\r\n this._computeHeightQuads();\r\n }\r\n const facet = this._getFacetAt(x, z);\r\n Vector3.TransformNormalFromFloatsToRef(facet.x, facet.y, facet.z, world, ref);\r\n return this;\r\n }\r\n\r\n /**\r\n * Force the heights to be recomputed for getHeightAtCoordinates() or getNormalAtCoordinates()\r\n * if the ground has been updated.\r\n * This can be used in the render loop.\r\n * @returns the GroundMesh.\r\n */\r\n public updateCoordinateHeights(): GroundMesh {\r\n if (!this._heightQuads || this._heightQuads.length == 0) {\r\n this._initHeightQuads();\r\n }\r\n this._computeHeightQuads();\r\n return this;\r\n }\r\n\r\n // Returns the element \"facet\" from the heightQuads array relative to (x, z) local coordinates\r\n private _getFacetAt(x: number, z: number): Vector4 {\r\n // retrieve col and row from x, z coordinates in the ground local system\r\n const col = Math.floor(((x + this._maxX) * this._subdivisionsX) / this._width);\r\n const row = Math.floor((-(z + this._maxZ) * this._subdivisionsY) / this._height + this._subdivisionsY);\r\n const quad = this._heightQuads[row * this._subdivisionsX + col];\r\n let facet;\r\n if (z < quad.slope.x * x + quad.slope.y) {\r\n facet = quad.facet1;\r\n } else {\r\n facet = quad.facet2;\r\n }\r\n return facet;\r\n }\r\n\r\n // Creates and populates the heightMap array with \"facet\" elements :\r\n // a quad is two triangular facets separated by a slope, so a \"facet\" element is 1 slope + 2 facets\r\n // slope : Vector2(c, h) = 2D diagonal line equation setting apart two triangular facets in a quad : z = cx + h\r\n // facet1 : Vector4(a, b, c, d) = first facet 3D plane equation : ax + by + cz + d = 0\r\n // facet2 : Vector4(a, b, c, d) = second facet 3D plane equation : ax + by + cz + d = 0\r\n // Returns the GroundMesh.\r\n private _initHeightQuads(): GroundMesh {\r\n const subdivisionsX = this._subdivisionsX;\r\n const subdivisionsY = this._subdivisionsY;\r\n this._heightQuads = new Array();\r\n for (let row = 0; row < subdivisionsY; row++) {\r\n for (let col = 0; col < subdivisionsX; col++) {\r\n const quad = { slope: Vector2.Zero(), facet1: new Vector4(0.0, 0.0, 0.0, 0.0), facet2: new Vector4(0.0, 0.0, 0.0, 0.0) };\r\n this._heightQuads[row * subdivisionsX + col] = quad;\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n // Compute each quad element values and update the the heightMap array :\r\n // slope : Vector2(c, h) = 2D diagonal line equation setting apart two triangular facets in a quad : z = cx + h\r\n // facet1 : Vector4(a, b, c, d) = first facet 3D plane equation : ax + by + cz + d = 0\r\n // facet2 : Vector4(a, b, c, d) = second facet 3D plane equation : ax + by + cz + d = 0\r\n // Returns the GroundMesh.\r\n private _computeHeightQuads(): GroundMesh {\r\n const positions = this.getVerticesData(VertexBuffer.PositionKind);\r\n\r\n if (!positions) {\r\n return this;\r\n }\r\n\r\n const v1 = TmpVectors.Vector3[3];\r\n const v2 = TmpVectors.Vector3[2];\r\n const v3 = TmpVectors.Vector3[1];\r\n const v4 = TmpVectors.Vector3[0];\r\n const v1v2 = TmpVectors.Vector3[4];\r\n const v1v3 = TmpVectors.Vector3[5];\r\n const v1v4 = TmpVectors.Vector3[6];\r\n const norm1 = TmpVectors.Vector3[7];\r\n const norm2 = TmpVectors.Vector3[8];\r\n let i = 0;\r\n let j = 0;\r\n let k = 0;\r\n let cd = 0; // 2D slope coefficient : z = cd * x + h\r\n let h = 0;\r\n let d1 = 0; // facet plane equation : ax + by + cz + d = 0\r\n let d2 = 0;\r\n\r\n const subdivisionsX = this._subdivisionsX;\r\n const subdivisionsY = this._subdivisionsY;\r\n\r\n for (let row = 0; row < subdivisionsY; row++) {\r\n for (let col = 0; col < subdivisionsX; col++) {\r\n i = col * 3;\r\n j = row * (subdivisionsX + 1) * 3;\r\n k = (row + 1) * (subdivisionsX + 1) * 3;\r\n v1.x = positions[j + i];\r\n v1.y = positions[j + i + 1];\r\n v1.z = positions[j + i + 2];\r\n v2.x = positions[j + i + 3];\r\n v2.y = positions[j + i + 4];\r\n v2.z = positions[j + i + 5];\r\n v3.x = positions[k + i];\r\n v3.y = positions[k + i + 1];\r\n v3.z = positions[k + i + 2];\r\n v4.x = positions[k + i + 3];\r\n v4.y = positions[k + i + 4];\r\n v4.z = positions[k + i + 5];\r\n\r\n // 2D slope V1V4\r\n cd = (v4.z - v1.z) / (v4.x - v1.x);\r\n h = v1.z - cd * v1.x; // v1 belongs to the slope\r\n\r\n // facet equations :\r\n // we compute each facet normal vector\r\n // the equation of the facet plane is : norm.x * x + norm.y * y + norm.z * z + d = 0\r\n // we compute the value d by applying the equation to v1 which belongs to the plane\r\n // then we store the facet equation in a Vector4\r\n v2.subtractToRef(v1, v1v2);\r\n v3.subtractToRef(v1, v1v3);\r\n v4.subtractToRef(v1, v1v4);\r\n Vector3.CrossToRef(v1v4, v1v3, norm1); // caution : CrossToRef uses the Tmp class\r\n Vector3.CrossToRef(v1v2, v1v4, norm2);\r\n norm1.normalize();\r\n norm2.normalize();\r\n d1 = -(norm1.x * v1.x + norm1.y * v1.y + norm1.z * v1.z);\r\n d2 = -(norm2.x * v2.x + norm2.y * v2.y + norm2.z * v2.z);\r\n\r\n const quad = this._heightQuads[row * subdivisionsX + col];\r\n quad.slope.copyFromFloats(cd, h);\r\n quad.facet1.copyFromFloats(norm1.x, norm1.y, norm1.z, d1);\r\n quad.facet2.copyFromFloats(norm2.x, norm2.y, norm2.z, d2);\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Serializes this ground mesh\r\n * @param serializationObject object to write serialization to\r\n */\r\n public serialize(serializationObject: any): void {\r\n super.serialize(serializationObject);\r\n serializationObject.subdivisionsX = this._subdivisionsX;\r\n serializationObject.subdivisionsY = this._subdivisionsY;\r\n\r\n serializationObject.minX = this._minX;\r\n serializationObject.maxX = this._maxX;\r\n\r\n serializationObject.minZ = this._minZ;\r\n serializationObject.maxZ = this._maxZ;\r\n\r\n serializationObject.width = this._width;\r\n serializationObject.height = this._height;\r\n }\r\n\r\n /**\r\n * Parses a serialized ground mesh\r\n * @param parsedMesh the serialized mesh\r\n * @param scene the scene to create the ground mesh in\r\n * @returns the created ground mesh\r\n */\r\n public static Parse(parsedMesh: any, scene: Scene): GroundMesh {\r\n const result = new GroundMesh(parsedMesh.name, scene);\r\n\r\n result._subdivisionsX = parsedMesh.subdivisionsX || 1;\r\n result._subdivisionsY = parsedMesh.subdivisionsY || 1;\r\n\r\n result._minX = parsedMesh.minX;\r\n result._maxX = parsedMesh.maxX;\r\n\r\n result._minZ = parsedMesh.minZ;\r\n result._maxZ = parsedMesh.maxZ;\r\n\r\n result._width = parsedMesh.width;\r\n result._height = parsedMesh.height;\r\n\r\n return result;\r\n }\r\n}\r\n"]}
|
package/Misc/assetsManager.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Scene } from "../scene";
|
|
2
2
|
import type { AbstractMesh } from "../Meshes/abstractMesh";
|
|
3
|
+
import type { TransformNode } from "../Meshes/transformNode";
|
|
3
4
|
import type { IParticleSystem } from "../Particles/IParticleSystem";
|
|
4
5
|
import type { Skeleton } from "../Bones/skeleton";
|
|
5
6
|
import { Observable } from "./observable";
|
|
@@ -166,6 +167,10 @@ export declare class ContainerAssetTask extends AbstractAssetTask {
|
|
|
166
167
|
* Get the loaded asset container
|
|
167
168
|
*/
|
|
168
169
|
loadedContainer: AssetContainer;
|
|
170
|
+
/**
|
|
171
|
+
* Gets the list of loaded transforms
|
|
172
|
+
*/
|
|
173
|
+
loadedTransformNodes: Array<TransformNode>;
|
|
169
174
|
/**
|
|
170
175
|
* Gets the list of loaded meshes
|
|
171
176
|
*/
|
|
@@ -242,6 +247,10 @@ export declare class MeshAssetTask extends AbstractAssetTask {
|
|
|
242
247
|
* Defines the filename or File of the scene to load from
|
|
243
248
|
*/
|
|
244
249
|
sceneFilename: string | File;
|
|
250
|
+
/**
|
|
251
|
+
* Gets the list of loaded transforms
|
|
252
|
+
*/
|
|
253
|
+
loadedTransformNodes: Array<TransformNode>;
|
|
245
254
|
/**
|
|
246
255
|
* Gets the list of loaded meshes
|
|
247
256
|
*/
|
package/Misc/assetsManager.js
CHANGED
|
@@ -215,6 +215,7 @@ var ContainerAssetTask = /** @class */ (function (_super) {
|
|
|
215
215
|
SceneLoader.LoadAssetContainer(this.rootUrl, this.sceneFilename, scene, function (container) {
|
|
216
216
|
_this.loadedContainer = container;
|
|
217
217
|
_this.loadedMeshes = container.meshes;
|
|
218
|
+
_this.loadedTransformNodes = container.transformNodes;
|
|
218
219
|
_this.loadedParticleSystems = container.particleSystems;
|
|
219
220
|
_this.loadedSkeletons = container.skeletons;
|
|
220
221
|
_this.loadedAnimationGroups = container.animationGroups;
|
|
@@ -270,8 +271,9 @@ var MeshAssetTask = /** @class */ (function (_super) {
|
|
|
270
271
|
*/
|
|
271
272
|
MeshAssetTask.prototype.runTask = function (scene, onSuccess, onError) {
|
|
272
273
|
var _this = this;
|
|
273
|
-
SceneLoader.ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, scene, function (meshes, particleSystems, skeletons, animationGroups) {
|
|
274
|
+
SceneLoader.ImportMesh(this.meshesNames, this.rootUrl, this.sceneFilename, scene, function (meshes, particleSystems, skeletons, animationGroups, transformNodes) {
|
|
274
275
|
_this.loadedMeshes = meshes;
|
|
276
|
+
_this.loadedTransformNodes = transformNodes;
|
|
275
277
|
_this.loadedParticleSystems = particleSystems;
|
|
276
278
|
_this.loadedSkeletons = skeletons;
|
|
277
279
|
_this.loadedAnimationGroups = animationGroups;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assetsManager.js","sourceRoot":"","sources":["../../../../../lts/core/generated/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C;IACL,oBAAC;AAAD,CAAC,AA7XD,IA6XC","sourcesContent":["import type { Scene } from \"../scene\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { IParticleSystem } from \"../Particles/IParticleSystem\";\r\nimport type { Skeleton } from \"../Bones/skeleton\";\r\nimport { SceneLoader } from \"../Loading/sceneLoader\";\r\nimport { Tools } from \"./tools\";\r\nimport { Observable } from \"./observable\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { CubeTexture } from \"../Materials/Textures/cubeTexture\";\r\nimport { HDRCubeTexture } from \"../Materials/Textures/hdrCubeTexture\";\r\nimport { EquiRectangularCubeTexture } from \"../Materials/Textures/equiRectangularCubeTexture\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { AnimationGroup } from \"../Animations/animationGroup\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\n/**\r\n * Defines the list of states available for a task inside a AssetsManager\r\n */\r\nexport enum AssetTaskState {\r\n /**\r\n * Initialization\r\n */\r\n INIT,\r\n /**\r\n * Running\r\n */\r\n RUNNING,\r\n /**\r\n * Done\r\n */\r\n DONE,\r\n /**\r\n * Error\r\n */\r\n ERROR,\r\n}\r\n\r\n/**\r\n * Define an abstract asset task used with a AssetsManager class to load assets into a scene\r\n */\r\nexport abstract class AbstractAssetTask {\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: any) => void;\r\n\r\n /**\r\n * Callback called when the task is not successful\r\n */\r\n public onError: (task: any, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new AssetsManager\r\n * @param name defines the name of the task\r\n */\r\n constructor(\r\n /**\r\n * Task name\r\n */ public name: string\r\n ) {}\r\n\r\n private _isCompleted = false;\r\n private _taskState = AssetTaskState.INIT;\r\n private _errorObject: { message?: string; exception?: any };\r\n\r\n /**\r\n * Get if the task is completed\r\n */\r\n public get isCompleted(): boolean {\r\n return this._isCompleted;\r\n }\r\n\r\n /**\r\n * Gets the current state of the task\r\n */\r\n public get taskState(): AssetTaskState {\r\n return this._taskState;\r\n }\r\n\r\n /**\r\n * Gets the current error object (if task is in error)\r\n */\r\n public get errorObject(): { message?: string; exception?: any } {\r\n return this._errorObject;\r\n }\r\n\r\n /**\r\n * Internal only\r\n * @param message\r\n * @param exception\r\n * @hidden\r\n */\r\n public _setErrorObject(message?: string, exception?: any) {\r\n if (this._errorObject) {\r\n return;\r\n }\r\n\r\n this._errorObject = {\r\n message: message,\r\n exception: exception,\r\n };\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public run(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n this._taskState = AssetTaskState.RUNNING;\r\n this.runTask(\r\n scene,\r\n () => {\r\n this._onDoneCallback(onSuccess, onError);\r\n },\r\n (msg, exception) => {\r\n this._onErrorCallback(onError, msg, exception);\r\n }\r\n );\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n throw new Error(\"runTask is not implemented\");\r\n }\r\n\r\n /**\r\n * Reset will set the task state back to INIT, so the next load call of the assets manager will execute this task again.\r\n * This can be used with failed tasks that have the reason for failure fixed.\r\n */\r\n public reset() {\r\n this._taskState = AssetTaskState.INIT;\r\n }\r\n\r\n private _onErrorCallback(onError: (message?: string, exception?: any) => void, message?: string, exception?: any) {\r\n this._taskState = AssetTaskState.ERROR;\r\n\r\n this._errorObject = {\r\n message: message,\r\n exception: exception,\r\n };\r\n\r\n if (this.onError) {\r\n this.onError(this, message, exception);\r\n }\r\n\r\n onError();\r\n }\r\n\r\n private _onDoneCallback(onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n try {\r\n this._taskState = AssetTaskState.DONE;\r\n this._isCompleted = true;\r\n\r\n if (this.onSuccess) {\r\n this.onSuccess(this);\r\n }\r\n\r\n onSuccess();\r\n } catch (e) {\r\n this._onErrorCallback(onError, \"Task is done, error executing success callback(s)\", e);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Define the interface used by progress events raised during assets loading\r\n */\r\nexport interface IAssetsProgressEvent {\r\n /**\r\n * Defines the number of remaining tasks to process\r\n */\r\n remainingCount: number;\r\n /**\r\n * Defines the total number of tasks\r\n */\r\n totalCount: number;\r\n /**\r\n * Defines the task that was just processed\r\n */\r\n task: AbstractAssetTask;\r\n}\r\n\r\n/**\r\n * Class used to share progress information about assets loading\r\n */\r\nexport class AssetsProgressEvent implements IAssetsProgressEvent {\r\n /**\r\n * Defines the number of remaining tasks to process\r\n */\r\n public remainingCount: number;\r\n /**\r\n * Defines the total number of tasks\r\n */\r\n public totalCount: number;\r\n /**\r\n * Defines the task that was just processed\r\n */\r\n public task: AbstractAssetTask;\r\n\r\n /**\r\n * Creates a AssetsProgressEvent\r\n * @param remainingCount defines the number of remaining tasks to process\r\n * @param totalCount defines the total number of tasks\r\n * @param task defines the task that was just processed\r\n */\r\n constructor(remainingCount: number, totalCount: number, task: AbstractAssetTask) {\r\n this.remainingCount = remainingCount;\r\n this.totalCount = totalCount;\r\n this.task = task;\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load assets into a container\r\n */\r\nexport class ContainerAssetTask extends AbstractAssetTask {\r\n /**\r\n * Get the loaded asset container\r\n */\r\n public loadedContainer: AssetContainer;\r\n /**\r\n * Gets the list of loaded meshes\r\n */\r\n public loadedMeshes: Array<AbstractMesh>;\r\n /**\r\n * Gets the list of loaded particle systems\r\n */\r\n public loadedParticleSystems: Array<IParticleSystem>;\r\n /**\r\n * Gets the list of loaded skeletons\r\n */\r\n public loadedSkeletons: Array<Skeleton>;\r\n /**\r\n * Gets the list of loaded animation groups\r\n */\r\n public loadedAnimationGroups: Array<AnimationGroup>;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: ContainerAssetTask) => void;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: ContainerAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new ContainerAssetTask\r\n * @param name defines the name of the task\r\n * @param meshesNames defines the list of mesh's names you want to load\r\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\r\n * @param sceneFilename defines the filename or File of the scene to load from\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the list of mesh's names you want to load\r\n */\r\n public meshesNames: any,\r\n /**\r\n * Defines the root url to use as a base to load your meshes and associated resources\r\n */\r\n public rootUrl: string,\r\n /**\r\n * Defines the filename or File of the scene to load from\r\n */\r\n public sceneFilename: string | File\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n SceneLoader.LoadAssetContainer(\r\n this.rootUrl,\r\n this.sceneFilename,\r\n scene,\r\n (container: AssetContainer) => {\r\n this.loadedContainer = container;\r\n this.loadedMeshes = container.meshes;\r\n this.loadedParticleSystems = container.particleSystems;\r\n this.loadedSkeletons = container.skeletons;\r\n this.loadedAnimationGroups = container.animationGroups;\r\n onSuccess();\r\n },\r\n null,\r\n (scene, message, exception) => {\r\n onError(message, exception);\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load meshes\r\n */\r\nexport class MeshAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the list of loaded meshes\r\n */\r\n public loadedMeshes: Array<AbstractMesh>;\r\n /**\r\n * Gets the list of loaded particle systems\r\n */\r\n public loadedParticleSystems: Array<IParticleSystem>;\r\n /**\r\n * Gets the list of loaded skeletons\r\n */\r\n public loadedSkeletons: Array<Skeleton>;\r\n /**\r\n * Gets the list of loaded animation groups\r\n */\r\n public loadedAnimationGroups: Array<AnimationGroup>;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: MeshAssetTask) => void;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: MeshAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new MeshAssetTask\r\n * @param name defines the name of the task\r\n * @param meshesNames defines the list of mesh's names you want to load\r\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\r\n * @param sceneFilename defines the filename or File of the scene to load from\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the list of mesh's names you want to load\r\n */\r\n public meshesNames: any,\r\n /**\r\n * Defines the root url to use as a base to load your meshes and associated resources\r\n */\r\n public rootUrl: string,\r\n /**\r\n * Defines the filename or File of the scene to load from\r\n */\r\n public sceneFilename: string | File\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n SceneLoader.ImportMesh(\r\n this.meshesNames,\r\n this.rootUrl,\r\n this.sceneFilename,\r\n scene,\r\n (meshes: AbstractMesh[], particleSystems: IParticleSystem[], skeletons: Skeleton[], animationGroups: AnimationGroup[]) => {\r\n this.loadedMeshes = meshes;\r\n this.loadedParticleSystems = particleSystems;\r\n this.loadedSkeletons = skeletons;\r\n this.loadedAnimationGroups = animationGroups;\r\n onSuccess();\r\n },\r\n null,\r\n (scene, message, exception) => {\r\n onError(message, exception);\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load text content\r\n */\r\nexport class TextFileAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the loaded text string\r\n */\r\n public text: string;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: TextFileAssetTask) => void;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: TextFileAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new TextFileAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n scene._loadFile(\r\n this.url,\r\n (data) => {\r\n this.text = data as string;\r\n onSuccess();\r\n },\r\n undefined,\r\n false,\r\n false,\r\n (request, exception) => {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load binary data\r\n */\r\nexport class BinaryFileAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the loaded data (as an array buffer)\r\n */\r\n public data: ArrayBuffer;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: BinaryFileAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: BinaryFileAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new BinaryFileAssetTask object\r\n * @param name defines the name of the new task\r\n * @param url defines the location of the file to load\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n scene._loadFile(\r\n this.url,\r\n (data) => {\r\n this.data = data as ArrayBuffer;\r\n onSuccess();\r\n },\r\n undefined,\r\n true,\r\n true,\r\n (request, exception) => {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load images\r\n */\r\nexport class ImageAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the loaded images\r\n */\r\n public image: HTMLImageElement;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: ImageAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: ImageAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new ImageAssetTask\r\n * @param name defines the name of the task\r\n * @param url defines the location of the image to load\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the location of the image to load\r\n */\r\n public url: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const img = new Image();\r\n\r\n Tools.SetCorsBehavior(this.url, img);\r\n\r\n img.onload = () => {\r\n this.image = img;\r\n onSuccess();\r\n };\r\n\r\n img.onerror = (err: string | Event): any => {\r\n onError(\"Error loading image\", err);\r\n };\r\n\r\n img.src = this.url;\r\n }\r\n}\r\n\r\n/**\r\n * Defines the interface used by texture loading tasks\r\n */\r\nexport interface ITextureAssetTask<TEX extends BaseTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n texture: TEX;\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load 2D textures\r\n */\r\nexport class TextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<Texture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: Texture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: TextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: TextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new TextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param noMipmap defines if mipmap should not be generated (default is false)\r\n * @param invertY defines if texture must be inverted on Y axis (default is true)\r\n * @param samplingMode defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string,\r\n /**\r\n * Defines if mipmap should not be generated (default is false)\r\n */\r\n public noMipmap?: boolean,\r\n /**\r\n * Defines if texture must be inverted on Y axis (default is true)\r\n */\r\n public invertY: boolean = true,\r\n /**\r\n * Defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n */\r\n public samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new Texture(this.url, scene, this.noMipmap, this.invertY, this.samplingMode, onload, onerror);\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load cube textures\r\n */\r\nexport class CubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<CubeTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: CubeTexture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: CubeTextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: CubeTextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new CubeTextureAssetTask\r\n * @param name defines the name of the task\r\n * @param url defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)\r\n * @param extensions defines the extensions to use to load files ([\"_px\", \"_py\", \"_pz\", \"_nx\", \"_ny\", \"_nz\"] by default)\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param files defines the explicit list of files (undefined by default)\r\n * @param prefiltered\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)\r\n */\r\n public url: string,\r\n /**\r\n * Defines the extensions to use to load files ([\"_px\", \"_py\", \"_pz\", \"_nx\", \"_ny\", \"_nz\"] by default)\r\n */\r\n public extensions?: string[],\r\n /**\r\n * Defines if mipmaps should not be generated (default is false)\r\n */\r\n public noMipmap?: boolean,\r\n /**\r\n * Defines the explicit list of files (undefined by default)\r\n */\r\n public files?: string[],\r\n /**\r\n * Defines the prefiltered texture option (default is false)\r\n */\r\n public prefiltered?: boolean\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new CubeTexture(this.url, scene, this.extensions, this.noMipmap, this.files, onload, onerror, undefined, this.prefiltered);\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load HDR cube textures\r\n */\r\nexport class HDRCubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<HDRCubeTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: HDRCubeTexture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: HDRCubeTextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: HDRCubeTextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new HDRCubeTextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param size defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param generateHarmonics specifies whether you want to extract the polynomial harmonics during the generation process (default is true)\r\n * @param gammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n * @param reserved Internal use only\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string,\r\n /**\r\n * Defines the desired size (the more it increases the longer the generation will be)\r\n */\r\n public size: number,\r\n /**\r\n * Defines if mipmaps should not be generated (default is false)\r\n */\r\n public noMipmap = false,\r\n /**\r\n * Specifies whether you want to extract the polynomial harmonics during the generation process (default is true)\r\n */\r\n public generateHarmonics = true,\r\n /**\r\n * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n */\r\n public gammaSpace = false,\r\n /**\r\n * Internal Use Only\r\n */\r\n public reserved = false\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new HDRCubeTexture(this.url, scene, this.size, this.noMipmap, this.generateHarmonics, this.gammaSpace, this.reserved, onload, onerror);\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load Equirectangular cube textures\r\n */\r\nexport class EquiRectangularCubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<EquiRectangularCubeTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: EquiRectangularCubeTexture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: EquiRectangularCubeTextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: EquiRectangularCubeTextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new EquiRectangularCubeTextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param size defines the desired size (the more it increases the longer the generation will be)\r\n * If the size is omitted this implies you are using a preprocessed cubemap.\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param gammaSpace specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)\r\n * (default is true)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string,\r\n /**\r\n * Defines the desired size (the more it increases the longer the generation will be)\r\n */\r\n public size: number,\r\n /**\r\n * Defines if mipmaps should not be generated (default is false)\r\n */\r\n public noMipmap: boolean = false,\r\n /**\r\n * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space,\r\n * but the standard material would require them in Gamma space) (default is true)\r\n */\r\n public gammaSpace: boolean = true\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void): void {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new EquiRectangularCubeTexture(this.url, scene, this.size, this.noMipmap, this.gammaSpace, onload, onerror);\r\n }\r\n}\r\n\r\n/**\r\n * This class can be used to easily import assets into a scene\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_assetsmanager\r\n */\r\nexport class AssetsManager {\r\n private _scene: Scene;\r\n private _isLoading = false;\r\n\r\n protected _tasks = new Array<AbstractAssetTask>();\r\n protected _waitingTasksCount = 0;\r\n protected _totalTasksCount = 0;\r\n\r\n /**\r\n * Callback called when all tasks are processed\r\n */\r\n public onFinish: (tasks: AbstractAssetTask[]) => void;\r\n\r\n /**\r\n * Callback called when a task is successful\r\n */\r\n public onTaskSuccess: (task: AbstractAssetTask) => void;\r\n\r\n /**\r\n * Callback called when a task had an error\r\n */\r\n public onTaskError: (task: AbstractAssetTask) => void;\r\n\r\n /**\r\n * Callback called when a task is done (whatever the result is)\r\n */\r\n public onProgress: (remainingCount: number, totalCount: number, task: AbstractAssetTask) => void;\r\n\r\n /**\r\n * Observable called when all tasks are processed\r\n */\r\n public onTaskSuccessObservable = new Observable<AbstractAssetTask>();\r\n\r\n /**\r\n * Observable called when a task had an error\r\n */\r\n public onTaskErrorObservable = new Observable<AbstractAssetTask>();\r\n\r\n /**\r\n * Observable called when all tasks were executed\r\n */\r\n public onTasksDoneObservable = new Observable<AbstractAssetTask[]>();\r\n\r\n /**\r\n * Observable called when a task is done (whatever the result is)\r\n */\r\n public onProgressObservable = new Observable<IAssetsProgressEvent>();\r\n\r\n /**\r\n * Gets or sets a boolean defining if the AssetsManager should use the default loading screen\r\n * @see https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n public useDefaultLoadingScreen = true;\r\n\r\n /**\r\n * Gets or sets a boolean defining if the AssetsManager should automatically hide the loading screen\r\n * when all assets have been downloaded.\r\n * If set to false, you need to manually call in hideLoadingUI() once your scene is ready.\r\n */\r\n public autoHideLoadingUI = true;\r\n\r\n /**\r\n * Creates a new AssetsManager\r\n * @param scene defines the scene to work on\r\n */\r\n constructor(scene?: Scene) {\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n }\r\n\r\n /**\r\n * Add a ContainerAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param meshesNames defines the name of meshes to load\r\n * @param rootUrl defines the root url to use to locate files\r\n * @param sceneFilename defines the filename of the scene file or the File itself\r\n * @returns a new ContainerAssetTask object\r\n */\r\n public addContainerTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string | File): ContainerAssetTask {\r\n const task = new ContainerAssetTask(taskName, meshesNames, rootUrl, sceneFilename);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a MeshAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param meshesNames defines the name of meshes to load\r\n * @param rootUrl defines the root url to use to locate files\r\n * @param sceneFilename defines the filename of the scene file or the File itself\r\n * @returns a new MeshAssetTask object\r\n */\r\n public addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string | File): MeshAssetTask {\r\n const task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a TextFileAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new TextFileAssetTask object\r\n */\r\n public addTextFileTask(taskName: string, url: string): TextFileAssetTask {\r\n const task = new TextFileAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a BinaryFileAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new BinaryFileAssetTask object\r\n */\r\n public addBinaryFileTask(taskName: string, url: string): BinaryFileAssetTask {\r\n const task = new BinaryFileAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a ImageAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new ImageAssetTask object\r\n */\r\n public addImageTask(taskName: string, url: string): ImageAssetTask {\r\n const task = new ImageAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a TextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param invertY defines if you want to invert Y axis of the loaded texture (false by default)\r\n * @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)\r\n * @returns a new TextureAssetTask object\r\n */\r\n public addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE): TextureAssetTask {\r\n const task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a CubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param extensions defines the extension to use to load the cube map (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param files defines the list of files to load (can be null)\r\n * @param prefiltered defines the prefiltered texture option (default is false)\r\n * @returns a new CubeTextureAssetTask object\r\n */\r\n public addCubeTextureTask(taskName: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[], prefiltered?: boolean): CubeTextureAssetTask {\r\n const task = new CubeTextureAssetTask(taskName, url, extensions, noMipmap, files, prefiltered);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n *\r\n * Add a HDRCubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param size defines the size you want for the cubemap (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param generateHarmonics defines if you want to automatically generate (true by default)\r\n * @param gammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n * @param reserved Internal use only\r\n * @returns a new HDRCubeTextureAssetTask object\r\n */\r\n public addHDRCubeTextureTask(\r\n taskName: string,\r\n url: string,\r\n size: number,\r\n noMipmap = false,\r\n generateHarmonics = true,\r\n gammaSpace = false,\r\n reserved = false\r\n ): HDRCubeTextureAssetTask {\r\n const task = new HDRCubeTextureAssetTask(taskName, url, size, noMipmap, generateHarmonics, gammaSpace, reserved);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n *\r\n * Add a EquiRectangularCubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param size defines the size you want for the cubemap (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param gammaSpace Specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)\r\n * @returns a new EquiRectangularCubeTextureAssetTask object\r\n */\r\n public addEquiRectangularCubeTextureAssetTask(taskName: string, url: string, size: number, noMipmap = false, gammaSpace = true): EquiRectangularCubeTextureAssetTask {\r\n const task = new EquiRectangularCubeTextureAssetTask(taskName, url, size, noMipmap, gammaSpace);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Remove a task from the assets manager.\r\n * @param task the task to remove\r\n */\r\n public removeTask(task: AbstractAssetTask) {\r\n const index = this._tasks.indexOf(task);\r\n\r\n if (index > -1) {\r\n this._tasks.splice(index, 1);\r\n }\r\n }\r\n\r\n private _decreaseWaitingTasksCount(task: AbstractAssetTask): void {\r\n this._waitingTasksCount--;\r\n\r\n try {\r\n if (this.onProgress) {\r\n this.onProgress(this._waitingTasksCount, this._totalTasksCount, task);\r\n }\r\n\r\n this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this._waitingTasksCount, this._totalTasksCount, task));\r\n } catch (e) {\r\n Logger.Error(\"Error running progress callbacks.\");\r\n console.log(e);\r\n }\r\n\r\n if (this._waitingTasksCount === 0) {\r\n try {\r\n const currentTasks = this._tasks.slice();\r\n\r\n if (this.onFinish) {\r\n // Calling onFinish with immutable array of tasks\r\n this.onFinish(currentTasks);\r\n }\r\n\r\n // Let's remove successful tasks\r\n for (const task of currentTasks) {\r\n if (task.taskState === AssetTaskState.DONE) {\r\n const index = this._tasks.indexOf(task);\r\n\r\n if (index > -1) {\r\n this._tasks.splice(index, 1);\r\n }\r\n }\r\n }\r\n\r\n this.onTasksDoneObservable.notifyObservers(this._tasks);\r\n } catch (e) {\r\n Logger.Error(\"Error running tasks-done callbacks.\");\r\n console.log(e);\r\n }\r\n this._isLoading = false;\r\n if (this.autoHideLoadingUI) {\r\n this._scene.getEngine().hideLoadingUI();\r\n }\r\n }\r\n }\r\n\r\n private _runTask(task: AbstractAssetTask): void {\r\n const done = () => {\r\n try {\r\n if (this.onTaskSuccess) {\r\n this.onTaskSuccess(task);\r\n }\r\n this.onTaskSuccessObservable.notifyObservers(task);\r\n this._decreaseWaitingTasksCount(task);\r\n } catch (e) {\r\n error(\"Error executing task success callbacks\", e);\r\n }\r\n };\r\n\r\n const error = (message?: string, exception?: any) => {\r\n task._setErrorObject(message, exception);\r\n\r\n if (this.onTaskError) {\r\n this.onTaskError(task);\r\n } else if (!task.onError) {\r\n Logger.Error(this._formatTaskErrorMessage(task));\r\n }\r\n this.onTaskErrorObservable.notifyObservers(task);\r\n this._decreaseWaitingTasksCount(task);\r\n };\r\n\r\n task.run(this._scene, done, error);\r\n }\r\n\r\n private _formatTaskErrorMessage(task: AbstractAssetTask) {\r\n let errorMessage = \"Unable to complete task \" + task.name;\r\n\r\n if (task.errorObject.message) {\r\n errorMessage += `: ${task.errorObject.message}`;\r\n }\r\n if (task.errorObject.exception) {\r\n errorMessage += `: ${task.errorObject.exception}`;\r\n }\r\n\r\n return errorMessage;\r\n }\r\n\r\n /**\r\n * Reset the AssetsManager and remove all tasks\r\n * @return the current instance of the AssetsManager\r\n */\r\n public reset(): AssetsManager {\r\n this._isLoading = false;\r\n this._tasks = new Array<AbstractAssetTask>();\r\n return this;\r\n }\r\n\r\n /**\r\n * Start the loading process\r\n * @return the current instance of the AssetsManager\r\n */\r\n public load(): AssetsManager {\r\n if (this._isLoading) {\r\n return this;\r\n }\r\n this._isLoading = true;\r\n this._waitingTasksCount = this._tasks.length;\r\n this._totalTasksCount = this._tasks.length;\r\n\r\n if (this._waitingTasksCount === 0) {\r\n this._isLoading = false;\r\n if (this.onFinish) {\r\n this.onFinish(this._tasks);\r\n }\r\n this.onTasksDoneObservable.notifyObservers(this._tasks);\r\n return this;\r\n }\r\n\r\n if (this.useDefaultLoadingScreen) {\r\n this._scene.getEngine().displayLoadingUI();\r\n }\r\n\r\n for (let index = 0; index < this._tasks.length; index++) {\r\n const task = this._tasks[index];\r\n if (task.taskState === AssetTaskState.INIT) {\r\n this._runTask(task);\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Start the loading process as an async operation\r\n * @return a promise returning the list of failed tasks\r\n */\r\n public loadAsync(): Promise<void> {\r\n return new Promise((resolve, reject) => {\r\n if (this._isLoading) {\r\n resolve();\r\n return;\r\n }\r\n this.onTasksDoneObservable.addOnce((remainingTasks) => {\r\n if (remainingTasks && remainingTasks.length) {\r\n reject(remainingTasks);\r\n } else {\r\n resolve();\r\n }\r\n });\r\n\r\n this.load();\r\n });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"assetsManager.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Misc/assetsManager.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD;;GAEG;AACH,MAAM,CAAN,IAAY,cAiBX;AAjBD,WAAY,cAAc;IACtB;;OAEG;IACH,mDAAI,CAAA;IACJ;;OAEG;IACH,yDAAO,CAAA;IACP;;OAEG;IACH,mDAAI,CAAA;IACJ;;OAEG;IACH,qDAAK,CAAA;AACT,CAAC,EAjBW,cAAc,KAAd,cAAc,QAiBzB;AAED;;GAEG;AACH;IAWI;;;OAGG;IACH;IACI;;OAEG,CAAQ,IAAY;QAAZ,SAAI,GAAJ,IAAI,CAAQ;QAGnB,iBAAY,GAAG,KAAK,CAAC;QACrB,eAAU,GAAG,cAAc,CAAC,IAAI,CAAC;IAHtC,CAAC;IASJ,sBAAW,0CAAW;QAHtB;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,YAAY,CAAC;QAC7B,CAAC;;;OAAA;IAKD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,KAAI,CAAC,UAAU,EAAE;gBACjB,OAAO,EAAE,CAAC;gBACV,OAAO;aACV;YACD,KAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,UAAC,cAAc;gBAC9C,IAAI,cAAc,IAAI,cAAc,CAAC,MAAM,EAAE;oBACzC,MAAM,CAAC,cAAc,CAAC,CAAC;iBAC1B;qBAAM;oBACH,OAAO,EAAE,CAAC;iBACb;YACL,CAAC,CAAC,CAAC;YAEH,KAAI,CAAC,IAAI,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC;IACL,oBAAC;AAAD,CAAC,AA7XD,IA6XC","sourcesContent":["import type { Scene } from \"../scene\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { IParticleSystem } from \"../Particles/IParticleSystem\";\r\nimport type { Skeleton } from \"../Bones/skeleton\";\r\nimport { SceneLoader } from \"../Loading/sceneLoader\";\r\nimport { Tools } from \"./tools\";\r\nimport { Observable } from \"./observable\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport { Texture } from \"../Materials/Textures/texture\";\r\nimport { CubeTexture } from \"../Materials/Textures/cubeTexture\";\r\nimport { HDRCubeTexture } from \"../Materials/Textures/hdrCubeTexture\";\r\nimport { EquiRectangularCubeTexture } from \"../Materials/Textures/equiRectangularCubeTexture\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { AnimationGroup } from \"../Animations/animationGroup\";\r\nimport type { AssetContainer } from \"../assetContainer\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\n\r\n/**\r\n * Defines the list of states available for a task inside a AssetsManager\r\n */\r\nexport enum AssetTaskState {\r\n /**\r\n * Initialization\r\n */\r\n INIT,\r\n /**\r\n * Running\r\n */\r\n RUNNING,\r\n /**\r\n * Done\r\n */\r\n DONE,\r\n /**\r\n * Error\r\n */\r\n ERROR,\r\n}\r\n\r\n/**\r\n * Define an abstract asset task used with a AssetsManager class to load assets into a scene\r\n */\r\nexport abstract class AbstractAssetTask {\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: any) => void;\r\n\r\n /**\r\n * Callback called when the task is not successful\r\n */\r\n public onError: (task: any, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new AssetsManager\r\n * @param name defines the name of the task\r\n */\r\n constructor(\r\n /**\r\n * Task name\r\n */ public name: string\r\n ) {}\r\n\r\n private _isCompleted = false;\r\n private _taskState = AssetTaskState.INIT;\r\n private _errorObject: { message?: string; exception?: any };\r\n\r\n /**\r\n * Get if the task is completed\r\n */\r\n public get isCompleted(): boolean {\r\n return this._isCompleted;\r\n }\r\n\r\n /**\r\n * Gets the current state of the task\r\n */\r\n public get taskState(): AssetTaskState {\r\n return this._taskState;\r\n }\r\n\r\n /**\r\n * Gets the current error object (if task is in error)\r\n */\r\n public get errorObject(): { message?: string; exception?: any } {\r\n return this._errorObject;\r\n }\r\n\r\n /**\r\n * Internal only\r\n * @param message\r\n * @param exception\r\n * @hidden\r\n */\r\n public _setErrorObject(message?: string, exception?: any) {\r\n if (this._errorObject) {\r\n return;\r\n }\r\n\r\n this._errorObject = {\r\n message: message,\r\n exception: exception,\r\n };\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public run(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n this._taskState = AssetTaskState.RUNNING;\r\n this.runTask(\r\n scene,\r\n () => {\r\n this._onDoneCallback(onSuccess, onError);\r\n },\r\n (msg, exception) => {\r\n this._onErrorCallback(onError, msg, exception);\r\n }\r\n );\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n throw new Error(\"runTask is not implemented\");\r\n }\r\n\r\n /**\r\n * Reset will set the task state back to INIT, so the next load call of the assets manager will execute this task again.\r\n * This can be used with failed tasks that have the reason for failure fixed.\r\n */\r\n public reset() {\r\n this._taskState = AssetTaskState.INIT;\r\n }\r\n\r\n private _onErrorCallback(onError: (message?: string, exception?: any) => void, message?: string, exception?: any) {\r\n this._taskState = AssetTaskState.ERROR;\r\n\r\n this._errorObject = {\r\n message: message,\r\n exception: exception,\r\n };\r\n\r\n if (this.onError) {\r\n this.onError(this, message, exception);\r\n }\r\n\r\n onError();\r\n }\r\n\r\n private _onDoneCallback(onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n try {\r\n this._taskState = AssetTaskState.DONE;\r\n this._isCompleted = true;\r\n\r\n if (this.onSuccess) {\r\n this.onSuccess(this);\r\n }\r\n\r\n onSuccess();\r\n } catch (e) {\r\n this._onErrorCallback(onError, \"Task is done, error executing success callback(s)\", e);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Define the interface used by progress events raised during assets loading\r\n */\r\nexport interface IAssetsProgressEvent {\r\n /**\r\n * Defines the number of remaining tasks to process\r\n */\r\n remainingCount: number;\r\n /**\r\n * Defines the total number of tasks\r\n */\r\n totalCount: number;\r\n /**\r\n * Defines the task that was just processed\r\n */\r\n task: AbstractAssetTask;\r\n}\r\n\r\n/**\r\n * Class used to share progress information about assets loading\r\n */\r\nexport class AssetsProgressEvent implements IAssetsProgressEvent {\r\n /**\r\n * Defines the number of remaining tasks to process\r\n */\r\n public remainingCount: number;\r\n /**\r\n * Defines the total number of tasks\r\n */\r\n public totalCount: number;\r\n /**\r\n * Defines the task that was just processed\r\n */\r\n public task: AbstractAssetTask;\r\n\r\n /**\r\n * Creates a AssetsProgressEvent\r\n * @param remainingCount defines the number of remaining tasks to process\r\n * @param totalCount defines the total number of tasks\r\n * @param task defines the task that was just processed\r\n */\r\n constructor(remainingCount: number, totalCount: number, task: AbstractAssetTask) {\r\n this.remainingCount = remainingCount;\r\n this.totalCount = totalCount;\r\n this.task = task;\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load assets into a container\r\n */\r\nexport class ContainerAssetTask extends AbstractAssetTask {\r\n /**\r\n * Get the loaded asset container\r\n */\r\n public loadedContainer: AssetContainer;\r\n /**\r\n * Gets the list of loaded transforms\r\n */\r\n public loadedTransformNodes: Array<TransformNode>;\r\n /**\r\n * Gets the list of loaded meshes\r\n */\r\n public loadedMeshes: Array<AbstractMesh>;\r\n /**\r\n * Gets the list of loaded particle systems\r\n */\r\n public loadedParticleSystems: Array<IParticleSystem>;\r\n /**\r\n * Gets the list of loaded skeletons\r\n */\r\n public loadedSkeletons: Array<Skeleton>;\r\n /**\r\n * Gets the list of loaded animation groups\r\n */\r\n public loadedAnimationGroups: Array<AnimationGroup>;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: ContainerAssetTask) => void;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: ContainerAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new ContainerAssetTask\r\n * @param name defines the name of the task\r\n * @param meshesNames defines the list of mesh's names you want to load\r\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\r\n * @param sceneFilename defines the filename or File of the scene to load from\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the list of mesh's names you want to load\r\n */\r\n public meshesNames: any,\r\n /**\r\n * Defines the root url to use as a base to load your meshes and associated resources\r\n */\r\n public rootUrl: string,\r\n /**\r\n * Defines the filename or File of the scene to load from\r\n */\r\n public sceneFilename: string | File\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n SceneLoader.LoadAssetContainer(\r\n this.rootUrl,\r\n this.sceneFilename,\r\n scene,\r\n (container: AssetContainer) => {\r\n this.loadedContainer = container;\r\n this.loadedMeshes = container.meshes;\r\n this.loadedTransformNodes = container.transformNodes;\r\n this.loadedParticleSystems = container.particleSystems;\r\n this.loadedSkeletons = container.skeletons;\r\n this.loadedAnimationGroups = container.animationGroups;\r\n onSuccess();\r\n },\r\n null,\r\n (scene, message, exception) => {\r\n onError(message, exception);\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load meshes\r\n */\r\nexport class MeshAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the list of loaded transforms\r\n */\r\n public loadedTransformNodes: Array<TransformNode>;\r\n /**\r\n * Gets the list of loaded meshes\r\n */\r\n public loadedMeshes: Array<AbstractMesh>;\r\n /**\r\n * Gets the list of loaded particle systems\r\n */\r\n public loadedParticleSystems: Array<IParticleSystem>;\r\n /**\r\n * Gets the list of loaded skeletons\r\n */\r\n public loadedSkeletons: Array<Skeleton>;\r\n /**\r\n * Gets the list of loaded animation groups\r\n */\r\n public loadedAnimationGroups: Array<AnimationGroup>;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: MeshAssetTask) => void;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: MeshAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new MeshAssetTask\r\n * @param name defines the name of the task\r\n * @param meshesNames defines the list of mesh's names you want to load\r\n * @param rootUrl defines the root url to use as a base to load your meshes and associated resources\r\n * @param sceneFilename defines the filename or File of the scene to load from\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the list of mesh's names you want to load\r\n */\r\n public meshesNames: any,\r\n /**\r\n * Defines the root url to use as a base to load your meshes and associated resources\r\n */\r\n public rootUrl: string,\r\n /**\r\n * Defines the filename or File of the scene to load from\r\n */\r\n public sceneFilename: string | File\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n SceneLoader.ImportMesh(\r\n this.meshesNames,\r\n this.rootUrl,\r\n this.sceneFilename,\r\n scene,\r\n (meshes: AbstractMesh[], particleSystems: IParticleSystem[], skeletons: Skeleton[], animationGroups: AnimationGroup[], transformNodes: TransformNode[]) => {\r\n this.loadedMeshes = meshes;\r\n this.loadedTransformNodes = transformNodes;\r\n this.loadedParticleSystems = particleSystems;\r\n this.loadedSkeletons = skeletons;\r\n this.loadedAnimationGroups = animationGroups;\r\n onSuccess();\r\n },\r\n null,\r\n (scene, message, exception) => {\r\n onError(message, exception);\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load text content\r\n */\r\nexport class TextFileAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the loaded text string\r\n */\r\n public text: string;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: TextFileAssetTask) => void;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: TextFileAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new TextFileAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n scene._loadFile(\r\n this.url,\r\n (data) => {\r\n this.text = data as string;\r\n onSuccess();\r\n },\r\n undefined,\r\n false,\r\n false,\r\n (request, exception) => {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load binary data\r\n */\r\nexport class BinaryFileAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the loaded data (as an array buffer)\r\n */\r\n public data: ArrayBuffer;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: BinaryFileAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: BinaryFileAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new BinaryFileAssetTask object\r\n * @param name defines the name of the new task\r\n * @param url defines the location of the file to load\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n scene._loadFile(\r\n this.url,\r\n (data) => {\r\n this.data = data as ArrayBuffer;\r\n onSuccess();\r\n },\r\n undefined,\r\n true,\r\n true,\r\n (request, exception) => {\r\n if (request) {\r\n onError(request.status + \" \" + request.statusText, exception);\r\n }\r\n }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load images\r\n */\r\nexport class ImageAssetTask extends AbstractAssetTask {\r\n /**\r\n * Gets the loaded images\r\n */\r\n public image: HTMLImageElement;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: ImageAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: ImageAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new ImageAssetTask\r\n * @param name defines the name of the task\r\n * @param url defines the location of the image to load\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the location of the image to load\r\n */\r\n public url: string\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const img = new Image();\r\n\r\n Tools.SetCorsBehavior(this.url, img);\r\n\r\n img.onload = () => {\r\n this.image = img;\r\n onSuccess();\r\n };\r\n\r\n img.onerror = (err: string | Event): any => {\r\n onError(\"Error loading image\", err);\r\n };\r\n\r\n img.src = this.url;\r\n }\r\n}\r\n\r\n/**\r\n * Defines the interface used by texture loading tasks\r\n */\r\nexport interface ITextureAssetTask<TEX extends BaseTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n texture: TEX;\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load 2D textures\r\n */\r\nexport class TextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<Texture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: Texture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: TextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: TextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new TextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param noMipmap defines if mipmap should not be generated (default is false)\r\n * @param invertY defines if texture must be inverted on Y axis (default is true)\r\n * @param samplingMode defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string,\r\n /**\r\n * Defines if mipmap should not be generated (default is false)\r\n */\r\n public noMipmap?: boolean,\r\n /**\r\n * Defines if texture must be inverted on Y axis (default is true)\r\n */\r\n public invertY: boolean = true,\r\n /**\r\n * Defines the sampling mode to use (default is Texture.TRILINEAR_SAMPLINGMODE)\r\n */\r\n public samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new Texture(this.url, scene, this.noMipmap, this.invertY, this.samplingMode, onload, onerror);\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load cube textures\r\n */\r\nexport class CubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<CubeTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: CubeTexture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: CubeTextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: CubeTextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new CubeTextureAssetTask\r\n * @param name defines the name of the task\r\n * @param url defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)\r\n * @param extensions defines the extensions to use to load files ([\"_px\", \"_py\", \"_pz\", \"_nx\", \"_ny\", \"_nz\"] by default)\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param files defines the explicit list of files (undefined by default)\r\n * @param prefiltered\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the location of the files to load (You have to specify the folder where the files are + filename with no extension)\r\n */\r\n public url: string,\r\n /**\r\n * Defines the extensions to use to load files ([\"_px\", \"_py\", \"_pz\", \"_nx\", \"_ny\", \"_nz\"] by default)\r\n */\r\n public extensions?: string[],\r\n /**\r\n * Defines if mipmaps should not be generated (default is false)\r\n */\r\n public noMipmap?: boolean,\r\n /**\r\n * Defines the explicit list of files (undefined by default)\r\n */\r\n public files?: string[],\r\n /**\r\n * Defines the prefiltered texture option (default is false)\r\n */\r\n public prefiltered?: boolean\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new CubeTexture(this.url, scene, this.extensions, this.noMipmap, this.files, onload, onerror, undefined, this.prefiltered);\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load HDR cube textures\r\n */\r\nexport class HDRCubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<HDRCubeTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: HDRCubeTexture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: HDRCubeTextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: HDRCubeTextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new HDRCubeTextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param size defines the desired size (the more it increases the longer the generation will be) If the size is omitted this implies you are using a preprocessed cubemap.\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param generateHarmonics specifies whether you want to extract the polynomial harmonics during the generation process (default is true)\r\n * @param gammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n * @param reserved Internal use only\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string,\r\n /**\r\n * Defines the desired size (the more it increases the longer the generation will be)\r\n */\r\n public size: number,\r\n /**\r\n * Defines if mipmaps should not be generated (default is false)\r\n */\r\n public noMipmap = false,\r\n /**\r\n * Specifies whether you want to extract the polynomial harmonics during the generation process (default is true)\r\n */\r\n public generateHarmonics = true,\r\n /**\r\n * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n */\r\n public gammaSpace = false,\r\n /**\r\n * Internal Use Only\r\n */\r\n public reserved = false\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new HDRCubeTexture(this.url, scene, this.size, this.noMipmap, this.generateHarmonics, this.gammaSpace, this.reserved, onload, onerror);\r\n }\r\n}\r\n\r\n/**\r\n * Define a task used by AssetsManager to load Equirectangular cube textures\r\n */\r\nexport class EquiRectangularCubeTextureAssetTask extends AbstractAssetTask implements ITextureAssetTask<EquiRectangularCubeTexture> {\r\n /**\r\n * Gets the loaded texture\r\n */\r\n public texture: EquiRectangularCubeTexture;\r\n\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onSuccess: (task: EquiRectangularCubeTextureAssetTask) => void;\r\n /**\r\n * Callback called when the task is successful\r\n */\r\n public onError: (task: EquiRectangularCubeTextureAssetTask, message?: string, exception?: any) => void;\r\n\r\n /**\r\n * Creates a new EquiRectangularCubeTextureAssetTask object\r\n * @param name defines the name of the task\r\n * @param url defines the location of the file to load\r\n * @param size defines the desired size (the more it increases the longer the generation will be)\r\n * If the size is omitted this implies you are using a preprocessed cubemap.\r\n * @param noMipmap defines if mipmaps should not be generated (default is false)\r\n * @param gammaSpace specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space)\r\n * (default is true)\r\n */\r\n constructor(\r\n /**\r\n * Defines the name of the task\r\n */\r\n public name: string,\r\n /**\r\n * Defines the location of the file to load\r\n */\r\n public url: string,\r\n /**\r\n * Defines the desired size (the more it increases the longer the generation will be)\r\n */\r\n public size: number,\r\n /**\r\n * Defines if mipmaps should not be generated (default is false)\r\n */\r\n public noMipmap: boolean = false,\r\n /**\r\n * Specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space,\r\n * but the standard material would require them in Gamma space) (default is true)\r\n */\r\n public gammaSpace: boolean = true\r\n ) {\r\n super(name);\r\n }\r\n\r\n /**\r\n * Execute the current task\r\n * @param scene defines the scene where you want your assets to be loaded\r\n * @param onSuccess is a callback called when the task is successfully executed\r\n * @param onError is a callback called if an error occurs\r\n */\r\n public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void): void {\r\n const onload = () => {\r\n onSuccess();\r\n };\r\n\r\n const onerror = (message?: string, exception?: any) => {\r\n onError(message, exception);\r\n };\r\n\r\n this.texture = new EquiRectangularCubeTexture(this.url, scene, this.size, this.noMipmap, this.gammaSpace, onload, onerror);\r\n }\r\n}\r\n\r\n/**\r\n * This class can be used to easily import assets into a scene\r\n * @see https://doc.babylonjs.com/how_to/how_to_use_assetsmanager\r\n */\r\nexport class AssetsManager {\r\n private _scene: Scene;\r\n private _isLoading = false;\r\n\r\n protected _tasks = new Array<AbstractAssetTask>();\r\n protected _waitingTasksCount = 0;\r\n protected _totalTasksCount = 0;\r\n\r\n /**\r\n * Callback called when all tasks are processed\r\n */\r\n public onFinish: (tasks: AbstractAssetTask[]) => void;\r\n\r\n /**\r\n * Callback called when a task is successful\r\n */\r\n public onTaskSuccess: (task: AbstractAssetTask) => void;\r\n\r\n /**\r\n * Callback called when a task had an error\r\n */\r\n public onTaskError: (task: AbstractAssetTask) => void;\r\n\r\n /**\r\n * Callback called when a task is done (whatever the result is)\r\n */\r\n public onProgress: (remainingCount: number, totalCount: number, task: AbstractAssetTask) => void;\r\n\r\n /**\r\n * Observable called when all tasks are processed\r\n */\r\n public onTaskSuccessObservable = new Observable<AbstractAssetTask>();\r\n\r\n /**\r\n * Observable called when a task had an error\r\n */\r\n public onTaskErrorObservable = new Observable<AbstractAssetTask>();\r\n\r\n /**\r\n * Observable called when all tasks were executed\r\n */\r\n public onTasksDoneObservable = new Observable<AbstractAssetTask[]>();\r\n\r\n /**\r\n * Observable called when a task is done (whatever the result is)\r\n */\r\n public onProgressObservable = new Observable<IAssetsProgressEvent>();\r\n\r\n /**\r\n * Gets or sets a boolean defining if the AssetsManager should use the default loading screen\r\n * @see https://doc.babylonjs.com/how_to/creating_a_custom_loading_screen\r\n */\r\n public useDefaultLoadingScreen = true;\r\n\r\n /**\r\n * Gets or sets a boolean defining if the AssetsManager should automatically hide the loading screen\r\n * when all assets have been downloaded.\r\n * If set to false, you need to manually call in hideLoadingUI() once your scene is ready.\r\n */\r\n public autoHideLoadingUI = true;\r\n\r\n /**\r\n * Creates a new AssetsManager\r\n * @param scene defines the scene to work on\r\n */\r\n constructor(scene?: Scene) {\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n }\r\n\r\n /**\r\n * Add a ContainerAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param meshesNames defines the name of meshes to load\r\n * @param rootUrl defines the root url to use to locate files\r\n * @param sceneFilename defines the filename of the scene file or the File itself\r\n * @returns a new ContainerAssetTask object\r\n */\r\n public addContainerTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string | File): ContainerAssetTask {\r\n const task = new ContainerAssetTask(taskName, meshesNames, rootUrl, sceneFilename);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a MeshAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param meshesNames defines the name of meshes to load\r\n * @param rootUrl defines the root url to use to locate files\r\n * @param sceneFilename defines the filename of the scene file or the File itself\r\n * @returns a new MeshAssetTask object\r\n */\r\n public addMeshTask(taskName: string, meshesNames: any, rootUrl: string, sceneFilename: string | File): MeshAssetTask {\r\n const task = new MeshAssetTask(taskName, meshesNames, rootUrl, sceneFilename);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a TextFileAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new TextFileAssetTask object\r\n */\r\n public addTextFileTask(taskName: string, url: string): TextFileAssetTask {\r\n const task = new TextFileAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a BinaryFileAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new BinaryFileAssetTask object\r\n */\r\n public addBinaryFileTask(taskName: string, url: string): BinaryFileAssetTask {\r\n const task = new BinaryFileAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a ImageAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @returns a new ImageAssetTask object\r\n */\r\n public addImageTask(taskName: string, url: string): ImageAssetTask {\r\n const task = new ImageAssetTask(taskName, url);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a TextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param invertY defines if you want to invert Y axis of the loaded texture (false by default)\r\n * @param samplingMode defines the sampling mode to use (Texture.TRILINEAR_SAMPLINGMODE by default)\r\n * @returns a new TextureAssetTask object\r\n */\r\n public addTextureTask(taskName: string, url: string, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE): TextureAssetTask {\r\n const task = new TextureAssetTask(taskName, url, noMipmap, invertY, samplingMode);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Add a CubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param extensions defines the extension to use to load the cube map (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param files defines the list of files to load (can be null)\r\n * @param prefiltered defines the prefiltered texture option (default is false)\r\n * @returns a new CubeTextureAssetTask object\r\n */\r\n public addCubeTextureTask(taskName: string, url: string, extensions?: string[], noMipmap?: boolean, files?: string[], prefiltered?: boolean): CubeTextureAssetTask {\r\n const task = new CubeTextureAssetTask(taskName, url, extensions, noMipmap, files, prefiltered);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n *\r\n * Add a HDRCubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param size defines the size you want for the cubemap (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param generateHarmonics defines if you want to automatically generate (true by default)\r\n * @param gammaSpace specifies if the texture will be use in gamma or linear space (the PBR material requires those texture in linear space, but the standard material would require them in Gamma space) (default is false)\r\n * @param reserved Internal use only\r\n * @returns a new HDRCubeTextureAssetTask object\r\n */\r\n public addHDRCubeTextureTask(\r\n taskName: string,\r\n url: string,\r\n size: number,\r\n noMipmap = false,\r\n generateHarmonics = true,\r\n gammaSpace = false,\r\n reserved = false\r\n ): HDRCubeTextureAssetTask {\r\n const task = new HDRCubeTextureAssetTask(taskName, url, size, noMipmap, generateHarmonics, gammaSpace, reserved);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n *\r\n * Add a EquiRectangularCubeTextureAssetTask to the list of active tasks\r\n * @param taskName defines the name of the new task\r\n * @param url defines the url of the file to load\r\n * @param size defines the size you want for the cubemap (can be null)\r\n * @param noMipmap defines if the texture must not receive mipmaps (false by default)\r\n * @param gammaSpace Specifies if the texture will be used in gamma or linear space\r\n * (the PBR material requires those textures in linear space, but the standard material would require them in Gamma space)\r\n * @returns a new EquiRectangularCubeTextureAssetTask object\r\n */\r\n public addEquiRectangularCubeTextureAssetTask(taskName: string, url: string, size: number, noMipmap = false, gammaSpace = true): EquiRectangularCubeTextureAssetTask {\r\n const task = new EquiRectangularCubeTextureAssetTask(taskName, url, size, noMipmap, gammaSpace);\r\n this._tasks.push(task);\r\n\r\n return task;\r\n }\r\n\r\n /**\r\n * Remove a task from the assets manager.\r\n * @param task the task to remove\r\n */\r\n public removeTask(task: AbstractAssetTask) {\r\n const index = this._tasks.indexOf(task);\r\n\r\n if (index > -1) {\r\n this._tasks.splice(index, 1);\r\n }\r\n }\r\n\r\n private _decreaseWaitingTasksCount(task: AbstractAssetTask): void {\r\n this._waitingTasksCount--;\r\n\r\n try {\r\n if (this.onProgress) {\r\n this.onProgress(this._waitingTasksCount, this._totalTasksCount, task);\r\n }\r\n\r\n this.onProgressObservable.notifyObservers(new AssetsProgressEvent(this._waitingTasksCount, this._totalTasksCount, task));\r\n } catch (e) {\r\n Logger.Error(\"Error running progress callbacks.\");\r\n console.log(e);\r\n }\r\n\r\n if (this._waitingTasksCount === 0) {\r\n try {\r\n const currentTasks = this._tasks.slice();\r\n\r\n if (this.onFinish) {\r\n // Calling onFinish with immutable array of tasks\r\n this.onFinish(currentTasks);\r\n }\r\n\r\n // Let's remove successful tasks\r\n for (const task of currentTasks) {\r\n if (task.taskState === AssetTaskState.DONE) {\r\n const index = this._tasks.indexOf(task);\r\n\r\n if (index > -1) {\r\n this._tasks.splice(index, 1);\r\n }\r\n }\r\n }\r\n\r\n this.onTasksDoneObservable.notifyObservers(this._tasks);\r\n } catch (e) {\r\n Logger.Error(\"Error running tasks-done callbacks.\");\r\n console.log(e);\r\n }\r\n this._isLoading = false;\r\n if (this.autoHideLoadingUI) {\r\n this._scene.getEngine().hideLoadingUI();\r\n }\r\n }\r\n }\r\n\r\n private _runTask(task: AbstractAssetTask): void {\r\n const done = () => {\r\n try {\r\n if (this.onTaskSuccess) {\r\n this.onTaskSuccess(task);\r\n }\r\n this.onTaskSuccessObservable.notifyObservers(task);\r\n this._decreaseWaitingTasksCount(task);\r\n } catch (e) {\r\n error(\"Error executing task success callbacks\", e);\r\n }\r\n };\r\n\r\n const error = (message?: string, exception?: any) => {\r\n task._setErrorObject(message, exception);\r\n\r\n if (this.onTaskError) {\r\n this.onTaskError(task);\r\n } else if (!task.onError) {\r\n Logger.Error(this._formatTaskErrorMessage(task));\r\n }\r\n this.onTaskErrorObservable.notifyObservers(task);\r\n this._decreaseWaitingTasksCount(task);\r\n };\r\n\r\n task.run(this._scene, done, error);\r\n }\r\n\r\n private _formatTaskErrorMessage(task: AbstractAssetTask) {\r\n let errorMessage = \"Unable to complete task \" + task.name;\r\n\r\n if (task.errorObject.message) {\r\n errorMessage += `: ${task.errorObject.message}`;\r\n }\r\n if (task.errorObject.exception) {\r\n errorMessage += `: ${task.errorObject.exception}`;\r\n }\r\n\r\n return errorMessage;\r\n }\r\n\r\n /**\r\n * Reset the AssetsManager and remove all tasks\r\n * @return the current instance of the AssetsManager\r\n */\r\n public reset(): AssetsManager {\r\n this._isLoading = false;\r\n this._tasks = new Array<AbstractAssetTask>();\r\n return this;\r\n }\r\n\r\n /**\r\n * Start the loading process\r\n * @return the current instance of the AssetsManager\r\n */\r\n public load(): AssetsManager {\r\n if (this._isLoading) {\r\n return this;\r\n }\r\n this._isLoading = true;\r\n this._waitingTasksCount = this._tasks.length;\r\n this._totalTasksCount = this._tasks.length;\r\n\r\n if (this._waitingTasksCount === 0) {\r\n this._isLoading = false;\r\n if (this.onFinish) {\r\n this.onFinish(this._tasks);\r\n }\r\n this.onTasksDoneObservable.notifyObservers(this._tasks);\r\n return this;\r\n }\r\n\r\n if (this.useDefaultLoadingScreen) {\r\n this._scene.getEngine().displayLoadingUI();\r\n }\r\n\r\n for (let index = 0; index < this._tasks.length; index++) {\r\n const task = this._tasks[index];\r\n if (task.taskState === AssetTaskState.INIT) {\r\n this._runTask(task);\r\n }\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Start the loading process as an async operation\r\n * @return a promise returning the list of failed tasks\r\n */\r\n public loadAsync(): Promise<void> {\r\n return new Promise((resolve, reject) => {\r\n if (this._isLoading) {\r\n resolve();\r\n return;\r\n }\r\n this.onTasksDoneObservable.addOnce((remainingTasks) => {\r\n if (remainingTasks && remainingTasks.length) {\r\n reject(remainingTasks);\r\n } else {\r\n resolve();\r\n }\r\n });\r\n\r\n this.load();\r\n });\r\n }\r\n}\r\n"]}
|
package/Misc/basis.js
CHANGED
|
@@ -183,7 +183,7 @@ export var LoadTextureFromTranscodeResult = function (texture, transcodeResult)
|
|
|
183
183
|
var _loop_1 = function (i) {
|
|
184
184
|
var rootImage = transcodeResult.fileInfo.images[i].levels[0];
|
|
185
185
|
texture._invertVScale = texture.invertY;
|
|
186
|
-
if (transcodeResult.format === -1) {
|
|
186
|
+
if (transcodeResult.format === -1 || transcodeResult.format === BASIS_FORMATS.cTFRGB565) {
|
|
187
187
|
// No compatable compressed format found, fallback to RGB
|
|
188
188
|
texture.type = 10;
|
|
189
189
|
texture.format = 4;
|
|
@@ -197,7 +197,7 @@ export var LoadTextureFromTranscodeResult = function (texture, transcodeResult)
|
|
|
197
197
|
source_1.width = (rootImage.width + 3) & ~3;
|
|
198
198
|
source_1.height = (rootImage.height + 3) & ~3;
|
|
199
199
|
engine._bindTextureDirectly(engine._gl.TEXTURE_2D, source_1, true);
|
|
200
|
-
engine._uploadDataToTextureDirectly(source_1, rootImage.transcodedPixels, i, 0, 4, true);
|
|
200
|
+
engine._uploadDataToTextureDirectly(source_1, new Uint16Array(rootImage.transcodedPixels.buffer), i, 0, 4, true);
|
|
201
201
|
// Resize to power of two
|
|
202
202
|
engine._rescaleTexture(source_1, texture, engine.scenes[0], engine._getInternalFormat(4), function () {
|
|
203
203
|
engine._releaseTexture(source_1);
|
|
@@ -210,16 +210,19 @@ export var LoadTextureFromTranscodeResult = function (texture, transcodeResult)
|
|
|
210
210
|
// Upload directly
|
|
211
211
|
texture.width = (rootImage.width + 3) & ~3;
|
|
212
212
|
texture.height = (rootImage.height + 3) & ~3;
|
|
213
|
-
|
|
213
|
+
texture.samplingMode = 2;
|
|
214
|
+
engine._uploadDataToTextureDirectly(texture, new Uint16Array(rootImage.transcodedPixels.buffer), i, 0, 4, true);
|
|
214
215
|
}
|
|
215
216
|
}
|
|
216
217
|
else {
|
|
217
218
|
texture.width = rootImage.width;
|
|
218
219
|
texture.height = rootImage.height;
|
|
219
220
|
texture.generateMipMaps = transcodeResult.fileInfo.images[i].levels.length > 1;
|
|
221
|
+
var format_1 = BasisTools.GetInternalFormatFromBasisFormat(transcodeResult.format, engine);
|
|
222
|
+
texture.format = format_1;
|
|
220
223
|
// Upload all mip levels in the file
|
|
221
224
|
transcodeResult.fileInfo.images[i].levels.forEach(function (level, index) {
|
|
222
|
-
engine._uploadCompressedDataToTextureDirectly(texture,
|
|
225
|
+
engine._uploadCompressedDataToTextureDirectly(texture, format_1, level.width, level.height, level.transcodedPixels, i, index);
|
|
223
226
|
});
|
|
224
227
|
if (engine._features.basisNeedsPOT && (Scalar.Log2(texture.width) % 1 !== 0 || Scalar.Log2(texture.height) % 1 !== 0)) {
|
|
225
228
|
Tools.Warn("Loaded .basis texture width and height are not a power of two. Texture wrapping will be set to Texture.CLAMP_ADDRESSMODE as other modes are not supported with non power of two dimensions in webGL 1.");
|