Optimize render graph and add GPU profiling

Amp-Thread-ID: https://ampcode.com/threads/T-01a01380-b478-77d0-84a0-102880a5c5ae
Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
Amp
2026-08-20 11:48:06 +00:00
co-authored by heaust
parent ded70a3cb4
commit 000bfd63bf
22 changed files with 1622 additions and 203 deletions
+8 -1
View File
@@ -23,7 +23,14 @@ export class PBRMaterial {
constructor(scene: Scene, options: PBRMaterialOptions = {}) {
this.scene = scene;
this.ready = scene.allocateMaterial().then((id) => {
const textures = [
options.baseColorTexture,
options.metallicRoughnessTexture,
options.normalTexture,
options.emissiveTexture,
].filter((texture): texture is Texture => texture !== undefined);
this.ready = Promise.all(textures.map((texture) => texture.ready)).then(async () => {
const id = await scene.allocateMaterial();
this.id = id;
const color = Array.from(options.baseColor ?? [1, 1, 1, 1]);
const emissive = Array.from(options.emissive ?? [0, 0, 0]);