Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions packages/core/src/capture/schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ import {
const identity = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]

describe('capture manifests', () => {
test('keeps generated scenes independent from the original room model', () => {
const descriptor = normalizeCaptureSessionManifest({
schemaVersion: 2,
sessionId: 'capture_123',
streams: [
{ id: 'room', kind: 'room-model', role: 'model' },
{ id: 'generated', kind: 'spaceform-scene' },
],
})
expect(descriptor.streams.map(captureLayerKey)).toEqual(['model', 'spaceformScene'])
})

test('normalizes the Community v1 manifest into extensible streams', () => {
const descriptor = normalizeCaptureSessionManifest({
schemaVersion: 1,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/capture/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ export function captureLayerKey(stream: CaptureStreamDescriptor): string {
if (stream.kind === 'point-cloud') return 'pointCloud'
if (stream.kind === 'surface-mesh') return 'surfaceMesh'
if (stream.kind === 'gaussian-splat') return 'splat'
if (stream.kind === 'spaceform-scene') return 'spaceformScene'
return stream.kind
}

Expand Down
2 changes: 1 addition & 1 deletion packages/viewer/src/capture/capture-runtime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export function CaptureStreamLayer({
/>
)
} else if (
layerKey === 'model' &&
(layerKey === 'model' || layerKey === 'spaceformScene') &&
isCaptureModelArtifact(stream.artifact) &&
stream.artifact &&
artifactUrl
Expand Down
19 changes: 19 additions & 0 deletions packages/viewer/src/capture/stream-rendering.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@ import { describe, expect, test } from 'bun:test'
import { isCaptureStreamRenderable } from './stream-rendering'

describe('isCaptureStreamRenderable', () => {
test('renders completed generated models while withholding failed and pending results', () => {
const stream = {
id: 'generated',
kind: 'spaceform-scene',
artifact: { id: 'generated', mediaType: 'model/gltf-binary', uri: '/scene.glb' },
}
expect(isCaptureStreamRenderable({ ...stream, availability: 'ready' })).toBe(true)
for (const availability of ['pending', 'failed'] as const) {
expect(isCaptureStreamRenderable({ ...stream, availability })).toBe(false)
}
expect(isCaptureStreamRenderable({ id: stream.id, kind: stream.kind })).toBe(false)
expect(
isCaptureStreamRenderable({
...stream,
artifact: { id: 'unsupported', mediaType: 'application/json', uri: '/scene.json' },
}),
).toBe(false)
})

test('only advertises point-cloud formats handled by the reference renderer', () => {
expect(
isCaptureStreamRenderable({
Expand Down
4 changes: 3 additions & 1 deletion packages/viewer/src/capture/stream-rendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ export function isCaptureStreamRenderable(
if (stream.availability === 'failed' || stream.availability === 'pending') return false
const layerKey = captureLayerKey(stream)
if (customRendererKeys.has(layerKey) || customRendererKeys.has(stream.kind)) return true
if (layerKey === 'model') return isCaptureModelArtifact(stream.artifact)
if (layerKey === 'model' || layerKey === 'spaceformScene') {
return isCaptureModelArtifact(stream.artifact)
}
if (layerKey === 'deviceMotion') {
return (
stream.availability === 'live' ||
Expand Down