Skip to content

Commit

Permalink
Fix missing params in some loaders (#2174)
Browse files Browse the repository at this point in the history
  • Loading branch information
gz65555 authored Jul 15, 2024
1 parent f789733 commit f54cd56
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/loader/src/EnvLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { SphericalHarmonics3 } from "@galacean/engine-math";
class EnvLoader extends Loader<AmbientLight> {
load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<AmbientLight> {
return new AssetPromise((resolve, reject) => {
this.request<ArrayBuffer>(item.url, { type: "arraybuffer" })
this.request<ArrayBuffer>(item.url, { ...item, type: "arraybuffer" })
.then((arraybuffer) => {
const shArray = new Float32Array(arraybuffer, 0, 27);
const shByteLength = 27 * 4;
Expand Down
2 changes: 1 addition & 1 deletion packages/loader/src/FontLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
class FontLoader extends Loader<Font> {
load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<Font> {
return new AssetPromise((resolve, reject) => {
this.request<any>(item.url, { type: "json" })
this.request<any>(item.url, { ...item, type: "json" })
.then((data) => {
const { fontName, fontUrl } = data;

Expand Down
2 changes: 1 addition & 1 deletion packages/loader/src/HDRLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ class HDRLoader extends Loader<TextureCube> {
return new AssetPromise((resolve, reject) => {
const engine = resourceManager.engine;

this.request<ArrayBuffer>(item.url, { type: "arraybuffer" })
this.request<ArrayBuffer>(item.url, { ...item, type: "arraybuffer" })
.then((buffer) => {
const uint8Array = new Uint8Array(buffer);
const { width, height, dataPosition } = HDRLoader._parseHeader(uint8Array);
Expand Down
2 changes: 1 addition & 1 deletion packages/loader/src/ProjectLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ProjectLoader extends Loader<void> {
load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<void> {
const { engine } = resourceManager;
return new AssetPromise((resolve, reject) => {
this.request<IProject>(item.url, { type: "json" })
this.request<IProject>(item.url, { ...item, type: "json" })
.then((data) => {
// @ts-ignore
engine.resourceManager.initVirtualResources(data.files);
Expand Down
2 changes: 1 addition & 1 deletion packages/loader/src/SceneLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SceneLoader extends Loader<Scene> {
load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<Scene> {
const { engine } = resourceManager;
return new AssetPromise((resolve, reject) => {
this.request<IScene>(item.url, { type: "json" })
this.request<IScene>(item.url, { ...item, type: "json" })
.then((data) => {
return SceneParser.parse(engine, data).then((scene) => {
const promises = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { decode } from "../..";
export class EditorTextureLoader extends Loader<Texture2D> {
load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<Texture2D> {
return new AssetPromise((resolve, reject) => {
this.request<ArrayBuffer>(item.url, { type: "arraybuffer" })
this.request<ArrayBuffer>(item.url, { ...item, type: "arraybuffer" })
.then((data) => {
decode<Texture2D>(data, resourceManager.engine).then((texture) => {
resolve(texture);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { decode } from "../..";
export class MeshLoader extends Loader<ModelMesh> {
load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<ModelMesh> {
return new AssetPromise((resolve, reject) => {
this.request<ArrayBuffer>(item.url, { type: "arraybuffer" })
this.request<ArrayBuffer>(item.url, { ...item, type: "arraybuffer" })
.then((data) => {
decode<ModelMesh>(data, resourceManager.engine).then((mesh) => {
resolve(mesh);
Expand Down

0 comments on commit f54cd56

Please sign in to comment.