feat(web): finish RE 5000PBR lesson video and fix non-ASCII GLB import
- Add 11:07 Chinese-narrated lesson video, VTT, poster and 13 chapter screenshots. - Regenerate 20-render WebGL2 matrix and 15 operation captures on RTX 4060. - Fix WASM staging for non-ASCII import filenames (猴头.glb); rebuild web_engine. - Harden lesson video recording pipeline; fix stale lesson-link E2E selector. - Add RE PBR derived libraries, lesson page, evidence and status report. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
||||
commitAssetCatalogPreview,
|
||||
readAssetCatalog,
|
||||
readAssetCatalogPreview,
|
||||
mergeAssetCatalogManifest,
|
||||
seedAssetCatalog,
|
||||
} from "../storage/asset-catalog-store";
|
||||
|
||||
@@ -1546,6 +1547,7 @@ async function handleRequest(event: MessageEvent<StorageRequest>): Promise<void>
|
||||
seedId: command.seedId,
|
||||
repair: command.repair,
|
||||
})));
|
||||
else if (command.type === "mergeAssetCatalogManifest") result = await withProjectTransaction("asset-library", () => withDatabase((db) => mergeAssetCatalogManifest(db, { manifest: command.manifest, projectId: command.projectId })));
|
||||
else if (command.type === "readAssetCatalogPreview") result = await withProjectTransaction(command.projectId, () => readAssetCatalogPreview(command.projectId, command.sha256));
|
||||
else if (command.type === "commitAssetCatalogPreview") result = await withProjectTransaction(command.projectId, () => withDatabase((db) => commitAssetCatalogPreview(db, command.projectId, command.expectedRevision, command.identity, command.data)));
|
||||
else if (command.type === "commitTexturePaintTile") result = await withProjectTransaction(command.commit.target.projectId, () => commitTexturePaintTile(command.commit));
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
InstancedMesh,
|
||||
Mesh,
|
||||
MeshBasicMaterial,
|
||||
MeshNormalMaterial,
|
||||
MeshPhysicalMaterial,
|
||||
PerspectiveCamera,
|
||||
OrthographicCamera,
|
||||
@@ -25,7 +26,7 @@ import {nodeDisplayMatrix as matrixFor} from '../three-adapter/node-display-matr
|
||||
import type { GPUTextureAsset } from "../../../protocol/render-assets";
|
||||
import type { MeshElementMode, MeshGeometryBuffer } from "../../../protocol/web-engine";
|
||||
import type { NonMeshGeometryChunk } from "../../../protocol/nonmesh-binary";
|
||||
import type { OffscreenViewportRequest, OffscreenViewportResponse } from "../three-adapter/offscreen-viewport-protocol";
|
||||
import type { OffscreenTextureStatus, OffscreenViewportRequest, OffscreenViewportResponse } from "../three-adapter/offscreen-viewport-protocol";
|
||||
import type { NonMeshElementKind } from "../three-adapter/nonmesh";
|
||||
import type { CurveGizmoFrameIR, CurveGizmoScreenFrameIR } from "../../../protocol/nonmesh-interaction";
|
||||
import type { NanoVDBViewportAssetIR, NanoVDBViewportRenderResultIR } from "../volume/nanovdb-viewport";
|
||||
@@ -41,6 +42,7 @@ import {
|
||||
setPBRMaterialSelected,
|
||||
} from "../three-adapter/pbr";
|
||||
import { GPUTextureStore } from "../three-adapter/texture-assets";
|
||||
import { subdivideForDisplacement } from "../three-adapter/displacement-geometry";
|
||||
import { planPBRLightingBudget } from "../../../protocol/render-budget";
|
||||
import { applyCurveHandlePreview, applyNonMeshElementSelection, applyNonMeshTransform, createNonMeshObject } from "../three-adapter/nonmesh";
|
||||
import {
|
||||
@@ -68,10 +70,14 @@ let navigationCamera=false;
|
||||
let root: Group | null = null;
|
||||
let importedLights: Group | null = null;
|
||||
let grid: GridHelper | null = null;
|
||||
let textureUpload: Promise<void> = Promise.resolve();
|
||||
let lastTextureStatus: OffscreenTextureStatus | null = null;
|
||||
let appliedTextureRevision = -1;
|
||||
let contextLost = false;
|
||||
let width = 1;
|
||||
let height = 1;
|
||||
let orbit: ViewportOrbitState = { ...VIEWPORT_DEFAULT_ORBIT, target: [...VIEWPORT_DEFAULT_ORBIT.target] as [number, number, number] };
|
||||
let viewPreset: "SCENE_CAMERA" | "COMPARISON" = "SCENE_CAMERA";
|
||||
let editMode = false;
|
||||
let selectionMode: MeshElementMode = "FACE";
|
||||
let currentSnapshot: SceneSnapshotIR | null = null;
|
||||
@@ -95,7 +101,7 @@ function post(message: OffscreenViewportResponse, transfer?: Transferable[]): vo
|
||||
|
||||
function render(): void {
|
||||
if (contextLost || !renderer || !scene || !camera) return;
|
||||
if(!navigationCamera){const [x,y,z]=orbitPosition(orbit);camera.position.set(x,z,-y);camera.lookAt(orbit.target[0],orbit.target[2],-orbit.target[1]);}
|
||||
if (!navigationCamera) applyViewPresetPose(camera);
|
||||
renderer.render(scene, camera);
|
||||
publishCurveGizmoFrame();
|
||||
const gl = renderer.getContext();
|
||||
@@ -151,8 +157,21 @@ function resize(nextWidth: number, nextHeight: number, pixelRatio: number): void
|
||||
render();
|
||||
}
|
||||
|
||||
async function renderStill(requestId: string, stillWidth: number, stillHeight: number, cameraMode: "SCENE" | "VIEWPORT", clean: boolean): Promise<void> {
|
||||
async function renderStill(
|
||||
requestId: string,
|
||||
stillWidth: number,
|
||||
stillHeight: number,
|
||||
cameraMode: "SCENE" | "VIEWPORT",
|
||||
clean: boolean,
|
||||
displacementMultiplier = 1,
|
||||
displayMode: "FINAL" | "BASE_COLOR" | "NORMAL" | "ROUGHNESS" = "FINAL",
|
||||
exposureEv = 0,
|
||||
): Promise<void> {
|
||||
if (!renderer || !scene || !camera) throw new Error("VIEWPORT_NOT_READY: offscreen renderer is unavailable");
|
||||
for (let attempt = 0; attempt < 100 && !currentSnapshot; attempt += 1) {
|
||||
await new Promise((resolve) => setTimeout(resolve, 10));
|
||||
}
|
||||
await textureUpload;
|
||||
const previousSize = renderer.getSize(new Vector2());
|
||||
const previousRatio = renderer.getPixelRatio();
|
||||
const gridVisible = grid?.visible ?? false;
|
||||
@@ -164,22 +183,98 @@ async function renderStill(requestId: string, stillWidth: number, stillHeight: n
|
||||
stillCamera.updateProjectionMatrix();
|
||||
}
|
||||
if (cameraMode === "VIEWPORT" && !navigationCamera) {
|
||||
const [x, y, z] = orbitPosition(orbit);
|
||||
stillCamera.position.set(x, z, -y);
|
||||
stillCamera.lookAt(orbit.target[0], orbit.target[2], -orbit.target[1]);
|
||||
applyViewPresetPose(stillCamera);
|
||||
}
|
||||
else if (cameraMode === "SCENE" && currentSnapshot) {
|
||||
const sceneCameraId = currentSnapshot.scenes[0]?.cameraObjectId;
|
||||
const cameraNode = currentSnapshot.nodes.find((node) => node.id === sceneCameraId && node.type === "CAMERA");
|
||||
const definition = currentSnapshot.cameras.find((candidate) => candidate.id === cameraNode?.dataId);
|
||||
if (cameraNode && definition && stillCamera instanceof PerspectiveCamera) {
|
||||
matrixFor(cameraNode).decompose(stillCamera.position, stillCamera.quaternion, stillCamera.scale);
|
||||
configurePBRCamera(stillCamera, definition);
|
||||
stillCamera.updateMatrixWorld(true);
|
||||
}
|
||||
applySceneCameraPose(stillCamera);
|
||||
}
|
||||
if (clean && grid) grid.visible = false;
|
||||
renderer.render(scene, stillCamera);
|
||||
const previousExposure = renderer.toneMappingExposure;
|
||||
if (exposureEv !== 0) renderer.toneMappingExposure = previousExposure * 2 ** exposureEv;
|
||||
const diagnosticOriginals: Array<{ mesh: Mesh; material: Mesh["material"] }> = [];
|
||||
let diagnosticMeshes = 0;
|
||||
if (displayMode !== "FINAL" && currentSnapshot) {
|
||||
root?.traverse((object) => {
|
||||
if (!(object instanceof Mesh)) return;
|
||||
const mesh = object as Mesh;
|
||||
if (mesh.userData.blenderId !== currentSnapshot?.activeObjectId) return;
|
||||
const materials = Array.isArray(mesh.material) ? mesh.material : [mesh.material];
|
||||
const debug = materials.map((entry) => {
|
||||
if (!(entry instanceof MeshPhysicalMaterial)) return entry;
|
||||
if (displayMode === "BASE_COLOR") {
|
||||
return new MeshBasicMaterial({
|
||||
map: entry.map,
|
||||
color: entry.map ? 0xffffff : entry.color.clone(),
|
||||
side: entry.side,
|
||||
transparent: entry.transparent,
|
||||
});
|
||||
}
|
||||
if (displayMode === "NORMAL") {
|
||||
return new MeshNormalMaterial({
|
||||
normalMap: entry.normalMap,
|
||||
normalScale: entry.normalScale.clone(),
|
||||
side: entry.side,
|
||||
});
|
||||
}
|
||||
return new MeshBasicMaterial({
|
||||
map: entry.roughnessMap,
|
||||
color: entry.roughnessMap ? 0xffffff : new Color().setScalar(entry.roughness),
|
||||
side: entry.side,
|
||||
});
|
||||
});
|
||||
diagnosticOriginals.push({ mesh, material: mesh.material });
|
||||
mesh.material = Array.isArray(mesh.material) ? debug : debug[0];
|
||||
diagnosticMeshes += 1;
|
||||
});
|
||||
}
|
||||
const displaced: Array<{ mesh: Mesh; original: BufferGeometry; clone: BufferGeometry }> = [];
|
||||
const displacedMaterials: Array<{ material: MeshPhysicalMaterial; scale: number; bias: number }> = [];
|
||||
let displacementLevel = 0;
|
||||
let sourceTriangles = 0;
|
||||
let renderTriangles = 0;
|
||||
root?.traverse((object) => {
|
||||
if (!(object instanceof Mesh)) return;
|
||||
const mesh = object as Mesh;
|
||||
const materials = Array.isArray(mesh.material) ? mesh.material : [mesh.material];
|
||||
for (const material of materials) {
|
||||
if (!(material instanceof MeshPhysicalMaterial) || !material.displacementMap) continue;
|
||||
const data = material.userData.pbrDisplacement as { scale: number; midlevel: number } | undefined;
|
||||
if (!data) continue;
|
||||
displacedMaterials.push({ material, scale: material.displacementScale, bias: material.displacementBias });
|
||||
material.displacementScale = data.scale * displacementMultiplier;
|
||||
material.displacementBias = -data.midlevel * data.scale * displacementMultiplier;
|
||||
}
|
||||
if (!materials.some((material) => material instanceof MeshPhysicalMaterial && material.displacementMap)) return;
|
||||
const subdivided = subdivideForDisplacement(mesh.geometry);
|
||||
if (!subdivided.changed) return;
|
||||
const original = mesh.geometry;
|
||||
mesh.geometry = subdivided.geometry;
|
||||
displaced.push({ mesh, original, clone: subdivided.geometry });
|
||||
displacementLevel = Math.max(displacementLevel, subdivided.stats.level);
|
||||
sourceTriangles += subdivided.stats.sourceTriangles;
|
||||
renderTriangles += subdivided.stats.renderTriangles;
|
||||
});
|
||||
try {
|
||||
renderer.render(scene, stillCamera);
|
||||
}
|
||||
finally {
|
||||
for (const entry of displaced) {
|
||||
entry.mesh.geometry = entry.original;
|
||||
entry.clone.dispose();
|
||||
}
|
||||
for (const entry of displacedMaterials) {
|
||||
entry.material.displacementScale = entry.scale;
|
||||
entry.material.displacementBias = entry.bias;
|
||||
}
|
||||
for (const entry of diagnosticOriginals) {
|
||||
const current = entry.mesh.material;
|
||||
entry.mesh.material = entry.material;
|
||||
for (const material of Array.isArray(current) ? current : [current]) {
|
||||
if (material instanceof MeshBasicMaterial || material instanceof MeshNormalMaterial) material.dispose();
|
||||
}
|
||||
}
|
||||
renderer.toneMappingExposure = previousExposure;
|
||||
}
|
||||
const canvas = renderer.domElement as unknown as OffscreenCanvas;
|
||||
const blob = await canvas.convertToBlob({ type: "image/png" });
|
||||
const png = await blob.arrayBuffer();
|
||||
@@ -187,7 +282,33 @@ async function renderStill(requestId: string, stillWidth: number, stillHeight: n
|
||||
renderer.setPixelRatio(previousRatio);
|
||||
renderer.setSize(previousSize.x, previousSize.y, false);
|
||||
render();
|
||||
post({ type: "still", requestId, png, width: stillWidth, height: stillHeight, backend: "THREE_WEBGL2" }, [png]);
|
||||
const cameraDirection = new Vector3();
|
||||
stillCamera.getWorldDirection(cameraDirection);
|
||||
post({
|
||||
type: "still",
|
||||
requestId,
|
||||
png,
|
||||
width: stillWidth,
|
||||
height: stillHeight,
|
||||
backend: "THREE_WEBGL2",
|
||||
snapshotRevision: currentSnapshot?.revision ?? -1,
|
||||
textureRevision: lastTextureStatus?.textureRevision ?? -1,
|
||||
textureStatus: lastTextureStatus,
|
||||
camera: {
|
||||
position: stillCamera.position.toArray() as [number, number, number],
|
||||
target: stillCamera.position.clone().add(cameraDirection).toArray() as [number, number, number],
|
||||
},
|
||||
displacement: {
|
||||
meshes: displaced.length,
|
||||
level: displacementLevel,
|
||||
sourceTriangles,
|
||||
renderTriangles,
|
||||
multiplier: displacementMultiplier,
|
||||
},
|
||||
displayMode,
|
||||
exposureEv,
|
||||
diagnosticMeshes,
|
||||
}, [png]);
|
||||
}
|
||||
|
||||
function applyCamera(snapshot: SceneSnapshotIR): void {
|
||||
@@ -199,6 +320,66 @@ function applyCamera(snapshot: SceneSnapshotIR): void {
|
||||
if(camera instanceof PerspectiveCamera&&!navigationCamera)configurePBRCamera(camera, definition);
|
||||
}
|
||||
|
||||
function applySceneCameraPose(target: PerspectiveCamera | OrthographicCamera): boolean {
|
||||
if (!currentSnapshot || !(target instanceof PerspectiveCamera)) return false;
|
||||
const sceneCameraId = currentSnapshot.scenes[0]?.cameraObjectId;
|
||||
const cameraNode = currentSnapshot.nodes.find((node) => node.id === sceneCameraId && node.type === "CAMERA");
|
||||
const definition = currentSnapshot.cameras.find((candidate) => candidate.id === cameraNode?.dataId);
|
||||
if (!cameraNode || !definition) return false;
|
||||
const matrix = cameraNode.worldMatrix;
|
||||
const position = new Vector3(matrix[12], matrix[14], -matrix[13]);
|
||||
const forward = new Vector3(-matrix[8], -matrix[9], -matrix[10]);
|
||||
forward.set(forward.x, forward.z, -forward.y).normalize();
|
||||
const up = new Vector3(matrix[4], matrix[5], matrix[6]);
|
||||
up.set(up.x, up.z, -up.y).normalize();
|
||||
target.position.copy(position);
|
||||
target.up.copy(up);
|
||||
configurePBRCamera(target, definition);
|
||||
target.lookAt(position.clone().add(forward));
|
||||
target.updateMatrixWorld(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
function applyOrbitPose(target: PerspectiveCamera | OrthographicCamera): void {
|
||||
const [x, y, z] = orbitPosition(orbit);
|
||||
target.position.set(x, z, -y);
|
||||
target.lookAt(orbit.target[0], orbit.target[2], -orbit.target[1]);
|
||||
target.updateMatrixWorld(true);
|
||||
}
|
||||
|
||||
function applyComparisonPose(target: PerspectiveCamera | OrthographicCamera): void {
|
||||
const comparison: ViewportOrbitState = {
|
||||
...orbit,
|
||||
yaw: orbit.yaw + Math.PI / 6,
|
||||
pitch: Math.min(1.45, orbit.pitch + 0.18),
|
||||
distance: orbit.distance * 1.1,
|
||||
target: [0, 0, 0],
|
||||
};
|
||||
const [x, y, z] = orbitPosition(comparison);
|
||||
target.position.set(x, z, -y);
|
||||
target.lookAt(0, 0, 0);
|
||||
target.updateMatrixWorld(true);
|
||||
}
|
||||
|
||||
function applyViewPresetPose(target: PerspectiveCamera | OrthographicCamera): void {
|
||||
if (viewPreset === "SCENE_CAMERA" && applySceneCameraPose(target)) return;
|
||||
if (viewPreset === "COMPARISON") applyComparisonPose(target);
|
||||
else applyOrbitPose(target);
|
||||
}
|
||||
|
||||
function postViewPresetStatus(): void {
|
||||
if (!camera) return;
|
||||
const direction = new Vector3();
|
||||
camera.getWorldDirection(direction);
|
||||
const target = camera.position.clone().add(direction);
|
||||
post({
|
||||
type: "viewPresetStatus",
|
||||
preset: viewPreset,
|
||||
position: camera.position.toArray() as [number, number, number],
|
||||
target: target.toArray() as [number, number, number],
|
||||
});
|
||||
}
|
||||
|
||||
function geometryFrom(payload: MeshGeometryBuffer, materialCount: number): BufferGeometry {
|
||||
const sourcePositions = new Float32Array(payload.positions);
|
||||
const sourceIndices = new Uint32Array(payload.indices);
|
||||
@@ -322,14 +503,76 @@ async function refreshVolumes(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
function applyTextureAssets(assets: readonly GPUTextureAsset[]): void {
|
||||
void textureStore.upload(assets).then((status) => {
|
||||
if (currentSnapshot && root) textureStore.applySnapshotMaterials(root, currentSnapshot);
|
||||
const world = currentSnapshot?.worlds.find((candidate) => candidate.id === currentSnapshot?.scenes[0]?.worldId) ?? currentSnapshot?.worlds[0];
|
||||
if (scene && renderer) void textureStore.applyEnvironment(scene, renderer, world, true);
|
||||
post({ type: "textureStatus", loaded: status.loaded, rejected: status.rejected, bytes: status.bytes, errors: status.errors, errorCodes: status.errorCodes, budget: status.budget });
|
||||
function reapplyCurrentTextures(): void {
|
||||
if (!currentSnapshot || !root) return;
|
||||
textureStore.applySnapshotMaterials(root, currentSnapshot);
|
||||
const world = currentSnapshot.worlds.find((candidate) => candidate.id === currentSnapshot?.scenes[0]?.worldId) ?? currentSnapshot.worlds[0];
|
||||
if (!scene || !renderer) return;
|
||||
// Never replace an applied HDRI background with the flat world color.
|
||||
const background = Boolean(world?.environmentImageId);
|
||||
void textureStore.applyEnvironment(scene, renderer, world, background).then((applied) => {
|
||||
if (applied && root) {
|
||||
root.traverse((object) => {
|
||||
const material = (object as { material?: unknown }).material;
|
||||
for (const entry of Array.isArray(material) ? material : material ? [material] : []) {
|
||||
if (entry && typeof entry === "object" && "needsUpdate" in entry) (entry as { needsUpdate: boolean }).needsUpdate = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
render();
|
||||
}).catch((error) => post({ type: "error", message: error instanceof Error ? error.message : "Texture upload failed" }));
|
||||
}).catch(() => undefined);
|
||||
}
|
||||
|
||||
function postDisplacementStatus(): void {
|
||||
let mappedMaterials = 0;
|
||||
let boundMaterials = 0;
|
||||
root?.traverse((object) => {
|
||||
const material = (object as { material?: unknown }).material;
|
||||
for (const entry of Array.isArray(material) ? material : material ? [material] : []) {
|
||||
if (!entry || typeof entry !== "object") continue;
|
||||
if ((entry as { displacementMap?: unknown }).displacementMap) mappedMaterials += 1;
|
||||
if ((entry as { userData?: { pbrDisplacement?: unknown } }).userData?.pbrDisplacement) boundMaterials += 1;
|
||||
}
|
||||
});
|
||||
const heightTextures = currentSnapshot?.materials.reduce((count, material) =>
|
||||
count + (material.textureBindings ?? []).filter((binding) => binding.usage === "HEIGHT").length, 0) ?? 0;
|
||||
const heightTextureKeyList = textureStore.stats().keys.filter((key) => key.endsWith(":HEIGHT"));
|
||||
const heightBindingImageIds = currentSnapshot?.materials.flatMap((material) =>
|
||||
(material.textureBindings ?? []).filter((binding) => binding.usage === "HEIGHT").map((binding) => binding.imageId)) ?? [];
|
||||
post({ type: "displacementStatus", mappedMaterials, boundMaterials, heightTextures, heightTextureKeys: heightTextureKeyList.length, heightBindingImageIds, heightTextureKeyList });
|
||||
}
|
||||
|
||||
function applyTextureAssets(
|
||||
assets: readonly GPUTextureAsset[],
|
||||
textureRevision: number,
|
||||
snapshotRevision: number,
|
||||
expectedAssets: number,
|
||||
replace = false,
|
||||
): void {
|
||||
const upload = textureUpload.then(async () => {
|
||||
if (textureRevision < appliedTextureRevision) return;
|
||||
const status = await textureStore.upload(assets, { replace });
|
||||
if (textureRevision < appliedTextureRevision) return;
|
||||
appliedTextureRevision = textureRevision;
|
||||
reapplyCurrentTextures();
|
||||
postDisplacementStatus();
|
||||
lastTextureStatus = {
|
||||
snapshotRevision,
|
||||
textureRevision,
|
||||
requestedAssets: assets.length,
|
||||
expectedAssets,
|
||||
loaded: status.loaded,
|
||||
rejected: status.rejected,
|
||||
bytes: status.bytes,
|
||||
errors: status.errors,
|
||||
errorCodes: status.errorCodes,
|
||||
budget: status.budget,
|
||||
};
|
||||
post({ type: "textureStatus", ...lastTextureStatus });
|
||||
render();
|
||||
});
|
||||
textureUpload = upload.then(() => undefined, () => undefined);
|
||||
void upload.catch((error) => post({ type: "error", message: error instanceof Error ? error.message : "Texture upload failed" }));
|
||||
}
|
||||
|
||||
function clearLights(): void {
|
||||
@@ -438,10 +681,10 @@ function setSnapshot(snapshot: SceneSnapshotIR, buffers: MeshGeometryBuffer[], n
|
||||
greasePencilCount++;
|
||||
}
|
||||
const lightingBudget = planPBRLightingBudget(snapshot, "THREE_WEBGL2");
|
||||
post({ type: "snapshotStatus", nonMeshCount, nonMeshBlockedCount, greasePencilCount, greasePencilBlockedCount, greasePencilOnionStrokeCount, renderBudget: lightingBudget });
|
||||
post({ type: "snapshotStatus", snapshotRevision: snapshot.revision, nonMeshCount, nonMeshBlockedCount, greasePencilCount, greasePencilBlockedCount, greasePencilOnionStrokeCount, renderBudget: lightingBudget });
|
||||
const world = snapshot.worlds.find((candidate) => candidate.id === snapshot.scenes[0]?.worldId) ?? snapshot.worlds[0];
|
||||
const sceneDefinition = snapshot.scenes.find((candidate) => candidate.id === snapshot.sceneId) ?? snapshot.scenes[0];
|
||||
scene.background = world ? new Color().setRGB(...world.color) : new Color(0x25272b);
|
||||
if (!world?.environmentImageId) scene.background = world ? new Color().setRGB(...world.color) : new Color(0x25272b);
|
||||
if (renderer) configurePBRRenderer(renderer, {
|
||||
viewTransform: sceneDefinition?.colorManagement?.viewTransform,
|
||||
exposure: sceneDefinition?.colorManagement?.exposure ?? world?.exposure ?? 0,
|
||||
@@ -466,6 +709,8 @@ function setSnapshot(snapshot: SceneSnapshotIR, buffers: MeshGeometryBuffer[], n
|
||||
objectById.set(node.id, light);
|
||||
}
|
||||
}
|
||||
reapplyCurrentTextures();
|
||||
postDisplacementStatus();
|
||||
void refreshVolumes();
|
||||
render();
|
||||
}
|
||||
@@ -650,7 +895,19 @@ workerScope.onmessage = (event): void => {
|
||||
camera.position.fromArray(state.position);camera.quaternion.fromArray(state.quaternion);camera.zoom=state.zoom;camera.near=state.near;camera.far=state.far;camera.updateProjectionMatrix();render();
|
||||
}
|
||||
else if (message.type === "snapshot") setSnapshot(message.snapshot, message.geometryBuffers, message.nonMeshGeometryBuffers);
|
||||
else if (message.type === "textureAssets") applyTextureAssets(message.assets);
|
||||
else if (message.type === "textureAssets") applyTextureAssets(
|
||||
message.assets,
|
||||
message.textureRevision,
|
||||
message.snapshotRevision,
|
||||
message.expectedAssets,
|
||||
message.replace,
|
||||
);
|
||||
else if (message.type === "viewPreset") {
|
||||
viewPreset = message.preset;
|
||||
navigationCamera = false;
|
||||
render();
|
||||
postViewPresetStatus();
|
||||
}
|
||||
else if (message.type === "volumeAssets") {
|
||||
volumeAssets = message.assets;
|
||||
volumeAssetsInitialized = true;
|
||||
@@ -688,7 +945,7 @@ workerScope.onmessage = (event): void => {
|
||||
}
|
||||
else if (message.type === "paintDepthVisibility") paintDepthVisibility(message.requestId, message.request);
|
||||
else if (message.type === "renderStill") {
|
||||
void renderStill(message.requestId, message.width, message.height, message.cameraMode, message.clean)
|
||||
void renderStill(message.requestId, message.width, message.height, message.cameraMode, message.clean, message.displacementMultiplier ?? 1, message.displayMode ?? "FINAL", message.exposureEv ?? 0)
|
||||
.catch((error: unknown) => post({ type: "stillError", requestId: message.requestId, message: error instanceof Error ? error.message : String(error) }));
|
||||
}
|
||||
else if (message.type === "dispose") {
|
||||
|
||||
Reference in New Issue
Block a user