chore: checkpoint web Blender feature-gap work, docs and tests
- update native web_engine sources and rebuilt wasm artifacts - add task cards, status notes and tooling scripts - add web e2e specs, tutorial UI sources and tutorial assets - sync golden task manifests and audit records Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -137,21 +137,52 @@ export class GPUTextureStore {
|
||||
applyMaterial(material: MeshPhysicalMaterial, definition?: MaterialIR): void {
|
||||
if (!definition) return;
|
||||
const compile = material.userData.shaderCompile as { status?: string; textureBindings?: Array<{ imageId: string; usage: "BASE_COLOR" | "NORMAL" }> } | undefined;
|
||||
const baseImageId = compile?.status === "COMPILED"
|
||||
? compile.textureBindings?.find((binding) => binding.usage === "BASE_COLOR")?.imageId
|
||||
: definition.imageIds?.find((imageId) => imageId !== definition.normalImageId) ?? definition.nodes?.find((node) => node.type === "IMAGE_TEXTURE" && node.imageId && node.imageId !== definition.normalImageId)?.imageId;
|
||||
if (baseImageId) {
|
||||
const texture = this.get(baseImageId, "BASE_COLOR");
|
||||
if (texture) material.map = texture;
|
||||
const bindings: Array<{ imageId: string; usage: string; strength?: number }> = definition.textureBindings?.length
|
||||
? definition.textureBindings
|
||||
: compile?.status === "COMPILED" && compile.textureBindings?.length
|
||||
? compile.textureBindings
|
||||
: [
|
||||
...(definition.imageIds ?? []).map((imageId) => ({ imageId, usage: imageId === definition.normalImageId ? "NORMAL" : "BASE_COLOR" })),
|
||||
...(definition.normalImageId ? [{ imageId: definition.normalImageId, usage: "NORMAL" }] : []),
|
||||
];
|
||||
const bindingFor = (usage: string) => bindings.find((binding) => binding.usage === usage);
|
||||
const base = bindingFor("BASE_COLOR");
|
||||
if (base) {
|
||||
const texture = this.get(base.imageId, "BASE_COLOR");
|
||||
if (texture) { material.map = texture; material.color.setRGB(1, 1, 1); }
|
||||
}
|
||||
const normalImageId = compile?.status === "COMPILED"
|
||||
? compile.textureBindings?.find((binding) => binding.usage === "NORMAL")?.imageId
|
||||
: definition.normalImageId ?? definition.nodes?.find((node) => node.type === "IMAGE_TEXTURE" && node.imageId)?.imageId;
|
||||
if (normalImageId) {
|
||||
const texture = this.get(normalImageId, "NORMAL");
|
||||
const normal = bindingFor("NORMAL");
|
||||
if (normal) {
|
||||
const texture = this.get(normal.imageId, "NORMAL");
|
||||
if (texture) material.normalMap = texture;
|
||||
if (typeof normal.strength === "number") material.normalScale.set(normal.strength, normal.strength);
|
||||
}
|
||||
if (material.map || material.normalMap) material.needsUpdate = true;
|
||||
const metallic = bindingFor("METALLIC");
|
||||
if (metallic) {
|
||||
const texture = this.get(metallic.imageId, "METALLIC");
|
||||
if (texture) { material.metalnessMap = texture; material.metalness = 1; }
|
||||
}
|
||||
const roughness = bindingFor("ROUGHNESS");
|
||||
if (roughness) {
|
||||
const texture = this.get(roughness.imageId, "ROUGHNESS");
|
||||
if (texture) { material.roughnessMap = texture; material.roughness = 1; }
|
||||
}
|
||||
const emission = bindingFor("EMISSION");
|
||||
if (emission) {
|
||||
const texture = this.get(emission.imageId, "EMISSIVE");
|
||||
if (texture) { material.emissiveMap = texture; material.emissive.setRGB(1, 1, 1); }
|
||||
}
|
||||
const alpha = bindingFor("ALPHA");
|
||||
if (alpha) {
|
||||
const texture = this.get(alpha.imageId, "ALPHA");
|
||||
if (texture) { material.alphaMap = texture; material.transparent = true; material.opacity = 1; }
|
||||
}
|
||||
const bump = bindingFor("BUMP");
|
||||
if (bump) {
|
||||
const texture = this.get(bump.imageId, "BUMP");
|
||||
if (texture) { material.bumpMap = texture; material.bumpScale = Math.min(100, Math.max(0, bump.strength ?? 1)); }
|
||||
}
|
||||
if (material.map || material.normalMap || material.metalnessMap || material.roughnessMap || material.emissiveMap || material.alphaMap || material.bumpMap) material.needsUpdate = true;
|
||||
}
|
||||
|
||||
applySnapshotMaterials(root: Object3D, snapshot: SceneSnapshotIR): void {
|
||||
@@ -181,6 +212,7 @@ export class GPUTextureStore {
|
||||
scene.userData.pbrIBLTarget = target;
|
||||
scene.environment = target.texture;
|
||||
scene.environmentIntensity = Math.max(0, world.environmentStrength ?? 1);
|
||||
scene.environmentRotation.set(0, world.environmentRotation ?? 0, 0);
|
||||
if (background && (world.backgroundVisible ?? true)) scene.background = source;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user