Compare commits

..

2 Commits

Author SHA1 Message Date
88ca86ae54 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
All checks were successful
Build, Test & Push Frontend / quality-check (push) Successful in 1m39s
Build, Test & Push Frontend / docker (push) Successful in 1m31s
Reviewed-on: #30
2026-03-05 10:58:54 +01:00
Andreas Dahm
24c4dd3290 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.
Some checks failed
Build, Test & Push Frontend / docker (pull_request) Has been cancelled
Build, Test & Push Frontend / quality-check (pull_request) Has been cancelled
2026-03-05 10:57:07 +01:00
2 changed files with 14 additions and 13 deletions

View File

@@ -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>

View File

@@ -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) {