Merge pull request 'Fixed problem if webgpu is not available and added alert to show the problem. Maybe somewhere in the future i will use toasts for this.' (#30) from bugfix/webgpu into main
Reviewed-on: #30
This commit was merged in pull request #30.
This commit is contained in:
@@ -101,10 +101,10 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if(entry.key !== xpKeys.at(xpKeys.length-1)?.key)
|
@if(entry.key !== xpKeys.at(xpKeys.length-1)?.key)
|
||||||
{
|
{
|
||||||
<mat-divider></mat-divider>
|
<mat-divider></mat-divider>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|||||||
@@ -52,19 +52,16 @@ export class BabylonCanvas implements AfterViewInit, OnDestroy {
|
|||||||
window.removeEventListener('resize', this.resizeHandler);
|
window.removeEventListener('resize', this.resizeHandler);
|
||||||
|
|
||||||
const canvas = this.canvasRef?.nativeElement;
|
const canvas = this.canvasRef?.nativeElement;
|
||||||
if (canvas) {
|
canvas?.removeEventListener('wheel', this.wheelHandler);
|
||||||
canvas.removeEventListener('wheel', this.wheelHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.engine) {
|
this.engine?.dispose();
|
||||||
this.engine.dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async initBabylon(): Promise<void> {
|
private async initBabylon(): Promise<void> {
|
||||||
const canvas = this.canvasRef.nativeElement;
|
const canvas = this.canvasRef.nativeElement;
|
||||||
this.engine = new WebGPUEngine(canvas);
|
const tmpEngine = new WebGPUEngine(canvas);
|
||||||
await this.engine.initAsync().then(() => {
|
await tmpEngine.initAsync().then(() => {
|
||||||
|
this.engine = tmpEngine;
|
||||||
this.scene = new Scene(this.engine);
|
this.scene = new Scene(this.engine);
|
||||||
this.setupCamera(canvas);
|
this.setupCamera(canvas);
|
||||||
this.addListener(canvas);
|
this.addListener(canvas);
|
||||||
@@ -75,7 +72,11 @@ export class BabylonCanvas implements AfterViewInit, OnDestroy {
|
|||||||
engine: this.engine
|
engine: this.engine
|
||||||
});
|
});
|
||||||
this.addRenderLoop(canvas);
|
this.addRenderLoop(canvas);
|
||||||
});
|
})
|
||||||
|
.catch(() => {
|
||||||
|
alert("WebGPU could not be started. Please check your browser if it supports WebGPU.");
|
||||||
|
this.engine = null!;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private addListener(canvas: HTMLCanvasElement) {
|
private addListener(canvas: HTMLCanvasElement) {
|
||||||
|
|||||||
Reference in New Issue
Block a user