From f54cd5642e74375b25e8beb7fa5243f14805e3d6 Mon Sep 17 00:00:00 2001 From: Hu Song Date: Mon, 15 Jul 2024 19:33:34 +0800 Subject: [PATCH] Fix missing params in some loaders (#2174) --- packages/loader/src/EnvLoader.ts | 2 +- packages/loader/src/FontLoader.ts | 2 +- packages/loader/src/HDRLoader.ts | 2 +- packages/loader/src/ProjectLoader.ts | 2 +- packages/loader/src/SceneLoader.ts | 2 +- .../resource-deserialize/resources/scene/EditorTextureLoader.ts | 2 +- .../src/resource-deserialize/resources/scene/MeshLoader.ts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/loader/src/EnvLoader.ts b/packages/loader/src/EnvLoader.ts index 0809c00c7f..d7c9ca7290 100644 --- a/packages/loader/src/EnvLoader.ts +++ b/packages/loader/src/EnvLoader.ts @@ -17,7 +17,7 @@ import { SphericalHarmonics3 } from "@galacean/engine-math"; class EnvLoader extends Loader { load(item: LoadItem, resourceManager: ResourceManager): AssetPromise { return new AssetPromise((resolve, reject) => { - this.request(item.url, { type: "arraybuffer" }) + this.request(item.url, { ...item, type: "arraybuffer" }) .then((arraybuffer) => { const shArray = new Float32Array(arraybuffer, 0, 27); const shByteLength = 27 * 4; diff --git a/packages/loader/src/FontLoader.ts b/packages/loader/src/FontLoader.ts index 0fe32c28c5..2357ada08a 100644 --- a/packages/loader/src/FontLoader.ts +++ b/packages/loader/src/FontLoader.ts @@ -12,7 +12,7 @@ import { class FontLoader extends Loader { load(item: LoadItem, resourceManager: ResourceManager): AssetPromise { return new AssetPromise((resolve, reject) => { - this.request(item.url, { type: "json" }) + this.request(item.url, { ...item, type: "json" }) .then((data) => { const { fontName, fontUrl } = data; diff --git a/packages/loader/src/HDRLoader.ts b/packages/loader/src/HDRLoader.ts index 541c585bc8..3f72080728 100644 --- a/packages/loader/src/HDRLoader.ts +++ b/packages/loader/src/HDRLoader.ts @@ -381,7 +381,7 @@ class HDRLoader extends Loader { return new AssetPromise((resolve, reject) => { const engine = resourceManager.engine; - this.request(item.url, { type: "arraybuffer" }) + this.request(item.url, { ...item, type: "arraybuffer" }) .then((buffer) => { const uint8Array = new Uint8Array(buffer); const { width, height, dataPosition } = HDRLoader._parseHeader(uint8Array); diff --git a/packages/loader/src/ProjectLoader.ts b/packages/loader/src/ProjectLoader.ts index 0677148b4c..9c9c54ff12 100644 --- a/packages/loader/src/ProjectLoader.ts +++ b/packages/loader/src/ProjectLoader.ts @@ -14,7 +14,7 @@ class ProjectLoader extends Loader { load(item: LoadItem, resourceManager: ResourceManager): AssetPromise { const { engine } = resourceManager; return new AssetPromise((resolve, reject) => { - this.request(item.url, { type: "json" }) + this.request(item.url, { ...item, type: "json" }) .then((data) => { // @ts-ignore engine.resourceManager.initVirtualResources(data.files); diff --git a/packages/loader/src/SceneLoader.ts b/packages/loader/src/SceneLoader.ts index 623ca6dba6..b22649f844 100644 --- a/packages/loader/src/SceneLoader.ts +++ b/packages/loader/src/SceneLoader.ts @@ -19,7 +19,7 @@ class SceneLoader extends Loader { load(item: LoadItem, resourceManager: ResourceManager): AssetPromise { const { engine } = resourceManager; return new AssetPromise((resolve, reject) => { - this.request(item.url, { type: "json" }) + this.request(item.url, { ...item, type: "json" }) .then((data) => { return SceneParser.parse(engine, data).then((scene) => { const promises = []; diff --git a/packages/loader/src/resource-deserialize/resources/scene/EditorTextureLoader.ts b/packages/loader/src/resource-deserialize/resources/scene/EditorTextureLoader.ts index bd12137fcf..5a4d2ad197 100644 --- a/packages/loader/src/resource-deserialize/resources/scene/EditorTextureLoader.ts +++ b/packages/loader/src/resource-deserialize/resources/scene/EditorTextureLoader.ts @@ -5,7 +5,7 @@ import { decode } from "../.."; export class EditorTextureLoader extends Loader { load(item: LoadItem, resourceManager: ResourceManager): AssetPromise { return new AssetPromise((resolve, reject) => { - this.request(item.url, { type: "arraybuffer" }) + this.request(item.url, { ...item, type: "arraybuffer" }) .then((data) => { decode(data, resourceManager.engine).then((texture) => { resolve(texture); diff --git a/packages/loader/src/resource-deserialize/resources/scene/MeshLoader.ts b/packages/loader/src/resource-deserialize/resources/scene/MeshLoader.ts index 346c23f418..6618847eb9 100644 --- a/packages/loader/src/resource-deserialize/resources/scene/MeshLoader.ts +++ b/packages/loader/src/resource-deserialize/resources/scene/MeshLoader.ts @@ -5,7 +5,7 @@ import { decode } from "../.."; export class MeshLoader extends Loader { load(item: LoadItem, resourceManager: ResourceManager): AssetPromise { return new AssetPromise((resolve, reject) => { - this.request(item.url, { type: "arraybuffer" }) + this.request(item.url, { ...item, type: "arraybuffer" }) .then((data) => { decode(data, resourceManager.engine).then((mesh) => { resolve(mesh);