Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
yiiqii authored Dec 20, 2023
2 parents 0e2d537 + e493738 commit dae9252
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
10 changes: 5 additions & 5 deletions packages/effects-core/src/asset-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export class AssetManager implements Disposable {
const waitPromise = new Promise<Scene>((resolve, reject) =>
loadTimer = window.setTimeout(() => {
cancelLoading = true;
reject(`Load time out: ${url}`);
reject(`Load time out: ${JSON.stringify(url)}`);
}, this.timeout * 1000));
const hookTimeInfo = async<T> (label: string, func: () => Promise<T>) => {
if (!cancelLoading) {
Expand Down Expand Up @@ -302,7 +302,7 @@ export class AssetManager implements Disposable {
return this.loadBins(bin.url);
}

throw new Error(`Invalid bins source: ${bins}`);
throw new Error(`Invalid bins source: ${JSON.stringify(bins)}`);
});

return Promise.all(jobs);
Expand All @@ -325,7 +325,7 @@ export class AssetManager implements Disposable {
AssetManager.fonts.add(font.fontFamily);
} catch (e) {
console.warn({
content: `Invalid fonts source: ${font.fontURL}`,
content: `Invalid fonts source: ${JSON.stringify(font.fontURL)}`,
type: LOG_TYPE,
});
}
Expand Down Expand Up @@ -483,7 +483,7 @@ export class AssetManager implements Disposable {
url,
resolve,
(status, responseText) => {
reject(`Couldn't load JSON ${url}: status ${status}, ${responseText}`);
reject(`Couldn't load JSON ${JSON.stringify(url)}: status ${status}, ${responseText}`);
});
});
}
Expand All @@ -494,7 +494,7 @@ export class AssetManager implements Disposable {
url,
resolve,
(status, responseText) => {
reject(`Couldn't load bins ${url}: status ${status}, ${responseText}`);
reject(`Couldn't load bins ${JSON.stringify(url)}: status ${status}, ${responseText}`);
});
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/effects-core/src/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export async function loadImage (

// 2. 非法类型
if (!url) {
throw new Error(`Invalid url type: ${source}`);
throw new Error(`Invalid url type: ${JSON.stringify(source)}`);
}

return new Promise<HTMLImageElement>((resolve, reject) => {
Expand All @@ -184,7 +184,7 @@ export async function loadImage (
URL.revokeObjectURL(url);
}

return reject(`Load image fail: ${e}`);
return reject(`Load image fail: ${JSON.stringify(e)}`);
};
img.src = url;
});
Expand Down
2 changes: 1 addition & 1 deletion packages/effects-core/src/render/render-pass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export interface RenderPassDelegate {
* @param mesh - 当前 Mesh
* @param state - 当前渲染状态
*/
didiRenderMesh?: (mesh: Mesh, state: RenderingData) => void,
didRenderMesh?: (mesh: Mesh, state: RenderingData) => void,
}

/**
Expand Down
12 changes: 6 additions & 6 deletions packages/effects-webgl/src/gl-renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ export class GLRenderer extends Renderer implements Disposable {
}

get height () {
return this.glRenderer?.height || 0;
return this.glRenderer?.height ?? 0;
}

get width () {
return this.glRenderer?.width || 0;
return this.glRenderer?.width ?? 0;
}

override renderRenderFrame (renderFrame: RenderFrame) {
Expand Down Expand Up @@ -108,9 +108,9 @@ export class GLRenderer extends Renderer implements Disposable {
for (const pass of passes) {
const delegate = pass.delegate;

delegate.willBeginRenderPass && delegate?.willBeginRenderPass(pass, this.renderingData);
delegate.willBeginRenderPass?.(pass, this.renderingData);
this.renderRenderPass(pass);
delegate.didEndRenderPass && delegate?.didEndRenderPass(pass, this.renderingData);
delegate.didEndRenderPass?.(pass, this.renderingData);
}

for (const pass of passes) {
Expand Down Expand Up @@ -146,9 +146,9 @@ export class GLRenderer extends Renderer implements Disposable {
}
mesh.material.initialize();
mesh.geometry.initialize();
delegate.willRenderMesh && delegate.willRenderMesh(mesh, this.renderingData);
delegate.willRenderMesh?.(mesh, this.renderingData);
mesh.render(this);
delegate.didiRenderMesh && delegate.didiRenderMesh(mesh, this.renderingData);
delegate.didRenderMesh?.(mesh, this.renderingData);
}
}

Expand Down
2 changes: 1 addition & 1 deletion web-packages/demo/src/single.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import '@galacean/effects-plugin-spine';
import '@galacean/effects-plugin-model';
import inspireList from './assets/inspire-list';

const json = inspireList.preComp.url;
const json = 'https://mdn.alipayobjects.com/mars/afts/file/A*3mT3SJ4KGKYAAAAAAAAAAAAADlB4AQ';
const container = document.getElementById('J-container');

(async () => {
Expand Down
6 changes: 3 additions & 3 deletions web-packages/test/unit/src/effects-webgl/gl-material.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ describe('gl-material', () => {
// meshes,
// camera: { name: 'main' },
// delegate: {
// didiRenderMesh (mesh) {
// didRenderMesh (mesh) {
// const db = mesh.material.dataBlocks[1];

// expect(db.name).to.eql('Test');
Expand Down Expand Up @@ -1193,7 +1193,7 @@ describe('gl-material', () => {
const renderPass = new RenderPass({
name: 'basic', priority: 8, meshes, camera: { name: 'main' },
delegate: {
didiRenderMesh () {
didRenderMesh () {
spy();
},
},
Expand Down Expand Up @@ -1272,7 +1272,7 @@ describe('gl-material', () => {
meshes: meshes,
camera: { name: 'main' },
delegate: {
didiRenderMesh () {
didRenderMesh () {
spy();
},
},
Expand Down

0 comments on commit dae9252

Please sign in to comment.